123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580 |
- #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.UI.ConsentSvcRef;
- using CLIP.eForm.Consent.UI.HospitalSvcRef;
- using ClipSoft.eForm.Base.Dialog;
- using static CLIP.eForm.Consent.UI.Common;
- namespace CLIP.eForm.Consent.UI {
- /// <summary>
- /// 출력, 전자동의서 실행 버튼 클래스
- /// </summary>
- /// <remarks>
- /// <p>[설계자]</p>
- /// <p> 클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)</p>
- /// <p>[원본 작성자]</p>
- /// <p> 클립소프트 기술부 이창훈 (chlee@clipsoft.co.kr)</p>
- /// <p>[수정 작성자]</p>
- /// <p> 클립소프트 기술부 이인희</p>
- /// <p>----------------------------------------------------------------------------------------</p>
- /// <p>[HISTORY]</p>
- /// <p> 2016-06-21 : 최초작성</p>
- /// <p>----------------------------------------------------------------------------------------</p>
- /// </remarks>
- 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));
- private bool m_IsComplete = false; // 확인 저장 버튼 클릭 여부
- public bool IsComplete => m_IsComplete;
- 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;
- }
- }
- /// <summary>
- /// 임시저장 버튼 클릭 활성화 여부 반환
- /// </summary>
- /// <returns></returns>
- public override bool getTempSaveButton() {
- return this.toolStripButtonTempSaveToServer.Enabled;
- }
- /// <summary>
- /// 저장 버튼 클릭 활성화 여부 반환
- /// </summary>
- /// <returns></returns>
- 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;
- }
- public void setButtonsVisibility(string patientOrdtype, string consentState) {
- if (patientOrdtype.Equals("O")) {
- toolStripButtonCompleteSaveToServer.Visible = true;
- toolStripButtonCompleteSaveToServer.Enabled = true;
- } else {
- toolStripButtonCompleteSaveToServer.Visible = false;
- toolStripButtonCompleteSaveToServer.Enabled = false;
- }
- if (consentState.Equals("인증") || consentState.Equals("확인")) {
- // 임시저장 버튼 비활성화
- toolStripButtonTempSaveToServer.Visible = false;
- toolStripButtonTempSaveToServer.Enabled = false;
- // 확인저장 버튼 비활성화
- toolStripButtonCompleteSaveToServer.Visible = false;
- toolStripButtonCompleteSaveToServer.Enabled = false;
- }
- else {
- // 임시저장 버튼 활성화
- toolStripButtonTempSaveToServer.Visible = true;
- toolStripButtonTempSaveToServer.Enabled = true;
- }
- }
- public void setZoomRate(int rate) {
- toolStripComboBoxZoom.SelectedIndex = rate;
- toolStripComboBoxZoom.Enabled = true; // zoom rate
- toolStripButtonPrevPage.Enabled = true; // 이전 페이지
- toolStripButtonNextPage.Enabled = true; // 다음 페이지
- toolStripTextBoxPageIndex.Enabled = true; // 페이지 인덱스
- toolStripLabelTotalPages.Enabled = true;
- toolStripButtonFirstPage.Enabled = true; // 처음 페이지
- toolStripButtonLastPage.Enabled = true; // 마지막페이지
- toolStripTextBoxPageIndex.Text = consentMain.GetCurrentPageIndex().ToString();
- toolStripLabelTotalPages.Text = consentMain.GetTotalPageCount().ToString();
- }
- public override void setCompleteSaveTempButton(bool enabled) {
- this.toolStripButtonTempSaveToServer.Enabled = enabled;
- this.toolStripButtonCompleteSaveToServer.Enabled = enabled;
- this.toolStripButtonCompleteSaveToServer.Visible = true;
- this.toolStripButtonSaveToServer.Enabled = true;
- }
- public override void setCompleteSaveButton(bool enabled) {
- this.toolStripButtonCompleteSaveToServer.Enabled = enabled;
- toolStripButtonCompleteSaveToServer.Visible = enabled;
- }
- protected override void OnLoad(EventArgs e) {
- base.OnLoad(e);
- if (this.DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime) {
- return;
- }
- if (!ConsentMainControl.HasMultipleMonitor) {
- 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() {
- // 콤보 박스에 저장되는 형식을 ArrayList 로 바꿈
- List<ZoomRateDropdownItem> zoomRateList = new List<ZoomRateDropdownItem>();
- zoomRateList.Add(new ZoomRateDropdownItem("50%", "50"));
- zoomRateList.Add(new ZoomRateDropdownItem("75%", "75"));
- zoomRateList.Add(new ZoomRateDropdownItem("100%", "100"));
- zoomRateList.Add(new ZoomRateDropdownItem("200%", "200"));
- zoomRateList.Add(new ZoomRateDropdownItem("창 너비에 맞춤", "pagewidth"));
- zoomRateList.Add(new ZoomRateDropdownItem("창 크기에 맞춤", "wholepage"));
- toolStripComboBoxZoom.Items.AddRange(zoomRateList.ToArray());
- }
- #region toolStripButton 이벤트
- private void ToolStripButtons_MouseEnter(object sender, EventArgs e) {
- this.toolStripButtons.Focus();
- }
- /// <summary>
- /// 처음 페이지로 이동 버튼 클릭 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void toolStripButtonFirstPage_Click(object sender, EventArgs e) {
- this.consentMain.MoveFirstPage();
- }
- /// <summary>
- /// 이전 페이지로 이동 버튼 클릭 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void toolStripButtonPrevPage_Click(object sender, EventArgs e) {
- this.consentMain.MovePrevPage();
- }
- /// <summary>
- /// 다음 페이지 이동 버튼 클릭 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void toolStripButtonNextPage_Click(object sender, EventArgs e) {
- this.consentMain.MoveNextPage();
- }
- /// <summary>
- /// 마지막 페이지로 이동 버튼 클릭 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void toolStripButtonLastPage_Click(object sender, EventArgs e) {
- this.consentMain.MoveLastPage();
- }
- /// <summary>
- /// toolStripTextBoxPageIndex 텍스트 변경 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void 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);
- }
- }
- }
- /// <summary>
- /// 동의서 확대비율 지정 콤보 박스 변경 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void toolStripComboBoxZoom_SelectedIndexChanged(object sender, EventArgs e) {
- ZoomRateDropdownItem zoomRateItem = this.toolStripComboBoxZoom.SelectedItem as ZoomRateDropdownItem;
- if (zoomRateItem == null) {
- } else {
- this.consentMain.SetZoomRate(zoomRateItem.ItemValue);
- }
- }
- /// <summary>
- /// 출력 버튼 클릭 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void toolStripButtonPrint_Click(object sender, EventArgs e) {
- // dbs227, 현재 동의서 상태가 null 이라면 skip
- if (CurrentPreviewConsent == null) {
- SetEnableButtonsByCurrentConsent();
- return;
- }
- this.consentMain.setPrintButton(true);
- PrintConsent();
- }
- /// <summary>
- /// 동의서 닫기 버튼 클릭 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void toolStripButtonCloseDualViewer_Click(object sender, EventArgs e) {
- this.consentMain.CloseDualViewer();
- }
- /// <summary>
- /// 임시저장 버튼 클릭 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void toolStripButtonTempSaveToServer_Click(object sender, EventArgs e) {
- // 동의서 임시 저장
- this.consentMain.TempSave();
- }
- /// <summary>
- /// 서명 버튼 클릭 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void toolStripButtonSaveToServer_Click(object sender, EventArgs e) {
- // dbs227, 현재 동의서 상태가 null 이라면 skip
- if (CurrentPreviewConsent == null) {
- SetEnableButtonsByCurrentConsent();
- return;
- }
- // TODO 인증저장 권한은 누가?
- // 로그인 사용자와 동의서 작성자가 다르면 인증 저장 제한
- //if (!CurrentPreviewConsent.InputId.Equals(consentMain.ConsentExecuteInfo["loginUserId"])) {
- // MessageBox.Show("작성자만 인증 저장이 가능합니다.", "인증 저장 불가", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- // return;
- //}
- this.consentMain.saveClickPoint = true;
- this.consentMain.Save();
- this.consentMain.saveClickPoint = false;
- }
- /// <summary>
- /// 확인 저장 버튼 클릭 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void toolStripButtonCompleteSaveToServer_Click(object sender, EventArgs e) {
- m_IsComplete = true;
- this.consentMain.Save();
- m_IsComplete = false;
- }
- /// <summary>
- /// 전자동의서 실행 버튼 클릭 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void toolStripButtonExecute_Click(object sender, EventArgs e) {
- RunConsentDualView();
- }
- /// <summary>
- /// 펜 그리기 모드 활성화/비활성화 버튼 클릭 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void toolStripButtonPen_Click(object sender, EventArgs e) {
- bool isDrawMode = this.consentMain.IsDrawMode();
- this.consentMain.EnableDrawing(!isDrawMode);
- this.toolStripButtonPen.Checked = !isDrawMode;
- }
- /// <summary>
- /// 그리기 펜 설정 버튼 클릭 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void toolStripButtonPenConfig_Click(object sender, EventArgs e) {
- // 펜 색상 및 두께 변경
- this.consentMain.ConfigDrawingPen();
- }
- /// <summary>
- /// 펜 그리기 데이터 모두 삭제 버튼 클릭 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void toolStripButtonDelAllDraw_Click(object sender, EventArgs e) {
- this.consentMain.RemoveAllDrawing();
- }
- /// <summary>
- /// 펜 그리기 undo 버튼 클릭 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void toolStripButtonUndo_Click(object sender, EventArgs e) {
- this.consentMain.UndoDrawing();
- }
- /// <summary>
- /// 펜 그리기 redo 버튼 클릭 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void toolStripButtonRedo_Click(object sender, EventArgs e) {
- this.consentMain.RedoDrawing();
- }
- #endregion
- /// <summary>
- /// 페지 변경시 이벤트
- /// 외부에서 호출하는 메서드
- /// </summary>
- /// <param name="currentPageIndex">Index of the current page.</param>
- public override void OnPaging(int currentPageIndex) {
- this.toolStripTextBoxPageIndex.Text = currentPageIndex.ToString();
- }
- /// <summary>
- /// 동의서 종이 출력
- /// </summary>
- /// <param name="value"></param>
- public override void OnPrint(string value) {
- Cursor currentCursor = this.Cursor;
- try {
- this.Cursor = Cursors.WaitCursor;
- SaveDataForPrintedConsent(string.Empty);
- // dbs227, 경대병원 프린트 연동 로그 추후 기록
- // 기존 저장 루틴 위치 변경
- //SaveDataForPrintedConsent(string.Empty);
- // 출력 카운트만큼 출력 된 후 처리
- /*
- if (this.consentMain.printSaveStatus) {
- if (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 (consentMain.ConsentExecuteInfo["printAct"].Equals("Y")) {
- this.consentMain.agentCallPrintCnt--;
- if (this.consentMain.agentCallPrintCnt == 0) {
- this.consentMain.Parent_Disposed();
- }
- }
- }
- */
- } catch (Exception ex) {
- throw ex;
- } finally {
- this.Cursor = currentCursor;
- // dbs227 저장이 끝나면 preview 객체를 초기화 하여 준다
- CurrentPreviewConsent = null;
- }
- base.OnPrint(value);
- }
- /// <summary>
- /// 동의서 동의서 미리보기 상태 활성화 처리
- /// </summary>
- /// <param name="isIssuable"></param>
- 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.toolStripButtonDeleteAllSignData.Enabled = isIssuable;//그림그린거 다없앤거
- this.toolStripButtonInsertAttach.Enabled = isIssuable;//첨지
- this.toolStripButtonDeleteAttach.Enabled = isIssuable;//첨지삭제
- this.toolStripButtonSaveToServer.Enabled = isIssuable; // 인증 저장
- this.toolStripButtonTempSaveToServer.Enabled = isIssuable; // 임시 저장
- //this.toolStripButtonCompleteSaveToServer.Enabled = isIssuable; // 완료 저장
- }
- /// <summary>
- /// 동의서 상태에 따라 버튼들 활성화를 조절한다
- /// </summary>
- public override void SetEnableButtonsByCurrentConsent() {
- string state = string.Empty;
- if (this.CurrentPreviewConsent != null) {
- state = this.CurrentPreviewConsent.ConsentState;
- }
- if (this.CurrentTargetPatient != null && !string.IsNullOrEmpty(this.CurrentTargetPatient.pid)
- && CurrentPreviewConsent != null) {
- if (!ConsentMainControl.HasMultipleMonitor) {
- this.toolStripButtonTempSaveToServer.Enabled = true;
- this.toolStripButtonSaveToServer.Enabled = true;
- //this.toolStripButtonCompleteSaveToServer.Enabled = true;
- //this.toolStripButtonPrint.Enabled = true;
- SetEnableButtonsByConsentStateForSingleView(state);
- this.EnablePenDrawing = true;
- this.EnablePenConfig = true;
- } else {
- //this.toolStripButtonCompleteSaveToServer.Enabled = true;
- this.toolStripButtonSaveToServer.Enabled = true;
- this.toolStripButtonExecute.Enabled = true;
- //this.toolStripButtonPrint.Enabled = true;
- SetEnableButtonsByConsentStateForDualView(state);
- }
- this.toolStripButtonDelAllDraw.Enabled = true;
- this.toolStripButtonRedo.Enabled = true;
- this.toolStripButtonUndo.Enabled = true;
- } else {
- //this.toolStripButtonPrint.Enabled = false;
- this.toolStripButtonTempSaveToServer.Enabled = false;
- this.toolStripButtonCompleteSaveToServer.Enabled = false;
- this.toolStripButtonSaveToServer.Enabled = false;
- this.toolStripButtonDelAllDraw.Enabled = false;
- this.toolStripButtonRedo.Enabled = false;
- this.toolStripButtonUndo.Enabled = false;
- }
- }
- /// <summary>
- /// Dual Viewer 활성화 시 버튼 활성화 설정
- /// </summary>
- /// <param name="enabled">활성화 여부</param>
- public override void SetEnablementExecuteWhenDualViewerActive(bool enabled) {
- // 전자동의서 실행 버튼
- this.toolStripButtonExecute.Enabled = enabled;
- // 출력 버튼
- //this.toolStripButtonPrint.Enabled = enabled;
- if (enabled) {
- if (this.CurrentPreviewConsent != null && this.CurrentPreviewConsent.OutputType != null) {
- if (this.CurrentPreviewConsent.OutputType.Equals("ELECTRONIC")) {
- //this.toolStripButtonPrint.Enabled = !enabled;
- }
- }
- }
- // Dual Viewer 닫기 버튼
- this.toolStripButtonCloseDualViewer.Visible = !enabled;
- SetEnableByUserType();
- base.SetEnablementExecuteWhenDualViewerActive(enabled);
- }
- /// <summary>
- /// 동의서 상태에 따른 Dual view 상태의 버튼 설정
- /// </summary>
- /// <param name="state">The state.</param>
- private void SetEnableButtonsByConsentStateForDualView(string state) {
- if (state.Equals("PAPER_OUT")) {
- this.toolStripButtonExecute.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;
- }
- }
- /// <summary>
- /// 동의서 상태에 따른 Single view 상태의 버튼 설정
- /// </summary>
- /// <param name="state">The state.</param>
- private void SetEnableButtonsByConsentStateForSingleView(string state) {
- if (state.Equals("PAPER_OUT")) {
- this.toolStripButtonSaveToServer.Enabled = false;
- this.toolStripButtonCompleteSaveToServer.Enabled = false;
- this.toolStripButtonTempSaveToServer.Enabled = false;
- this.toolStripButtonExecute.Enabled = false;
- } else if (state.Equals("ELECTR_CMP") || state.Equals("CERTIFY_CMP")) {
- this.toolStripButtonTempSaveToServer.Enabled = false;
- this.toolStripButtonCompleteSaveToServer.Enabled = false;
- this.toolStripButtonSaveToServer.Enabled = false;
- //this.toolStripButtonPrint.Enabled = false;
- }
- if (this.CurrentPreviewConsent.RewriteConsentMstRid > 0) {
- this.toolStripButtonTempSaveToServer.Enabled = true;
- //this.toolStripButtonCompleteSaveToServer.Enabled = true;
- this.toolStripButtonSaveToServer.Enabled = true;
- }
- }
- /// <summary>
- /// 미작성 동의서 삭제
- /// </summary>
- /// <param name="reasonForUseN"></param>
- public override int DeleteRecordOfDeleteConsent(string reasonForUseN) {
- return SaveDataForDeleteConsent(reasonForUseN);
- }
- /// <summary>
- /// 출력된 동의서를 저장
- /// </summary>
- /// <param name="reasonForUseN">The reason for use n.</param>
- //private void SaveDataForPrintedConsent(string reasonForUseN) {
- public void SaveDataForPrintedConsent(string reasonForUseN) {
- string consentOutputType = this.CurrentPreviewConsent.OutputType;
- string consentState = this.CurrentPreviewConsent.ConsentState;
- //int result = -1;
- //인쇄(바코드제외)인 경우 CONSENT_MST에 데이터를 입력하지 않는다.
- if ((!string.IsNullOrEmpty(consentOutputType) && consentOutputType.Equals("PAPER_EXCEPT_BARCODE"))) {
- //return result;
- return;
- }
- // 다중 출력 시
- if (consentOutputType != null && consentOutputType.Equals("MULTI")) {
- Cursor currentCursor = this.Cursor;
- try {
- this.Cursor = Cursors.WaitCursor;
- List<PatListVO> 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('^');
- }
- int lastRid = -1;
- for (int i = 0; i < volist.Count; i++) {
- PatientVO vo = GetPatientByPatList(volist[i]);
- string userId = CurrentEndUser.userId;
- string hosType = consentMain.ConsentExecuteInfo["dutinstcd"];
- string userName = CurrentEndUser.userName;
- string patientCode = vo.pid;
- string clnDeptCode = vo.ordDeptCd;
- string vistType = vo.ordType;
- string clnDate = vo.inDd.Replace("-", "");
- int rewriteConsentMstRid = 0;
- string ward = vo.ward;
- string roomcd = vo.roomCd;
- string formRid = CurrentPreviewConsent.FormRid;
- string formCd = CurrentPreviewConsent.FormCd;
- string consentMstRid = CurrentPreviewConsent.ConsentMstRid;
- // 처방 번호
- //int orderNo = vo.IO_OrderNo;
- // 진단 코드
- //string orderCode = vo.IO_Dx;
- string orderName = vo.diagHngNm;
- string ocrCode = (strOcrCd != null && !string.IsNullOrEmpty(strOcrCd[i])) ? strOcrCd[i] : CurrentPreviewConsent.Ocrcode;
- string mainDrId = (strMainDrIdCd != null && !string.IsNullOrEmpty(strMainDrIdCd[i])) ? strMainDrIdCd[i] : currentTargetPatient.mainDrId;
- int cretno = vo.cretNo;
- //int.TryParse(vo.cretNo, out int cretno);
- ConvertStringToInt(formRid, consentMstRid, out int formRidInt, out int consentMstRidInt);
- string deviceIdentNo = System.Environment.MachineName;
- // 동의서 프린트 출력 후 데이터를 저장
- consentMstRidInt = consentWebService.SavePrintOut(userId
- , patientCode
- , clnDeptCode
- , formRidInt
- , formCd
- , consentMstRidInt
- , rewriteConsentMstRid
- , null
- , null
- , "PRT"
- , deviceIdentNo
- , vistType
- , hosType
- , clnDate
- , ward
- , roomcd
- , 0 // orderNo 경대병원 사용하지 않음
- , "" // orderName 경대병원 사용하지 않음
- , "" // orderCode 경대병원 사용하지 않음
- , ocrCode
- , cretno
- , userName
- , userName
- , mainDrId
- , CurrentEndUser.deptcd
- , consentMain.GetTotalPageCount().ToString()
- , "P"
- , "PC"
- , CurrentTargetPatient.OpRsrvNo);
- lastRid = consentMstRidInt;
- //result = lastRid;
- }
- this.consentMain.ConsentListCtrl.InquiryConsentData(lastRid);
- // dbs227,
- // 출력 모드가 아닐때는 초기화 하지 않는다.
- //if (!this.consentMain.ConsentExecuteInfo["printYN"].Equals("Y"))
- //{
- //this.consentMain.ConsentListCtrl.InquiryConsentData(lastRid);
- //}
- this.consentMain.multiPrintExecCnt++;
- } catch (Exception ex) {
- throw ex;
- } finally {
- this.Cursor = currentCursor;
- }
- consentMain.PatientListCtrl.SetClearCheckBox();
- consentMain.ReInitializeViewer();
- } else {
- if (this.CurrentTargetPatient != null && !string.IsNullOrEmpty(this.CurrentTargetPatient.pid)) {
- string userId = CurrentEndUser.userId;
- string instcd = consentMain.ConsentExecuteInfo["dutinstcd"];
- string userName = CurrentEndUser.userName;
- string pid = CurrentTargetPatient.pid;
- string clnDeptCode = CurrentTargetPatient.clnDeptCode;
- string ordtype = CurrentTargetPatient.ordtype;
- string clnDate = CurrentTargetPatient.clnDate.Replace("-", "");
- string ward = CurrentTargetPatient.ward;
- string roomcd = currentTargetPatient.roomno;
- int orderNo = CurrentTargetPatient.orderno;
- string orderCode = CurrentTargetPatient.opDeptCd;
- string orderName = CurrentTargetPatient.opDeptNm;
- string mainDrId = CurrentTargetPatient.mainDrId;
- string formRid = CurrentPreviewConsent.FormRid;
- string formCd = CurrentPreviewConsent.FormCd;
- string consentMstRid = CurrentPreviewConsent.ConsentMstRid;
- string ocrCode = CurrentPreviewConsent.Ocrcode;
- int cretno = 0;
- int.TryParse(CurrentTargetPatient.cretno, out cretno);
- ConvertStringToInt(formRid, consentMstRid, out int formRidInt, out int consentMstRidInt);
- int reissueConsentMstRid = 0;
- string deviceIdentNo = System.Environment.MachineName;
- Cursor currentCursor = this.Cursor;
- try {
- this.Cursor = Cursors.WaitCursor;
- // 동의서 프린트 출력 후 데이터를 저장
- consentMstRidInt = consentWebService.SavePrintOut(userId
- , pid
- , clnDeptCode
- , formRidInt
- , formCd
- , consentMstRidInt
- , reissueConsentMstRid
- , null
- , null
- , "PRT"
- , deviceIdentNo
- , ordtype
- , instcd
- , clnDate
- , ward
- , roomcd
- , orderNo
- , orderName
- , orderCode
- , ocrCode
- , cretno
- , userName
- , userName
- , mainDrId
- , currentEndUser.deptcd
- , consentMain.GetTotalPageCount().ToString()
- , "P"
- , "PC"
- , CurrentTargetPatient.OpRsrvNo);
- this.consentMain.ConsentListCtrl.InquiryConsentData(consentMstRidInt);
- this.consentMain.multiPrintExecCnt++;
- //result = consentMstRidInt;
- } catch (Exception ex) {
- throw ex;
- } finally {
- this.Cursor = currentCursor;
- }
- }
- }
- //return result;
- }
- /// <summary>
- /// 출력 히스토리 삭제
- /// </summary>
- public void erasePrintHistory() {
- String consentMstRid = CurrentPreviewConsent.ConsentMstRid;
- String ocrCode = CurrentPreviewConsent.Ocrcode;
- String instcd = consentMain.ConsentExecuteInfo["dutinstcd"];
- String pid = CurrentTargetPatient.pid;
- Cursor currentCursor = this.Cursor;
- try {
- this.Cursor = Cursors.WaitCursor;
- consentWebService.updatePrintHistory(pid, ocrCode, instcd);
- } catch (Exception ex) {
- throw ex;
- } finally {
- this.Cursor = currentCursor;
- }
- }
- /// <summary>
- /// 환자리스트의 한 환자의 상세정보를 조회한다
- /// </summary>
- /// <param name="patvo">조회할 환자의 PatListVO 인스턴스</param>
- /// <returns></returns>
- 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()
- , this.consentMain.ConsentExecuteInfo["dutinstcd"]
- , this.consentMain.ConsentExecuteInfo["opRsrvNo"]);
- if (patientVOList == null || patientVOList.Length == 0) {
- return null;
- } else {
- return patientVOList[0];
- }
- }
- /// <summary>
- /// 삭제 사유와 함께 전자동의서 삭제
- /// </summary>
- /// <param name="reasonForUseN">삭제할 사유</param>
- private int SaveDataForDeleteConsent(string reasonForUseN) {
- string userId = CurrentEndUser.userId;
- string patientCode = CurrentTargetPatient.pid;
- 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;
- ConvertStringToInt(formRid, consentMstRid, out int formRidInt, out int consentMstRidInt);
- int.TryParse(CurrentTargetPatient.cretno, out int cretno);
- int reissueConsentMstRidInt = CurrentPreviewConsent.ReissueConsentMstRid;
- string deviceIdentNo = System.Environment.MachineName;
- ConsentSvcRef.SingleReturnData result = this.consentWebService.saveDelete(userId, consentMstRid, reasonForUseN);
- return Convert.ToInt32(result.responseData);
- // TODO 추후 구현
- //this.consentWebService.SaveDelete(userId
- // , consentMstRidInt
- // , patientCode
- // , clnDeptCd
- // , ward
- // , roomcd
- // , formRidInt
- // , CurrentPreviewConsent.FormCd
- // , rewriteConsentMstRid
- // , reissueConsentMstRidInt
- // , consentState
- // , deviceIdentNo
- // , CurrentTargetPatient.ordtype
- // , consentMain.ConsentExecuteInfo["dutinstcd"]
- // , CurrentTargetPatient.clnDate
- // , reasonForUseN
- // , CurrentPreviewConsent.Ocrcode
- // , cretno
- // , currentEndUser.deptcd
- // , consentMain.GetTotalPageCount().ToString()
- // , "CP"
- // , "P");
- }
- private void SetHasMedicalHistoryInConsent(string patientCode) {
- this.CurrentPreviewConsent.HasMedicalHistory = false;
- }
- /// <summary>
- /// 동의서 뷰어에 동의서 로드
- /// </summary>
- public void RunConsentDualView() {
- bool runDualView = true;
- if(this.CurrentPreviewConsent == null) {
- return;
- }
- 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"))) {
- runDualView = false;
- }
- //현재 프로그램이 실행되고 있는정보 가져오기: 디버깅 모드라면 bin/debug/프로그램명.exe
- FileInfo exefileinfo = new FileInfo(Path.GetDirectoryName(Application.StartupPath));
- // AppDomain.CurrentDomain.DynamicDirectory
- // Server.MapPath("~")
- string path = Path.GetDirectoryName(Application.StartupPath);//@"C:\eForm Server\Consent-Web-Server-CNUH\";// HttpContext.Current.Request.PhysicalApplicationPath;
- string fileName = @"\config.ini"; //파일명
- //만약 현재 실행 되는 경로가 아닌 특정한 위치를 원한다면 위에 과정 상관없이 바로 경로셋팅 해 주면 된다. (예: c:\config.ini)
- string filePath = path + fileName; //ini 파일 경로
- iniUtil ini = new iniUtil(filePath); // 만들어 놓았던 iniUtil 객체 생성(생성자 인자로 파일경로 정보 넘겨줌)
- //이제 ini 객체를 이용해 맘것 사용하면 된다.
- string sMoniterNumber = ini.GetIniValue("DCMC", "MONITER_NUMBER");
- if (sMoniterNumber.Equals("0")) {
- return;
- }
- // 동의서 로드 전 consent_mst_rid에 해당하는 동의서가 상위 상태값이 있는지 체크
- //int state = this.consentWebService.CheckConsentState(int.Parse(this.CurrentPreviewConsent.ConsentMstRid),
- // this.CurrentPreviewConsent.ConsentState);
- //if (state == 1) {
- // return;
- //}
- // 출력만 가능하거나 출력상태일 경우 듀얼뷰어 실행 못하도록 적용
- if (runDualView) this.consentMain.RunConsentDualView();
- }
- /// <summary>
- /// 인증저장 된 동의서를 보여준다
- /// </summary>
- /// <param name="consentMain">The consent main.</param>
- public void ShowCompleteConsent(IConsentMain consentMain) {
- //SetEnableButtonsByCurrentConsent();
- consentMain.ReviewConsent();
-
- ConsentImageVO[] cImage = this.consentWebService.GetConsentImage(this.CurrentPreviewConsent.ConsentMstRid);
- if(cImage == null || cImage.Length == 0) {
- MessageBox.Show("검색된 이미지가 없습니다.", "경고", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
-
- CLIP.eForm.ImageView.ImageViewCtrl iViewer = consentMain.GetImageViewerCtrl();
- List<string> lStr = new List<string>();
- //string sPath = this.consentMain.PluginExecuteInfo["imageUploadPath"] + "/DataTempImage/";
- string sPath = consentMain.PluginExecuteInfo["baseConsentSvcURL"] + cImage[0].imagePath + "/";
- 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 + img.imageFilename, 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;
- }
- }
- }
- }
- // 이미지 생성이 완료되면 이미지를 보여준다
- iViewer.Show();
- iViewer.SetBase64Images(lStr);
- // if (lStr.Count > 0)
- iViewer.Show();
- iViewer.SetBase64Images(lStr);
- //} else {
- // // 검색된 이미지가 없습니다.
- //}
- }
- /// <summary>
- /// 이미지를 BASE64 로 인코딩
- /// </summary>
- /// <param name="image">변환할 이미지</param>
- /// <param name="format">저장할 이미지 포멧</param>
- /// <returns></returns>
- 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;
- }
- }
- /// <summary>
- /// 동의서 미리 보기
- /// </summary>
- /// <param name="consentMain">미리보기할 동의서가 있는 인스턴스</param>
- public void PreviewConsent(IConsentMain consentMain) {
- // 근무지기관별 공통파라미터를 설정
- Dictionary<FOSParameter, string> globalParams = Common.CreateGlobalParamsDictionary(consentMain.ConsentExecuteInfo["dutinstcd"]);
- if (SetPatientAndUser(globalParams) < 0) {
- return;
- }
- globalParams[FOSParameter.LIST_OCRCODE] = CurrentPreviewConsent.Ocrcode = GetOcrCode(); // OCR 코드
- globalParams[FOSParameter.GLOBAL_MAIN_DR1_NM] = CurrentTargetPatient.mainDrNm; // maindrname
- //globalParams[FOSParameter.Device] = "PC";
- //globalParams[FOSParameter.PrintTime] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- //globalParams[FOSParameter.SignTime] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- globalParams[FOSParameter.GLOBAL_USER_IP] = consentMain.ConsentExecuteInfo["printIP"];
- List<Common.FormObject> forms = new List<FormObject>();
- forms.Add(new FormObject { formId = CurrentPreviewConsent.FormRid ?? "-1", formNm = CurrentPreviewConsent.FormName, consentMstRid = CurrentPreviewConsent.ConsentMstRid ?? "-1" });
- string fosNew = Common.getNewFosString(consentMain.PluginExecuteInfo["formServiceUrl"], globalParams, null, new List<String> { CurrentPreviewConsent.FormRid });
- int state = this.consentWebService.CheckConsentState(int.Parse(CurrentPreviewConsent.ConsentMstRid), CurrentPreviewConsent.ConsentState);
- if (state == 1) {
- MessageBoxDlg.Show(this, "이미 저장된 서식 입니다."
- , string.Format(Properties.Resources.msg_caption_confirm),
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- consentMain.PreviewConsent(fosNew);
- //consentMain.PreviewConsent(fos);//서식을 열도록 fos을 던짐
- // dbs227, 대가대 병원 UserDrFlag 사용하지 않음
- // 외래 환자 외에는 작성 완료(확인) 버튼 안보이게 설정
- //if (CurrentTargetPatient.ordtype.Equals("O") && CurrentPreviewConsent.UserDrFlag.Equals("Y")) {
- // toolStripButtonCompleteSaveToServer.Visible = true;
- //} else {
- // toolStripButtonCompleteSaveToServer.Visible = false;
- //}
- consentMain.ConsentCommandCtrl.SetEnableConsentIssueCommands(true);
- consentMain.ConsentCommandCtrl.SetEnableButtonsByCurrentConsent();
- SetEnableByUserType();
- }
- /// <summary>
- /// 현재 동의서의 OCR 코드를 가져온다. OCR 코드가 존재하지 않으면 서버로부터 얻어온다
- /// </summary>
- /// <returns>OCR 코드</returns>
- public string GetOcrCode() {
- string strOcrCode = "";
- if (this.CurrentPreviewConsent != null
- && !string.IsNullOrEmpty(this.CurrentPreviewConsent.Ocrcode)) {
- strOcrCode = this.CurrentPreviewConsent.Ocrcode;
- }
- // OCR 코드가 없으면 서버로 부터 받아온다
- else {
- strOcrCode = hospitalWebService.GetOcrTag().responseData;
- }
- return strOcrCode;
- }
- /// <summary>
- /// changingGlobalParams Dataset 에 FOS 파라미터의 name 과 value 를 설정한다
- /// </summary>
- /// <param name="globalParams"></param>
- public int SetPatientAndUser(Dictionary<FOSParameter, string> globalParams) {
- int retValue = 0;
- Dictionary<FOSParameter, string> changingGlobalParams = new Dictionary<FOSParameter, string>();
- if (CurrentPreviewConsent == null) {
- MessageBox.Show("동의서 정보가 없습니다.");
- //return -1;
- throw new Exception("동의서 정보가 없습니다.");
- retValue = -1;
- }
- if (CurrentTargetPatient == null || string.IsNullOrEmpty(this.CurrentTargetPatient.pid)) {
- MessageBox.Show("환자 정보가 없습니다.");
- //return -1;
- throw new Exception("환자 정보가 없습니다.");
- retValue = -1;
- }
- if (CurrentEndUser == null) {
- MessageBox.Show("사용자 정보가 없습니다.");
- //return -1;
- throw new Exception("사용자 정보가 없습니다.");
- retValue = -1;
- }
- // 동의서 정보
- changingGlobalParams[FOSParameter.LIST_FORM_NM] = this.CurrentPreviewConsent.FormPrintName;
- // 환자 정보
- //changingGlobalParams[FOSParameter.ImageUploadPath] = this.consentMain.PluginExecuteInfo["imageUploadPath"] + "/";
- changingGlobalParams[FOSParameter.GLOBAL_USER_NM] = this.currentEndUser.userName;
- changingGlobalParams[FOSParameter.GLOBAL_PATIENT_ID] = this.CurrentTargetPatient.pid;
- changingGlobalParams[FOSParameter.GLOBAL_PATIENT_ORDTYPE] = this.CurrentTargetPatient.ordtypeHngnm;
- changingGlobalParams[FOSParameter.GLOBAL_PATIENT_SEXAGE] = this.CurrentTargetPatient.sa;
- changingGlobalParams[FOSParameter.GLOBAL_PATIENT_NM] = this.CurrentTargetPatient.name;
- changingGlobalParams[FOSParameter.GLOBAL_IS_PRINT_MODE] = "N";
- changingGlobalParams[FOSParameter.GLOBAL_PATIENT_RRN] = this.CurrentTargetPatient.jumin;
- changingGlobalParams[FOSParameter.GLOBAL_PATIENT_ROOM_NO] = this.CurrentTargetPatient.ward;
- changingGlobalParams[FOSParameter.GLOBAL_PATIENT_ROOM_NO] = this.CurrentTargetPatient.roomno;
- //changingGlobalParams[FOSParameter.GLOBAL_PATIENT_CLN_DATE] = SetDateFormatting(this.CurrentTargetPatient.clnDate.Replace("-", "").Replace("/", ""));
- changingGlobalParams[FOSParameter.GLOBAL_PATIENT_CLN_DATE] = this.CurrentTargetPatient.clnDate.Replace("-", "").Replace("/", "");
- changingGlobalParams[FOSParameter.GLOBAL_PATIENT_CLN_DEPT_NM] = this.CurrentTargetPatient.clnDeptName;
- //changingGlobalParams[FOSParameter.MainDoctor] = this.CurrentTargetPatient.MainDrNm;
- changingGlobalParams[FOSParameter.GLOBAL_PATIENT_ADDRESS] = this.CurrentTargetPatient.addr;
- changingGlobalParams[FOSParameter.GLOBAL_PATIENT_MPPHONENO] = this.CurrentTargetPatient.telno;
- //changingGlobalParams[FOSParameter.GLOBAL_PATIENT_TEL_NO] = this.CurrentTargetPatient.telno;
- //changingGlobalParams[FOSParameter.patient] = this.CurrentTargetPatient.Insukind; // 확인 필요
- changingGlobalParams[FOSParameter.GLOBAL_PATIENT_CLN_DEPT_CD] = this.CurrentTargetPatient.clnDeptEngNm;
- changingGlobalParams[FOSParameter.GLOBAL_DIAG_HNGNM] = this.CurrentTargetPatient.OpDiagName;
- changingGlobalParams[FOSParameter.GLOBAL_OP_RSRV_NO] = this.CurrentTargetPatient.OpRsrvNo;
- changingGlobalParams[FOSParameter.GLOBAL_OPNM] = this.CurrentTargetPatient.OpName;
- changingGlobalParams[FOSParameter.GLOBAL_OPREMFACT] = this.CurrentTargetPatient.OpremFact;
- // 환자의 생년월일 입력, DB 에서 가져올 때 어떤 값을 가져오는 지
- if (!string.IsNullOrEmpty(this.CurrentTargetPatient.jumin) && this.CurrentTargetPatient.jumin.Length > 6) {
- // 주석 처리 yyyy-MM-dd
- string parBirthDd = this.CurrentTargetPatient.birthDd ?? string.Empty;
- if (!string.IsNullOrEmpty(parBirthDd)) {
- parBirthDd = DateTime.ParseExact(parBirthDd, "yyyyMMdd", null).ToString("yyyy-MM-dd");
- }
- changingGlobalParams[FOSParameter.GLOBAL_PATIENT_BIRTHDAY] = parBirthDd;
- //changingGlobalParams[FOSParameter.GLOBAL_PATIENT_BIRTHDAY] = this.CurrentTargetPatient.jumin.Substring(0, 6);
- }
- //if (string.IsNullOrEmpty(changingGlobalParams[FOSParameter.DiagName])) {
- // if (!string.IsNullOrEmpty(consentMain.ConsentExecuteInfo["clnDxNm"])) {
- // changingGlobalParams[FOSParameter.DiagName] = consentMain.ConsentExecuteInfo["clnDxNm"];
- // }
- //}
- // 대구가톨릭대학교병원 요청사항
- // 사용자가 입력한 진단명 수술명을 서식에 파라미터 필드로 전달한다
- if (string.IsNullOrEmpty(changingGlobalParams[FOSParameter.GLOBAL_DIAG_HNGNM])) {
- changingGlobalParams[FOSParameter.GLOBAL_DIAG_HNGNM] = this.CurrentTargetPatient.clnDxNm;/*사용자가 입력한 진단명*/
- }
- if (string.IsNullOrEmpty(changingGlobalParams[FOSParameter.GLOBAL_OPNM])) {
- changingGlobalParams[FOSParameter.GLOBAL_OPNM] = this.CurrentTargetPatient.OpName;/*사용자가 입력한 수술명*/
- }
- changingGlobalParams[FOSParameter.GLOBAL_OPREMFACT] = this.CurrentTargetPatient.OpremFact;/*사용자가 입력한 진단명*/
- // 설명일 (수술 확정일)
- changingGlobalParams[FOSParameter.GLOBAL_OPCNFMDD] = this.CurrentTargetPatient.OpCnfmDate;
- //consentMain.SetConsentUserInfo(consentMain.ConsentExecuteInfo["dutinstcd"], id, deptCd);
- // 외래일 경우 emr.mmbdhrcd.hardcdno = 6920 에 지정된 서식외에는 사용자를 진료의로 변경한다.
- if (CurrentTargetPatient.ordtype.Equals("O")) {
- //consentMain.SetConsentUserInfo(consentMain.ConsentExecuteInfo["dutinstcd"]
- // , CurrentTargetPatient.mainDrId
- // , currentTargetPatient.clnDeptCode); // 외래 진료의는 근무 부서 이외의 과의 처방을 낼 수 없다.
- } else if (!CurrentEndUser.userId.Equals(consentMain.ConsentExecuteInfo["loginUserId"])) {
- // // 로그인 사용자와 다른 경우 재조회
- // consentMain.SetConsentUserInfo(consentMain.ConsentExecuteInfo["dutinstcd"]
- // , consentMain.ConsentExecuteInfo["loginUserId"]
- // , consentMain.ConsentExecuteInfo["userDeptCd"]);
- }
- string jobKindCd = !string.IsNullOrEmpty(currentEndUser.jobkindcd) ? currentEndUser.jobkindcd.Substring(0, 2) : "00";
- // 설명의사
- // 로그인 한 사용자가 의사직종이라면 설명의사로 매핑한다.
- var explDocId = "";
- var explDocNm = "";
- if (currentEndUser.jobkindcd.Substring(0, 2).Equals("03") || currentEndUser.jobkindcd.Substring(0, 2).Equals("06")) {
- explDocId = CurrentEndUser.userId;
- explDocNm = CurrentEndUser.userName;
- }
- //else if (CurrentTargetPatient.ordtype.Equals("O")) {
- // explDocId = CurrentTargetPatient.mainDrId;
- // explDocNm = CurrentTargetPatient.mainDrNm;
- //}
- // 사용자의 서명 이미지를 가져온다
- UserSignImageVO vo = this.hospitalWebService.GetSignImage(explDocId, this.consentMain.ConsentExecuteInfo["dutinstcd"]);
- // 설명의사 파라미터 매핑
- if (!string.IsNullOrEmpty(explDocNm)) {
- changingGlobalParams[FOSParameter.GLOBAL_EXPL_DR_NM] = explDocNm;
- }
- // 설명의사 서명
- if (vo != null && vo.SignImage.Length > 0) {
- // 서명 이미지를 BASE64 형식으로 변환한다.
- changingGlobalParams[FOSParameter.GLOBAL_EXPL_DR_SIGN_DATA] = ImageToBase64(byteArrayToImage(vo.SignImage), System.Drawing.Imaging.ImageFormat.Png);
- }
- // 출력할 경우 나타낼 필요가 없는 파라미터는 처리
- if (consentMain.ConsentExecuteInfo["printYN"].Equals("Y")) {
-
- }
- // 따로 매핑하지 않음
- // 원무 파라미터 설정
- //changingGlobalParams[FOSParameter.SpecDoctorYN] = consentMain.ConsentExecuteInfo["SpecDoctorYN"];
- //changingGlobalParams[FOSParameter.ContStartDate] = consentMain.ConsentExecuteInfo["ContStartDate"];
- //changingGlobalParams[FOSParameter.ContEndDate] = consentMain.ConsentExecuteInfo["ContEndDate"];
- //changingGlobalParams[FOSParameter.RoomCapa] = consentMain.ConsentExecuteInfo["RoomCapa"];
- //changingGlobalParams[FOSParameter.ContTelNo] = consentMain.ConsentExecuteInfo["ContTelNo"];
- //changingGlobalParams[FOSParameter.ContStaff1Name] = consentMain.ConsentExecuteInfo["ContStaff1Name"];
- //changingGlobalParams[FOSParameter.ContStaff2Name] = consentMain.ConsentExecuteInfo["ContStaff2Name"];
- //changingGlobalParams[FOSParameter.ContStaff3Name] = consentMain.ConsentExecuteInfo["ContStaff3Name"];
- //changingGlobalParams[FOSParameter.CardNo] = consentMain.ConsentExecuteInfo["CardNo"];
- ChangeGlobalParametersToNew(globalParams, changingGlobalParams);
- return 0;
- }
- /// <summary>
- /// 임시저장 동의서를 보여준다
- /// </summary>
- /// <param name="consentMain"></param>
- public void ShowTempSaveConsent(IConsentMain consentMain) {
- if (string.IsNullOrEmpty(this.CurrentPreviewConsent.ConsentMstRid)
- || this.CurrentPreviewConsent.ConsentMstRid.Equals("-1")) {
- return;
- }
- List<string> formGuids = new List<string>();
- formGuids.Add(this.CurrentPreviewConsent.FormGuid);
- Dictionary<string, string> actionParams = new Dictionary<string, string> {
- { "rid", this.CurrentPreviewConsent.ConsentMstRid }//선택한 리스트의 rid, state
- };
- Dictionary<FOSParameter, string> globalParams = new Dictionary<FOSParameter, string>();
- if (!string.IsNullOrEmpty(this.CurrentPreviewConsent.VisitType)) {
- if (!this.CurrentPreviewConsent.VisitType.Equals("O")) {
- // 빌드를 위한 주석 처리
- //globalParams[FOSParameter.userName] = consentMain.ConsentExecuteInfo["loginUserName"];
- }
- }
- if (!CurrentEndUser.drkind.Equals("C")) {
- globalParams[FOSParameter.GLOBAL_EXPL_DR_NM] = CurrentEndUser.userName;
- // 사용자의 서명 이미지를 가져온다
- UserSignImageVO vo = this.hospitalWebService.GetSignImage(CurrentEndUser.userId, this.consentMain.ConsentExecuteInfo["dutinstcd"]);
- // 설명의사 서명
- if (vo != null && vo.SignImage.Length > 0) {
- // 서명 이미지를 BASE64 형식으로 변환한다.
- globalParams[FOSParameter.GLOBAL_EXPL_DR_SIGN_DATA] = ImageToBase64(byteArrayToImage(vo.SignImage), System.Drawing.Imaging.ImageFormat.Png);
- }
- }
- globalParams[FOSParameter.GLOBAL_MAIN_DR1_NM] = CurrentTargetPatient.mainDrNm;
- string newFos = Common.getNewEptFosString(consentMain.PluginExecuteInfo["formServiceUrl"],
- consentMain.PluginExecuteInfo["baseConsentSvcURL"],
- globalParams,
- new List<String> { CurrentPreviewConsent.FormRid },
- new List<String> { CurrentPreviewConsent.ConsentMstRid });
- //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(newFos);
- // 외래 환자 외에는 작성 완료(확인) 버튼 안보이게 설정
- if (!CurrentTargetPatient.ordtype.Equals("O")) {
- toolStripButtonCompleteSaveToServer.Visible = false;
- } else {
- toolStripButtonCompleteSaveToServer.Visible = true;
- }
- 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;
- }
- /// <summary>
- /// 동의서 임시 데이터 저장
- /// </summary>
- /// <param name="eptXmlValue"></param>
- /// <param name="dataValue"></param>
- public override void SaveTempConsentData(string eptXmlValue, string dataValue, bool isTempSave2) {
- // 임시 저장 된 서식을 다시 임시 저장
- //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.userId;
- string userName = CurrentEndUser.userName;
- string pid = CurrentTargetPatient.pid;
- string clnDeptCode = CurrentTargetPatient.clnDeptCode;
- string vistType = CurrentTargetPatient.ordtype;
- 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.TryParse(CurrentTargetPatient.cretno, out int cretno);
- ConvertStringToInt(formRid, consentMstRid, out int formRidInt, out int consentMstRidInt);
- string deviceIdentNo = Common.getMacAddress();
- var consentState = "TEMP";
- int translateResult = 0;
- string sizeValue = string.Empty;
- string strImgJson = string.Empty;
- if (isTempSave2) {
- // 확인저장 시 이미지 파일을 서버로 전송
- translateResult = TranslateConsentToImageServer(exportedImageFiles, ""/* 확인저장 시 인증저장 정보는 없다*/, out string fileSizes);
- sizeValue = fileSizes;
- consentState = "ELECTR_CMP";
- strImgJson = this.exportedImageFilesJson;
- }
- Cursor currentCursor = this.Cursor;
- try {
- this.Cursor = Cursors.WaitCursor;
- // 임시저장 일때 actkind 는 "T" 로 설정하여 전송한다
- ConsentSvcRef.SingleReturnData result = this.consentWebService.SaveTempData(userId
- , CurrentEndUser.deptcd
- , pid
- , formRid
- , formCd
- , clnDeptCode
- , eptXmlValue
- , dataValue
- , consentMstRidInt
- , rewriteConsentMstRid
- , "PC"
- , deviceIdentNo
- , vistType
- , consentMain.ConsentExecuteInfo["dutinstcd"]
- , clnDate
- , CurrentTargetPatient.Dschdd
- , ward
- , roomcd
- , ocrCode
- , cretno
- , mainDrId
- , consentMain.GetTotalPageCount().ToString()
- , "T"
- , CurrentTargetPatient.OpRsrvNo
- , consentState
- , orderNo
- , orderName
- , orderCode
- , "" // audioFileJson
- , "" // audioFileSize
- , strImgJson // imageFileJson
- , sizeValue // fileSize(Image)
- );
- if (result != null && !string.IsNullOrEmpty(result.responseData)) {
- consentMstRid = result.responseData;
- } else {
- MessageBox.Show("임시저장에 실패하였습니다.");
- }
- // 기왕력 데이터 저장
- // 대가대 병원 사용하지 않음
- //SetNewMedicalHistory(dataValue);
- // 작성 완료 시
- if (m_IsComplete) {
- //MessageBoxDlg.Show(this, string.Format(Properties.Resources.msg_confirm_save_confirm)
- // , string.Format(Properties.Resources.msg_caption_confirm),
- // MessageBoxButtons.OK, MessageBoxIcon.Information);
- // 작성 완료 시는 이력 탭 보기
- this.consentMain.ConsentListCtrl.InquiryConsentData(0);
- } else {
- this.consentMain.ConsentListCtrl.InquiryConsentData(consentMstRidInt);
- // Ku2.0 연동 시에는 메시지를 띄우지 않는다
- if (consentMain.ConsentExecuteInfo["printYN"].Equals("Y")) {
- MessageBoxDlg.Show(this, string.Format(Properties.Resources.msg_temp_save_confirm)
- , string.Format(Properties.Resources.msg_caption_confirm),
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- } catch (Exception ex) {
- throw ex;
- } finally {
- this.Cursor = currentCursor;
- }
- }
- /// <summary>
- /// 현재의 문진기록을 저장한다
- /// </summary>
- /// <param name="dataXml">The data XML.</param>
- private void SetNewMedicalHistory(string dataXml) {
- Dictionary<FOSParameter, string> outputDataDic = DataXmlToDictionary(dataXml);
- // 대가대 사용하지 않는 필드
- //if (outputDataDic.ContainsKey(FOSParameter.BP)) this.CurrentTargetPatient.Ex_bp = outputDataDic[FOSParameter.BP];
- //if (outputDataDic.ContainsKey(FOSParameter.DM)) this.CurrentTargetPatient.Ex_dm = outputDataDic[FOSParameter.DM];
- //if (outputDataDic.ContainsKey(FOSParameter.Heart)) this.CurrentTargetPatient.Ex_heart = outputDataDic[FOSParameter.Heart];
- //if (outputDataDic.ContainsKey(FOSParameter.Kidney)) this.CurrentTargetPatient.Ex_kidney = outputDataDic[FOSParameter.Kidney];
- //if (outputDataDic.ContainsKey(FOSParameter.Respiration)) this.CurrentTargetPatient.Ex_respiration = outputDataDic[FOSParameter.Respiration];
- //if (outputDataDic.ContainsKey(FOSParameter.MedicalHistory)) this.CurrentTargetPatient.Ex_hx = outputDataDic[FOSParameter.MedicalHistory];
- //if (outputDataDic.ContainsKey(FOSParameter.Allergy)) this.CurrentTargetPatient.Ex_allergy = outputDataDic[FOSParameter.Allergy];
- //if (outputDataDic.ContainsKey(FOSParameter.Drug)) this.CurrentTargetPatient.Ex_drug = outputDataDic[FOSParameter.Drug];
- //if (outputDataDic.ContainsKey(FOSParameter.Smoking)) this.CurrentTargetPatient.Ex_smoking = outputDataDic[FOSParameter.Smoking];
- //if (outputDataDic.ContainsKey(FOSParameter.Idiosyncrasy)) this.CurrentTargetPatient.Ex_idio = outputDataDic[FOSParameter.Idiosyncrasy];
- //if (outputDataDic.ContainsKey(FOSParameter.Nacrotics)) this.CurrentTargetPatient.Ex_nacrotics = outputDataDic[FOSParameter.Nacrotics];
- //if (outputDataDic.ContainsKey(FOSParameter.Airway)) this.CurrentTargetPatient.Ex_airway = outputDataDic[FOSParameter.Airway];
- //if (outputDataDic.ContainsKey(FOSParameter.Hemorrhage)) this.CurrentTargetPatient.Ex_hemorrhage = outputDataDic[FOSParameter.Hemorrhage];
- //if (outputDataDic.ContainsKey(FOSParameter.EtcStatus)) this.CurrentTargetPatient.Ex_status_etc = outputDataDic[FOSParameter.EtcStatus];
- }
- /// <summary>
- /// Data XML을 Dictionary 타입으로 변환하여 반환
- /// </summary>
- /// <param name="dataXml">변환될 Data XML</param>
- /// <returns></returns>
- private static Dictionary<FOSParameter, string> DataXmlToDictionary(string dataXml) {
- Dictionary<FOSParameter, string> outputDataDic;
- XmlDocument xmlDocument = new XmlDocument();
- xmlDocument.LoadXml(dataXml);
- outputDataDic = outputDataDic = new Dictionary<FOSParameter, string>();
- 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) {
- XmlElement outFieldElement2 = childNode2 as XmlElement;
- FOSParameter fieldName2 = (FOSParameter) Enum.Parse(typeof(FOSParameter), outFieldElement2.Name);
- string fieldValue2 = string.Empty;
- 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;
- }
- /// <summary>
- /// 동의서 완료 데이터 저장
- /// </summary>
- /// <param name="eptXmlValue"></param>
- /// <param name="dataValue"></param>
- public override bool SaveCompleteConsentData(string eptXmlValue, string dataValue, out object saveResult) {
- int translateResult = -1;
- string sCertTarget = string.Empty;
- string sCertResult = string.Empty;
- string consentState = "CERTIFY_CMP";
- string sizeValue = string.Empty;
- try {
- // 인증저장된 이미지 파일을 서버로 전송
- translateResult = TranslateConsentToImageServer(exportedImageFiles, sCertResult, out string fileSizes);
- sizeValue = fileSizes;
- } 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;
- }
- //consentState = "CERTIFY_CMP";
- SignatureConfig sign = new SignatureConfig();
- try {
- string certPass = this.CurrentPreviewConsent.certPass;
- if (certPass.Equals("N")) {
- // 공인인증 처리용
- sCertTarget = sign.getSHA256ImageHash(exportedImageFiles, string.Empty);
- // 공인인증 처리
- sCertResult = ConsentImageSignature(sCertTarget, CurrentEndUser.userId, CurrentEndUser.userName);
- //sCertResult = "TEST";
- 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.userId;
- string userDeptcd = CurrentEndUser.deptcd;
- string hosType = consentMain.ConsentExecuteInfo["dutinstcd"];
- string userName = CurrentEndUser.userName;
- string pid = CurrentTargetPatient.pid;
- string patientClnDeptCd = CurrentTargetPatient.clnDeptCode;
- string patientOrdtype = CurrentTargetPatient.ordtype;
-
- string clnDate = CurrentTargetPatient.clnDate.Replace("-", "").Replace("/", "");
- string ward = CurrentTargetPatient.ward;
- string roomcd = CurrentTargetPatient.roomno;
- string formId = CurrentPreviewConsent.FormRid;
- string formCd = CurrentPreviewConsent.FormCd;
- string consentMstRid = CurrentPreviewConsent.ConsentMstRid;
- int rewriteConsentMstRid = 0;
- int orderNo = CurrentTargetPatient.orderno;
- string orderCode = CurrentTargetPatient.clnDxCd;
- string orderName = CurrentTargetPatient.clnDxNm;
- string dschdd = CurrentTargetPatient.Dschdd;
- string mainDrId = this.CurrentTargetPatient.mainDrId;
- string actKind = (consentState.Equals("CERTIFY_CMP") ? "C" : "T");
- string ocrCode = CurrentPreviewConsent.Ocrcode;
- if (string.IsNullOrEmpty(ocrCode)) {
- ocrCode = CurrentPreviewConsent.Ocrcode = GetOcrCode();
- }
- int.TryParse(CurrentTargetPatient.cretno, out int cretno);
- ConvertStringToInt(formId, consentMstRid, out int formRidInt, out int consentMstRidInt);
- //string deviceIdentNo = System.Environment.MachineName;
- string macAddress = Common.getMacAddress();
- Cursor currentCursor = this.Cursor;
- var rid = Convert.ToInt32(CurrentPreviewConsent.ConsentMstRid);
- if (rid < 1) {
- rid = -1;
- } else {
- rewriteConsentMstRid = rid;
- }
- try {
- this.Cursor = Cursors.WaitCursor;
- // TODO
- ConsentSvcRef.SingleReturnData resultData = this.consentWebService.SaveCompleteAll(userId,
- userDeptcd,
- pid,
- formId,
- formCd,
- patientClnDeptCd,
- eptXmlValue,
- dataValue,
- rid,
- rewriteConsentMstRid,
- "PC",
- macAddress,
- patientOrdtype,
- consentMain.ConsentExecuteInfo["dutinstcd"],
- clnDate,
- dschdd,
- ward,
- roomcd,
- ocrCode,
- cretno,
- mainDrId,
- consentMain.GetTotalPageCount().ToString(),
- actKind,
- CurrentTargetPatient.OpRsrvNo,
- consentState,
- orderNo,
- orderName,
- orderCode,
- exportedImageFilesJson,
- sizeValue,
- sCertResult,
- sCertTarget,
- "",
- "");
- // 인증 저장 후에는 이력 탭 설정
- this.consentMain.ConsentListCtrl.InquiryConsentData(0);
- // 인증저장 이후 PC 클라이언트를 종료하지 않는다.
- // 확인 저장 시 닫기 버튼 활성화 하지 않는다.
- //if (!consentState.Equals("ELECTR_CMP")) {
- // DialogResult dialogResult = MessageBoxDlg.Show(this, string.Format(Properties.Resources.msg_esign_N_comp_save_confirm)
- // , string.Format(Properties.Resources.msg_caption_confirm),
- // MessageBoxButtons.YesNo, MessageBoxIcon.Information);
- // if (dialogResult == DialogResult.Yes) {
- // this.consentMain.Parent_Disposed();
- // }
- //}
- this.consentMain.ReInitializeViewer();
- } catch (Exception ex) {
- throw ex;
- } finally {
- this.Cursor = currentCursor;
- 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;
- }
- }
- saveResult = 1;
- return true;
- }
- /// <summary>
- /// 전자서명을 한다
- /// </summary>
- /// <param name="sCertTarget">전자서명 대상</param>
- /// <param name="userId">사용자ID</param>
- /// <param name="userName">사용자 이름</param>
- /// <returns>전자서명의 결과값</returns>
- 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;
- }
- /// <summary>
- /// 서버로 이미지 파일 전송
- /// </summary>
- /// <param name="exportedImageFiles">전송할 이미지 파일</param>
- /// <param name="sCertResult">공인인증 결과</param>
- /// <returns></returns>
- private int TranslateConsentToImageServer(string exportedImageFiles, string sCertResult, out string fileSizes) {
- int resultValue = -1;
- fileSizes = string.Empty;
- if (!string.IsNullOrEmpty(exportedImageFilesJson) && !string.IsNullOrEmpty(exportedImageFiles)) {
- Dictionary<string, object> jsonRoot = null;
- try {
- jsonRoot = fastJSON.JSON.Parse(exportedImageFilesJson) as Dictionary<string, object>;
- if (jsonRoot != null && jsonRoot.Count > 0) {
- string sPath = string.Empty;
- string sFileName = string.Empty;
- string[] sFullPath = exportedImageFiles.Split('^');
- int k = 0;
- foreach (KeyValuePair<string, object> 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;
- if(k != 0) {
- fileSizes += ",";
- }
- var fileInfo = new FileInfo(sFullPath[k]);
- if(fileInfo != null) {
- fileSizes += fileInfo.Length / 1024;
- }
- byte[] response = wcClient.UploadFile(imageUploadServerUrl, "POST", sFullPath[k++]);
- }
- }
- }
- } catch (Exception) {
- 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.userId);
- // //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.userId);
- // //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.userId, int.Parse(CurrentPreviewConsent.FormRid));
- // /*
- // //저장된 이미지에서 해쉬정보 추출
- // string sCertTarget = GetImageCertification(imgFile);
- // //해쉬정보 DB에 저장
- // this.consentWebService.SaveImageSignInfo("ELECTR_CMP", consentMstRidInt, consentImageRid,
- // CurrentEndUser.userId, 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.userId, sCertTarget, sCertResult);
- // }
- // resultValue = 1;
- // }
- // catch (Exception err)
- // {
- // resultValue = -99;
- // throw err;
- // }
- // }
- // }
- // return resultValue;
- //}
- /// <summary>
- /// 공인인증 이미지를 가져옴
- /// 사용되는 곳 없음
- /// </summary>
- /// <param name="exportedImageFile">The exported image file.</param>
- /// <returns></returns>
- 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;
- }
- /// <summary>
- /// 이미지 업로드시 사용될 exportedImageFilesJson 객체에 JSON 스타일로 값을 설정
- /// </summary>
- /// <param name="savedImageFileDescription">저장될 이미지 파일 설명</param>
- public override void WorkExtraWithSavedImageFiles(string savedImageFileDescription) {
- string[] aryImageInfo = savedImageFileDescription.Split(';');
- Dictionary<string, string> dicImageInfo = new Dictionary<string, string>();
- 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);
- }
- /// <summary>
- /// baseGlobalParams 의 딕셔너리 객체에 changingGlobalParams 의 딕셔너리 객체의 요소들을 변경함
- /// 기존 baseGlobalParams 딕셔너리에 key 가 없으면 추가되지 않음
- /// </summary>
- /// <param name="baseGlobalParams">복사될 딕셔너리 객체</param>
- /// <param name="changingGlobalParams">복사할 딕셔너리 객체</param>
- private void ChangeGlobalParametersToNew(Dictionary<FOSParameter, string> baseGlobalParams, Dictionary<FOSParameter, string> changingGlobalParams) {
- foreach (FOSParameter dicKey in changingGlobalParams.Keys) {
- if (baseGlobalParams.ContainsKey(dicKey)) {
- baseGlobalParams[dicKey] = changingGlobalParams[dicKey];
- }
- }
- }
- /// <summary>
- /// 사용자에 따른 버튼 활성화
- /// </summary>
- private void SetEnableByUserType() {
- // 기록 테이블의 출력 유무에 따른 서명버튼 활성화 처리
- SetSaveButtonDisabledWhenPrintYN();
- }
- /// <summary>
- /// 출력, 임시저장, 출력 버튼 활성화 여부 설정
- /// </summary>
- private void SetSaveButtonDisabledWhenPrintYN() {
- // 뷰어 모드 적용
- if (consentMain.ConsentExecuteInfo["readOnly"].Equals("Y")) {
- this.toolStripButtons.Enabled = false;
- return;
- }
- if (CurrentEndUser == null || CurrentPreviewConsent == null) {
- return;
- }
- string printOnly = CurrentPreviewConsent.PrintOnly ?? string.Empty;
- string consentState = CurrentPreviewConsent.ConsentState ?? string.Empty;
- // 출력만 가능하게 설정
- if (printOnly.Equals("Y")) {
- //this.toolStripButtonPrint.Enabled = true;
- this.toolStripButtonCompleteSaveToServer.Enabled = false;
- this.toolStripButtonSaveToServer.Enabled = false;
- this.toolStripButtonTempSaveToServer.Enabled = false;
- this.toolStripButtonExecute.Enabled = false;
- }
- // 출력 상태일 경우 재출력만 가능하도록 버튼 조정
- else if (consentState.ToUpper().Equals("PAPER_OUT")) {
- this.toolStripButtonExecute.Enabled = false;
- }
- // 작성 완료일 경우 임시 저장 불가
- else if (consentState.ToUpper().Equals("ELECTR_CMP")) {
- this.toolStripButtonTempSaveToServer.Enabled = false;
- }
- }
- /// <summary>
- /// 동의서 출력
- /// </summary>
- private void PrintConsent() {
- // 환자정보가 없을 경우 출력이 되지 않도록 적용
- if (this.CurrentTargetPatient == null || string.IsNullOrEmpty(this.CurrentTargetPatient.pid) || string.IsNullOrEmpty(this.CurrentTargetPatient.name)) {
- 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<PatListVO> volist = consentMain.PatientListCtrl.GetSelectedPatientList();
- // 1명 출력할 경우
- 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 {
- PrintConsentDocument();
- }
- // 환자 목록에서 여러명을 체크박스로 선택하여 출력할 경우
- } else if (volist.Count > 0) {
- 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();
- }
- }
- /// <summary>
- /// 미리보기 데이터를 출력하는 경우
- /// </summary>
- public void PrintConsentDocument() {
- Dictionary<string, Dictionary<FOSParameter, string>> formParamsList = new Dictionary<string, Dictionary<FOSParameter, string>>();
- string[] formGuidList = new string[this.CurrentPreviewConsent.PrntCnt];
- for (int i = 0; i < this.CurrentPreviewConsent.PrntCnt; i++) {
- Dictionary<FOSParameter, string> formParams = Common.CreateGlobalParamsDictionary(consentMain.ConsentExecuteInfo["dutinstcd"]);
- formGuidList[i] = this.CurrentPreviewConsent.FormGuid;
- if (SetPatientAndUser(formParams) < 0) {
- return;
- }
- //formParams[FOSParameter.OCRCode] = this.CurrentPreviewConsent.Ocrcode = GetOcrCode();
- if (i == 0) {
- formParams[FOSParameter.LIST_OCRCODE] = this.CurrentPreviewConsent.Ocrcode = GetOcrCode();
- } else {
- var ocrStr = consentWebService.getOcrString(this.CurrentPreviewConsent.FormCd,
- consentMain.ConsentExecuteInfo["dutinstcd"]);
- ocrStr = (ocrStr.Length < 0) ? "[환자 보관용]" : ocrStr;
- //formParams[FOSParameter.OCRCode] = "[환자 보관용]";
- formParams[FOSParameter.LIST_OCRCODE] = ocrStr;
- }
- //formParams[FOSParameter.Device] = "P";
- //formParams[FOSParameter.PrintTime] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- //formParams[FOSParameter.PrintIp] = consentMain.ConsentExecuteInfo["printIP"];
- //if (i == 1) formParams[FOSParameter.PrintComment] = Properties.Resources.msg_print_comment_2;
- //else if (i == 2) formParams[FOSParameter.PrintComment] = Properties.Resources.msg_print_comment_3;
- // dbs227, KNUH 프린터 출력 시 출력 일 시 제외
- //formParams[FOSParameter.PatientName] = string.Empty; // parCMDCHD_1PatientNm
- // 전자동의서 상 이름이 안아올 경우 파라미터 필드를 parCMDCHD_1PatientNmFix 로 변경
- // 단 파라미터 필드가 정의되어 있지 않는 경우 파라미터 필드를 추가하여 매핑
- //formParams[FOSParameter.ExplDrName] = string.Empty; // 설명의 이름 제거
- //formParams[FOSParameter.ExplDrTelNo] = string.Empty; // 설명의 전화번호 제거
- //formParams[FOSParameter.ExplDrSign] = string.Empty; // 설명의사 싸인 제거
- formParamsList.Add((i + 1).ToString(), formParams);
- }
- string fos = Common.GetMultiFosString(formGuidList
- , this.consentMain.PluginExecuteInfo["formServiceUrl"]
- , null
- , formParamsList
- , consentMain.ConsentExecuteInfo["dutinstcd"]);
- //PC클라이언트에서 프린트 출력을 눌렀을때 출력 데이타 입력 후 출력되게끔
- if (this.consentMain.getPrintButton()) {
- this.consentMain.setPageCnt(CurrentPreviewConsent.PrntCnt);
- SaveDataForPrintedConsent(String.Empty);
- }
- this.consentMain.PrintConsentDocument(fos);
- // 화면 상에 보이는 데로 출력을 원하면 아래 로직 적용
- //this.consentMain.PrintConsentDocument("");
- }
- //private int g_pageCnt = 0;
- /// <summary>
- /// 사용되지 않음
- /// </summary>
- public void PrintDirectConsentDocument() {
- if (this.currentPreviewConsent == null || this.CurrentTargetPatient == null || this.CurrentEndUser == null) {
- return;
- }
- //미리보기 데이터를 바로 출력하는 경우는 미작성상태인 경우로만 한다. (임시작성 이상의 경우는 바로 출력을 안하도록)
- if (!this.currentPreviewConsent.ConsentState.ToUpper().Equals("UNFINISHED")) {
- return;
- }
- int prntCnt = 0;
- prntCnt = this.CurrentPreviewConsent.PrntCnt;
- int prntMsgCnt = 0;
- if (!string.IsNullOrEmpty(this.consentMain.ConsentExecuteInfo["printList"])) {
- if (!consentMain.ConsentExecuteInfo["prntCnt"].Equals("-1")) {
- int.TryParse(this.consentMain.ConsentExecuteInfo["prntCnt"].ToString(), out prntCnt);
- prntMsgCnt++;
- }
- }
- Dictionary<string, Dictionary<FOSParameter, string>> formParamsList = new Dictionary<string, Dictionary<FOSParameter, string>>();
- string[] formGuidList = new string[prntCnt];
- string sOcrCd = string.Empty;
- for (int i = 0; i < prntCnt; i++) {
- Dictionary<FOSParameter, string> formParams = Common.CreateGlobalParamsDictionary(consentMain.ConsentExecuteInfo["dutinstcd"]);
- Dictionary<FOSParameter, string> changingFormParams = new Dictionary<FOSParameter, string>();
- SetPatientAndUser(formParams);
- // 빌드를 위한 주석 처리
- //changingFormParams[FOSParameter.Device] = "P";
- //changingFormParams[FOSParameter.PrintTime] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- //changingFormParams[FOSParameter.PrintIp] = consentMain.ConsentExecuteInfo["printIP"];
- //if (i == 0) {
- // changingFormParams[FOSParameter.OCRCode] = this.CurrentPreviewConsent.Ocrcode = GetOcrCode(); // OCR 코드
- // sOcrCd = this.CurrentPreviewConsent.Ocrcode;
- //} else {
- // changingFormParams[FOSParameter.OCRCode] = sOcrCd; //OCR코드
- //}
- //if (prntMsgCnt == 1) changingFormParams[FOSParameter.PrintComment] = Properties.Resources.msg_print_comment_2;
- //else if (prntMsgCnt == 2) changingFormParams[FOSParameter.PrintComment] = 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
- , consentMain.ConsentExecuteInfo["dutinstcd"]);
- this.consentMain.PrintDirect(fos);
- }
- /// <summary>
- /// 단일 서식 다중 환자 출력
- /// </summary>
- /// <param name="voList">환자 목록 리스트</param>
- private void MultiPrintConsentDocument(List<PatListVO> voList) {
- Dictionary<string, Dictionary<FOSParameter, string>> formParamsList = new Dictionary<string, Dictionary<FOSParameter, string>>();
- List<string> formGuids = new List<string>();
- int guidCnt = 0;
- 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 < voList.Count; i++) {
- sOcrCd = string.Empty;
- for (int j = 0; j < this.CurrentPreviewConsent.PrntCnt; j++) {
- PatientVO vo = GetPatientByPatList(voList[i]);
- Dictionary<FOSParameter, string> formParams = Common.CreateGlobalParamsDictionary(consentMain.ConsentExecuteInfo["dutinstcd"]);
- Dictionary<FOSParameter, string> changingFormParams = new Dictionary<FOSParameter, string>();
- // 빌드를 위한 주석 처리
- //changingFormParams[FOSParameter.ImageUploadPath] = this.consentMain.PluginExecuteInfo["imageUploadPath"] + "/";
- //changingFormParams[FOSParameter.Device] = "P";
- //changingFormParams[FOSParameter.PatientCode] = vo.IO_Pt_ID;
- //changingFormParams[FOSParameter.PatientSexAge] = vo.IO_sex_age_y_m;
- //changingFormParams[FOSParameter.PatientName] = vo.IO_Pt_Name;
- //changingFormParams[FOSParameter.PatientRRN] = vo.IO_JuminNo;
- //changingFormParams[FOSParameter.RoomNo] = vo.IO_Ward + "/" + vo.IO_RoomNo;
- //changingFormParams[FOSParameter.VisitDate] = SetDateFormatting(vo.IO_ADdate);
- //changingFormParams[FOSParameter.depthngnm] = vo.IO_DeptNm;
- //changingFormParams[FOSParameter.FormName] = this.CurrentPreviewConsent.FormPrintName;
- //changingFormParams[FOSParameter.MainDoctor] = vo.IO_MaindrNm;
- // dbs227 다중 출력 시 환자 이름을 추가하여 준다
- //changingFormParams[FOSParameter.PatientNameFix] = vo.IO_Pt_Name; // 빌드를 위한 주석 처리
- // 출력할 경우 설명 의사와 서명 이미지는 공백 처리
- //if (consentMain.ConsentExecuteInfo["printYN"].Equals("Y"))
- {
- //changingFormParams[FOSParameter.ExplDrName] = string.Empty;
- //changingFormParams[FOSParameter.ExplDrTelNo] = string.Empty;
- //changingFormParams[FOSParameter.ExplDrSign] = string.Empty;
- //changingFormParams[FOSParameter.PatientName] = string.Empty;
- //changingFormParams[FOSParameter.PatientBirthDay] = string.Empty;
- //changingFormParams[FOSParameter.PatientTelNo] = string.Empty; // parCMSGBD_PT_tel
- // 보호자상주확인서 프린터 출력시 제외 항목
- //changingGlobalParams[FOSParameter.userName] = string.Empty;
- //changingGlobalParams[FOSParameter.SignImage] = string.Empty;
- }
- if (j == 0) {
- changingFormParams[FOSParameter.LIST_OCRCODE] = sOcrCd = /*vo.IO_OcrCd =*/ hospitalWebService.GetOcrTag().responseData; //OCR코드
- //this.CurrentPreviewConsent.MultiOcrcode += vo.IO_OcrCd + "^";
- //this.CurrentPreviewConsent.MultiMainDrIdCd += vo.IO_MaindrId + "^";
- //sOcrCd = vo.IO_OcrCd;
- } else {
- changingFormParams[FOSParameter.LIST_OCRCODE] = sOcrCd; //OCR코드
- }
- //if (j == 1) changingFormParams[FOSParameter.PrintComment] = Properties.Resources.msg_print_comment_2;
- //else if (j == 2) changingFormParams[FOSParameter.PrintComment] = Properties.Resources.msg_print_comment_3;
- //changingFormParams[FOSParameter.PrintTime] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- //changingFormParams[FOSParameter.PrintIp] = consentMain.ConsentExecuteInfo["printIP"];
- 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
- , consentMain.ConsentExecuteInfo["dutinstcd"]);
- //PC클라이언트에서 프린트 출력을 눌렀을때 출력 데이타 입력 후 출력되게끔
- if (this.consentMain.getPrintButton()) {
- this.consentMain.setPageCnt(CurrentPreviewConsent.PrntCnt);
- SaveDataForPrintedConsent(String.Empty);
- }
- 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) {
- MessageBox.Show(value + " 항목이 누락되었습니다.", Properties.Resources.msg_caption_warn, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- /// <summary>
- /// toolStripButtonPen 체크박스 활성화 여부 체크 및 이미지 변경
- /// </summary>
- /// <param name="enabled">if set to <c>true</c> [enabled].</param>
- public override void onEnableDrawing(bool enabled) {
- this.toolStripButtonPen.Checked = enabled;
- if (this.toolStripButtonPen.Checked) this.toolStripButtonPen.Image = global::CLIP.eForm.Consent.UI.Properties.Resources.newDrawingClick;
- else this.toolStripButtonPen.Image = ((System.Drawing.Image) (resources.GetObject("toolStripButtonPen.Image")));
- }
- /// <summary>
- /// 첨지 삭제 버튼 클릭 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void toolStripButtonDeleteAttach_Click(object sender, EventArgs e) {
- this.consentMain.DeleteAttach();
- setViewerPageInit();
- }
- /// <summary>
- /// 첨지 추가 버튼 클릭 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void toolStripButtonInsertAttach_Click(object sender, EventArgs e) {
- this.consentMain.InsertAttach();
- setViewerPageInit();
- }
- /// <summary>
- /// 뷰어 페이지 초기화
- /// </summary>
- public override void setViewerPageInit() {
- this.toolStripLabelTotalPages.Text = this.consentMain.GetTotalPageCount().ToString();
- this.toolStripTextBoxPageIndex.Text = this.consentMain.GetCurrentPageIndex().ToString();
- }
- /// <summary>
- /// 환경설정 버튼 클릭 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void toolStripButtonConfig_Click(object sender, EventArgs e) {
- ShowConfigDialog();
- }
- /// <summary>
- /// 환경설정 다이얼로그를 불러온다
- /// </summary>
- private void ShowConfigDialog() {
- ConfigForm configForm = new ConfigForm(this.consentMain);
- 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;
- }
- }
- /// <summary>
- /// 환경설정 버튼 클릭 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void toolStripButtonConfig_Click_1(object sender, EventArgs e) {
- ShowConfigDialog();
- }
- private void ConsentCommandCtrl_Click(object sender, EventArgs e) {
- MessageBoxDlg.MessageBoxParent = this;
- }
- }
- }
|