1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187 |
- #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;
- using ConsentFormListVO = CLIP.eForm.Consent.UI.ConsentSvcRef.ConsentVO;
- using SingleReturnData = CLIP.eForm.Consent.UI.ConsentSvcRef.SingleReturnData;
- 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 reprintStatus {
- get {
- return base.reprintStatus;
- }
- set {
- base.reprintStatus = value;
- }
- }
- 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 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 setCompleteSaveButton(bool enabled) {
- this.toolStripButtonCompleteSaveToServer.Enabled = enabled;
- }
- protected override void OnLoad(EventArgs e) {
- base.OnLoad(e);
- if(this.DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime) {
- return;
- }
- if(!ConsentMainControl.HasVerticalMonitor) {
- this.toolStripButtonExecute.Visible = false;
- }
- else {
- this.toolStripButtonExecute.Visible = true;
- }
- this.consentMain = ConsentMainControl.GetConsentMainInterface(this);
- this.consentWebService = WebMethodCommon.GetConsentWebService(consentMain.PluginExecuteInfo["consentSvcUrl"]);
- this.hospitalWebService = WebMethodCommon.GetHospitalWebService(consentMain.PluginExecuteInfo["hospitalSvcUrl"]);
- InitZoomRateDropdownItems();
- this.consentMain.OnLoadPartControls += ConsentMain_OnLoadPartControls;
- this.toolStripButtons.MouseEnter += ToolStripButtons_MouseEnter;
- }
- private void ConsentMain_OnLoadPartControls(object sender, EventArgs e) {
- this.consentMain.OnVisibleEFormControl += ConsentMain_OnVisibleEFormControl;
- this.consentMain.OnInvisibleEFormControl += ConsentMain_OnInvisibleEFormControl;
- }
- private void ConsentMain_OnInvisibleEFormControl(object sender, EventArgs e) {
- this.consentMain.ConsentCommandCtrl.Enabled = false;
- }
- private void ConsentMain_OnVisibleEFormControl(object sender, EventArgs e) {
- this.consentMain.ConsentCommandCtrl.Enabled = true;
- }
- private void InitZoomRateDropdownItems() {
- // 콤보 박스에 저장되는 형식을 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);
- }
- }
- private void setCurrentPreviewConsent(ConsentFormListVO vo, int orderNo, string inputId, string inputNm) {
- // 현재 preview 할동의서 정보 설정
- CurrentPreviewConsent = new PreviewConsent {
- formId = vo.formId.ToString(),
- formCd = vo.formCd.ToString(),
- formName = vo.formName,
- formPrintName = vo.formPrintName,
- prntCnt = vo.prntCnt,
- consentMstRid = "-1",
- consentState = string.Empty,
- orderNo = orderNo,
- inputId = inputId,
- inputNm = inputNm,
- ReissueConsentMstRid = 0,
- RewriteConsentMstRid = 0,
- ordType = CurrentTargetPatient.VisitType,
- ocrtagPrntyn = vo.ocrTagYN,
- userDrFlag = vo.userDrFlag,
- printOnly = vo.prntOnly,
- opDiagName = vo.opDiagName,
- drOnly = vo.DrOnly,
- opName = vo.opName
- };
- Dictionary<FOSParameter, string> globalParams = Common.CreateGlobalParamsDictionary(consentMain.ConsentExecuteInfo["dutinstcd"]);
- List<string> formGuids = new List<string> {};
- SetPatientAndUser(globalParams);
- globalParams[FOSParameter.OCRCode] = string.Empty;
- var ocrBuf = GetOcrCode();
- if(string.IsNullOrEmpty(ocrBuf)) {
- MessageBox.Show("OCR 중복입니다. 다시 환자를 선택하여 주세요.");
- return;
- }
- int cnt = hospitalWebService.checkOcrDup(consentMain.ConsentExecuteInfo["dutinstcd"], ocrBuf);
- if(cnt > 0) {
- MessageBox.Show("OCRTAG 중복 발생입니다. 환자를 다시 선택하여 주십시요.");
- consentMain.ClearPreviewConsent(true);
- return;
- }
- globalParams[FOSParameter.OCRCode] = CurrentPreviewConsent.ocrCode = ocrBuf;
- globalParams[FOSParameter.Device] = "P";
- 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.PrintIp] = consentMain.ConsentExecuteInfo["printIP"];
- if(string.IsNullOrEmpty(CurrentPreviewConsent.ocrCode)) {
- MessageBox.Show("OCRTAG 생성 오류. 전산실에 문의 하세요.");
- consentMain.ClearPreviewConsent(true);
- return;
- }
- string fos = Common.GetFosString(formGuids
- , consentMain.PluginExecuteInfo["formServiceUrl"]
- , globalParams
- , null
- , consentMain.ConsentExecuteInfo["dutinstcd"]);
- SetEnableButtonsByCurrentConsent();
- consentMain.PreviewConsent(fos);
- }
- /// <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;
- }
- int cnt = hospitalWebService.checkOcrDup(consentMain.ConsentExecuteInfo["dutinstcd"], CurrentPreviewConsent.ocrCode);
- if(cnt > 0) {
- MessageBox.Show("OCRTAG 중복 발생입니다. 환자를 다시 선택하여 주십시요.");
- consentMain.ClearPreviewConsent(true);
- return;
- }
- // 경북대학교병원 요청사항 출력 제어
- string printControlMsg = string.Empty;
- string printOnly = string.Empty;
- printOnly = hospitalWebService.getPrintOnly(consentMain.ConsentExecuteInfo["dutinstcd"], CurrentPreviewConsent.formCd);
- printControlMsg = hospitalWebService.getPrintControlMsg(consentMain.ConsentExecuteInfo["dutinstcd"], CurrentTargetPatient.VisitType.ToUpper());
- // 6961 [전자동의서]출력시 특정 진찰료 면제사유시 제어 switch
- var runCount = hospitalWebService.checkHardcd(consentMain.ConsentExecuteInfo["dutinstcd"], "6961", "Y");
- var runCount2 = hospitalWebService.checkHardcd(consentMain.ConsentExecuteInfo["dutinstcd"], "6952", CurrentPreviewConsent.formCd);
- // 출력 전용 서식이 아닐 경우 출력 제한을 한다.
- if(!string.IsNullOrEmpty(printOnly) && printOnly.Equals("N")) {
- if(!string.IsNullOrEmpty(printControlMsg) && runCount2 < 1) {
- MessageBox.Show(printControlMsg);
- return;
- }
- }
- var count = hospitalWebService.checkPrintablePatient(consentMain.ConsentExecuteInfo["dutinstcd"],
- consentMain.ConsentExecuteInfo["patientNo"],
- consentMain.ConsentExecuteInfo["clnDate"],
- consentMain.ConsentExecuteInfo["cretno"]);
- // 6961 [전자동의서]출력시 특정 진찰료 면제사유시 제어 switch
- //var runCount = hospitalWebService.checkHardcd(consentMain.ConsentExecuteInfo["dutinstcd"], "6961", "Y");
- //var runCount2 = hospitalWebService.checkHardcd(consentMain.ConsentExecuteInfo["dutinstcd"], "6952", CurrentPreviewConsent.FormCd);
- // 해당 기준자료가 설정 되었다면 아래기능 호출
- if(runCount > 0) {
- if(count > 0) {
- MessageBox.Show("출력할 수 없는 수진이력입니다.\n(문의: 의무기록팀)", "확인", MessageBoxButtons.OK);
- return;
- }
- }
- if(CurrentPreviewConsent.consentState.ToUpper().Equals("UNFINISHED") || CurrentPreviewConsent.consentState.ToUpper().Equals("TEMP")) {
- MessageBox.Show(string.Format(Properties.Resources.msg_cannot_print_temp_doc)
- , string.Format(Properties.Resources.title_info),
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- this.consentMain.setPrintButton(true);
- // 진정동의서 출력 서식 확인
- int result = this.consentWebService.checkJinJeongDocument(consentMain.ConsentExecuteInfo["dutinstcd"], currentPreviewConsent.formCd);
- if(result > 0) {
- // 진정동의서를 출력 해야 한다.
- this.CurrentPreviewConsent.linkFormCd = "1100010977";
- }
- // 연계 서식이 없다면 기존 출력 루틴으로 출력
- if(/*this.CurrentPreviewConsent.linkFormCd == null || */string.IsNullOrEmpty(this.CurrentPreviewConsent.linkFormCd)) {
- PrintConsent();
- if (consentMain.multiParams == null)
- {
- consentMain.ClearPreviewConsent(true);
- }
- else
- {
- consentMain.showNextPreview();
- }
- }
- // 연계 서식이 있다면
- else {
- // 기관별 마취 동의서 서식 코드를 조회 한다
- String anstFormCd = this.consentWebService.getLinkedAnstDocument(consentMain.ConsentExecuteInfo["dutinstcd"]);
- if(anstFormCd == null && this.currentPreviewConsent.linkFormCd.Equals("1100010977")) {
- // 마취동의서 코드를 찾지 못하면 메시지 박스를 보여준다
- MessageBox.Show("기준자료 오류, 전산실에 문의하세요", "경고", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- // 마취 동의서 라면
- if(this.CurrentPreviewConsent.linkFormCd.Equals(anstFormCd)) {
- // 출력 후 연계서식 정보 초기화되기 때문에 미리 값을 저장 해 둔다
- var linkFormCd = this.CurrentPreviewConsent.linkFormCd;
- var orderNo = this.CurrentPreviewConsent.orderNo;
- var inputNm = this.CurrentPreviewConsent.inputNm;
- var inputId = this.CurrentPreviewConsent.inputId;
- MessageBox.Show(string.Format(Properties.Resources.msg_info_anes_docu_print)
- , string.Format(Properties.Resources.title_info),
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- // 선택된 동의서 출력
- PrintConsent();
- // 연계 동의서 출력
- //ConsentFormListVO[] voArr = this.consentWebService.GetConsentByFormcd(linkFormCd, consentMain.ConsentExecuteInfo["dutinstcd"]);
- ConsentFormListVO vo = this.consentWebService.GetConsentByFormcd(linkFormCd, consentMain.ConsentExecuteInfo["dutinstcd"]);
- // 조회된 서식이 없다면 출력 하지 않음
- if(vo == null) {
- return;
- }
- //setCurrentPreviewConsent(voArr[0], orderNo, inputId, inputNm);
- setCurrentPreviewConsent(vo, orderNo, inputId, inputNm);
- consentMain.setPrintButton(true);
- // 프린트 한다
- PrintConsent();
- }
- // 진정동의서 출력 해야 되는 경우라면
- else if(this.currentPreviewConsent.linkFormCd.Equals("1100010977")) {
- DialogResult clickResult = MessageBox.Show(string.Format(Properties.Resources.msg_jinjeong)
- , string.Format(Properties.Resources.title_jinjeong),
- MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information);
- switch(clickResult) {
- case DialogResult.Yes: {
- // 출력 후 연계서식 정보 초기화되기 때문에 미리 값을 저장 해 둔다
- var linkFormCd = this.CurrentPreviewConsent.linkFormCd;
- var orderNo = this.CurrentPreviewConsent.orderNo;
- var inputNm = this.CurrentPreviewConsent.inputNm;
- var inputId = this.CurrentPreviewConsent.inputId;
- // 선택된 동의서 출력
- PrintConsent();
- // 연계 동의서 출력
- //ConsentBySearchVO[] voArr = this.consentWebService.GetConsentByFormcd(linkFormCd, consentMain.ConsentExecuteInfo["dutinstcd"]);
- ConsentFormListVO vo = this.consentWebService.GetConsentByFormcd(linkFormCd, consentMain.ConsentExecuteInfo["dutinstcd"]);
- // 조회된 서식이 없다면 출력 하지 않음
- if(vo == null) {
- return;
- }
- setCurrentPreviewConsent(vo, orderNo, inputId, inputNm);
- consentMain.setPrintButton(true);
- // 프린트 한다
- PrintConsent();
- }
- break;
- case DialogResult.No: {
- // 선택된 동의서만 프린트
- PrintConsent();
- }
- break;
- case DialogResult.Cancel:
- // do nothing
- break;
- }
- }
- if (consentMain.multiParams == null)
- {
- // 출력을 다 하였으면 화면을 닫는다.
- consentMain.ClearPreviewConsent(true);
- }
- else
- {
- consentMain.showNextPreview();
- }
- }
- }
- /// <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;
- }
- // 로그인 사용자와 동의서 작성자가 다르면 인증 저장 제한
- if(!CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03") && !CurrentPreviewConsent.inputId.Equals(consentMain.ConsentExecuteInfo["loginUserNo"])) {
- MessageBox.Show("작성자만 인증 저장이 가능합니다.", "인증 저장 불가", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if(!CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03") && CurrentPreviewConsent.drOnly.ToUpper().Equals("Y")) {
- MessageBox.Show("의사만 인증저장 가능한 동의서 입니다.\n문의:보건의료정보관리(의무기록)팀", "인증 저장 불가", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- this.consentMain.saveClickPoint = true;
- this.consentMain.Save();
- this.consentMain.saveClickPoint = false;
- //저장 후 로그인 사용자를 현재endUser로 세팅
- consentMain.SetConsentUserInfo(consentMain.ConsentExecuteInfo["dutinstcd"]
- , consentMain.ConsentExecuteInfo["loginUserNo"]
- , consentMain.ConsentExecuteInfo["userDeptCd"]);
- }
- /// <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) {
- if (this.consentWebService.getCertUseYn(this.currentPreviewConsent.formCd,
- consentMain.ConsentExecuteInfo["dutinstcd"]) == "Y")
- {
- MessageBox.Show("인증서가 필요없는 서식은 [확인저장] 할 수 없습니다.\r[인증저장] 으로 진행하시기 바랍니다.");
- return;
- }
- 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.PatientCode)
- && CurrentPreviewConsent != null) {
- if(!ConsentMainControl.HasVerticalMonitor) {
- 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 void DeleteRecordOfDeleteConsent(string reasonForUseN) {
- 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 = (vo.inputId == null) ? CurrentEndUser.UserNo : vo.inputId;
- //string userName = (vo.inputNm == null) ? CurrentEndUser.UserName : vo.inputNm;
- string userId = this.consentMain.ConsentExecuteInfo["loginUserNo"];
- string userName = this.consentMain.ConsentExecuteInfo["loginUserName"];
- string deptCd = this.consentMain.ConsentExecuteInfo["userDeptCd"];
- string hosType = (vo.instCd == null) ? consentMain.ConsentExecuteInfo["dutinstcd"] : vo.instCd;
- if (string.IsNullOrEmpty(userName)) {
- UserVO userVo = hospitalWebService.GetUserInfo(userId, hosType, deptCd);
- userName = userVo.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.formId;
- string formCd = CurrentPreviewConsent.formCd;
- string consentMstRid = CurrentPreviewConsent.consentMstRid;
- int orderNo = vo.orderNo;
- string orderCode = vo.dxCd;
- string orderName = vo.dxNm;
- 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.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
- , orderNo
- , orderName
- , orderCode
- , ocrCode
- , cretno
- , userName
- , userName
- , mainDrId
- , CurrentEndUser.DeptCode
- , consentMain.GetTotalPageCount().ToString()
- , "P"
- , "P"
- , 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();
- if (consentMain.multiParams == null)
- {
- consentMain.ReInitializeViewer();
- }
- }
- else {
- if(this.CurrentTargetPatient != null && !string.IsNullOrEmpty(this.CurrentTargetPatient.PatientCode)) {
- //string userId = CurrentEndUser.UserNo;
- //string userName = CurrentEndUser.UserName;
- string userId = this.consentMain.ConsentExecuteInfo["loginUserNo"];
- string userName = this.consentMain.ConsentExecuteInfo["loginUserName"];
- string hosType = consentMain.ConsentExecuteInfo["dutinstcd"];
- string deptCd = this.consentMain.ConsentExecuteInfo["userDeptCd"];
- if (string.IsNullOrEmpty(userName)) {
- UserVO userVo = hospitalWebService.GetUserInfo(userId, hosType, deptCd);
- userName = userVo.userName;
- }
- string patientCode = CurrentTargetPatient.PatientCode;
- string clnDeptCode = CurrentTargetPatient.clnDeptCode;
- string vistType = CurrentTargetPatient.VisitType;
- string clnDate = CurrentTargetPatient.clnDate.Replace("-", "");
- string ward = CurrentTargetPatient.Ward;
- string roomcd = currentTargetPatient.RoomNo;
- int orderNo = CurrentTargetPatient.OrderNo;
- string orderCode = CurrentTargetPatient.OPdeptCode;
- string orderName = CurrentTargetPatient.OPdeptName;
- string mainDrId = CurrentTargetPatient.MainDrId;
- string formRid = CurrentPreviewConsent.formId;
- 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
- , patientCode
- , clnDeptCode
- , formRidInt
- , formCd
- , consentMstRidInt
- , reissueConsentMstRid
- , null
- , null
- , "PRT"
- , deviceIdentNo
- , vistType
- , hosType
- , clnDate
- , ward
- , roomcd
- , orderNo
- , orderName
- , orderCode
- , ocrCode
- , cretno
- , userName
- , userName
- , mainDrId
- , currentEndUser.DeptCode
- , consentMain.GetTotalPageCount().ToString()
- , "P"
- , "P"
- , CurrentTargetPatient.OpRsrvNo);
- if (consentMain.multiParams == null)
- {
- 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.PatientCode;
- 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 void SaveDataForDeleteConsent(string reasonForUseN) {
- string userId = CurrentEndUser.UserNo;
- string patientCode = CurrentTargetPatient.PatientCode;
- string clnDeptCd = CurrentTargetPatient.clnDeptCode;
- string ward = CurrentTargetPatient.Ward;
- string roomcd = CurrentTargetPatient.RoomNo;
- string formRid = CurrentPreviewConsent.formId;
- 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;
- this.consentWebService.SaveDelete(userId, Int32.Parse(consentMstRid), patientCode, clnDeptCd, CurrentPreviewConsent.formCd, CurrentTargetPatient.VisitType,
- consentMain.ConsentExecuteInfo["dutinstcd"], CurrentTargetPatient.clnDate, reasonForUseN, CurrentPreviewConsent.ocrCode,
- cretno, currentEndUser.DeptCode, consentMain.GetTotalPageCount().ToString(), "CP", "PC");
- //this.consentWebService.SaveDelete(userId
- // , consentMstRidInt
- // , patientCode
- // , clnDeptCd
- // , ward
- // , roomcd
- // , formRidInt
- // , CurrentPreviewConsent.FormCd
- // , rewriteConsentMstRid
- // , reissueConsentMstRidInt
- // , consentState
- // , deviceIdentNo
- // , CurrentTargetPatient.VisitType
- // , consentMain.ConsentExecuteInfo["dutinstcd"]
- // , CurrentTargetPatient.clnDate
- // , reasonForUseN
- // , CurrentPreviewConsent.Ocrcode
- // , cretno
- // , currentEndUser.DeptCode
- // , consentMain.GetTotalPageCount().ToString()
- // , "CP"
- // , "P");
- }
- private void SetHasMedicalHistoryInConsent(string patientCode) {
- this.CurrentPreviewConsent.hasMedicalHistory = false;
- }
- /// <summary>
- /// 동의서 뷰어에 동의서 로드
- /// </summary>
- public void RunConsentDualView() {
- bool runDualView = true;
- if(this.CurrentEndUser != null && this.CurrentPreviewConsent != null
- && !string.IsNullOrEmpty(this.CurrentPreviewConsent.printOnly)
- && this.CurrentPreviewConsent.printOnly.Equals("Y")
- ) {
- runDualView = false;
- }
- // 출력 상태일 경우 재출력만 가능하도록 버튼 조정
- if(this.CurrentEndUser != null && this.CurrentPreviewConsent != null
- && !string.IsNullOrEmpty(this.CurrentPreviewConsent.consentState)
- && (this.CurrentPreviewConsent.consentState.ToUpper().Equals("PAPER_OUT"))) {
- runDualView = false;
- }
- if(CurrentPreviewConsent == null) {
- return;
- }
- // 동의서 로드 전 consent_mst_rid에 해당하는 동의서가 상위 상태값이 있는지 체크
- SingleReturnData resultData = this.consentWebService.CheckConsentState(int.Parse(this.CurrentPreviewConsent.consentMstRid),
- this.CurrentPreviewConsent.consentStateEng);
- int state = Int32.Parse(resultData.responseData);
- 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) {
- CLIP.eForm.ImageView.ImageViewCtrl iViewer = consentMain.GetImageViewerCtrl();
- List<string> lStr = new List<string>();
- string sPath = this.consentMain.PluginExecuteInfo["imageUploadPath"] + "/DataTempImage/";
- string sLocal = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Clipsoft\ClipSoft.eForm.Viewer\DataTemp\";
- DirectoryInfo di = new DirectoryInfo(sLocal);
- if(di.Exists == false) {
- di.Create();
- }
- foreach(ConsentImageVO img in cImage) {
- if(File.Exists(sLocal + img.ImageFilename)) {
- Image imgTemp = Image.FromFile(sLocal + img.ImageFilename);
- lStr.Add(ImageToBase64(imgTemp, System.Drawing.Imaging.ImageFormat.Jpeg));
- imgTemp.Dispose();
- }
- else {
- string orgFile = img.ImagePath + "\\" + img.ImageFilename;
- string tempImgNm = orgFile.Substring(orgFile.IndexOf("\\") + 1).Replace("\\", "");
- using(WebClient myWebClient = new WebClient()) {
- myWebClient.DownloadFile(sPath + 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;
- }
- }
- }
- }
- 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"]);
- SetPatientAndUser(globalParams);
- globalParams[FOSParameter.OCRCode] = string.Empty;
- var ocrBuf = GetOcrCode();
- if(string.IsNullOrEmpty(ocrBuf)) {
- MessageBox.Show("OCR 중복입니다. 다시 환자를 선택하여 주세요.");
- return;
- }
- globalParams[FOSParameter.OCRCode] = CurrentPreviewConsent.ocrCode = ocrBuf;
- globalParams[FOSParameter.OCRCode] = CurrentPreviewConsent.ocrCode = GetOcrCode(); // OCR 코드
- if(string.IsNullOrEmpty(CurrentPreviewConsent.ocrCode)) {
- MessageBox.Show("OCRTAG 생성 오류. 전산실에 문의 하세요.");
- consentMain.ClearPreviewConsent(true);
- return;
- }
- globalParams[FOSParameter.Device] = "C";
- 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.PrintIp] = consentMain.ConsentExecuteInfo["printIP"];
- List<string> formGuids = new List<string> {};
- //string fos = Common.GetFosString(formGuids
- // , consentMain.PluginExecuteInfo["formServiceUrl"]
- // , globalParams
- // , null
- // , consentMain.ConsentExecuteInfo["dutinstcd"]);
- string fosNew = Common.getNewFosString(consentMain.PluginExecuteInfo["formServiceUrl"], globalParams, null, new List<String> { CurrentPreviewConsent.formId });
- SingleReturnData returnData = this.consentWebService.CheckConsentState(int.Parse(CurrentPreviewConsent.consentMstRid), CurrentPreviewConsent.consentStateEng);
- int state = Int32.Parse(returnData.responseData);
- if(state == 1) {
- MessageBoxDlg.Show(this, "이미 저장된 서식 입니다."
- , string.Format(Properties.Resources.msg_caption_confirm),
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- consentMain.PreviewConsent(fosNew);//서식을 열도록 fos을 던짐
- // 외래 환자 외에는 작성 완료(확인) 버튼 안보이게 설정
- /*
- if(CurrentTargetPatient.VisitType.Equals("O") && CurrentPreviewConsent.userDrFlag.Equals("Y")) {
- toolStripButtonCompleteSaveToServer.Visible = true;
- }
- else {
- toolStripButtonCompleteSaveToServer.Visible = false;
- }
- */
- consentMain.ConsentCommandCtrl.SetEnableButtonsByCurrentConsent();
- SetEnableByUserType();
- }
- /// <summary>
- /// 현재 동의서의 OCR 코드를 가져온다. OCR 코드가 존재하지 않으면 서버로부터 얻어온다
- /// </summary>
- /// <returns>OCR 코드</returns>
- public string GetOcrCode() {
- string strOcrCode = "";
- if(this.CurrentPreviewConsent.ocrtagPrntyn.Equals("N")) {
- strOcrCode = " ";
- }
- else {
- if(this.CurrentPreviewConsent != null
- && !string.IsNullOrEmpty(this.CurrentPreviewConsent.ocrCode)) {
- strOcrCode = this.CurrentPreviewConsent.ocrCode;
- }
- // OCR 코드가 없으면 서버로 부터 받아온다
- // TODO 삭제
- else {
- if(this.CurrentPreviewConsent != null
- && !string.IsNullOrEmpty(this.CurrentPreviewConsent.ocrtagPrntyn)
- && this.CurrentPreviewConsent.ocrtagPrntyn.Equals("Y")) {
- HospitalSvcRef.SingleReturnData returnData = hospitalWebService.GetOcrTag(this.consentMain.ConsentExecuteInfo["dutinstcd"]);
- if(string.IsNullOrEmpty(returnData.responseData)){
- throw new Exception("OCRTAG 생성 오류. 전산실에 문의 하세요.");
- }
- strOcrCode = returnData.responseData;
- }
- }
- if(string.IsNullOrEmpty(strOcrCode)) {
- throw new Exception("OCRTAG 생성 오류. 전산실에 문의 하세요.");
- }
- }
- return strOcrCode;
- }
- /// <summary>
- /// changingGlobalParams Dataset 에 FOS 파라미터의 name 과 value 를 설정한다
- /// </summary>
- /// <param name="globalParams"></param>
- public void SetPatientAndUser(Dictionary<FOSParameter, string> globalParams) {
- Dictionary<FOSParameter, string> changingGlobalParams = new Dictionary<FOSParameter, string>();
- if(CurrentPreviewConsent == null) {
- MessageBox.Show("동의서 정보가 없습니다.");
- throw new Exception("동의서 정보가 없습니다.");
- }
- if(CurrentTargetPatient == null || string.IsNullOrEmpty(this.CurrentTargetPatient.PatientCode)) {
- MessageBox.Show("환자 정보가 없습니다.");
- throw new Exception("환자 정보가 없습니다.");
- }
- if(CurrentEndUser == null) {
- MessageBox.Show("사용자 정보가 없습니다.");
- throw new Exception("사용자 정보가 없습니다.");
- }
- // 동의서 정보
- changingGlobalParams[FOSParameter.FormName] = this.CurrentPreviewConsent.formPrintName;
- // 환자 정보
- changingGlobalParams[FOSParameter.ImageUploadPath] = this.consentMain.PluginExecuteInfo["imageUploadPath"] + "/";
- changingGlobalParams[FOSParameter.PatientCode] = this.CurrentTargetPatient.PatientCode;
- changingGlobalParams[FOSParameter.PatientSexAge] = this.CurrentTargetPatient.PatientSexAge;
- changingGlobalParams[FOSParameter.PatientName] = this.CurrentTargetPatient.PatientName;
- changingGlobalParams[FOSParameter.PatientNameFix] = this.CurrentTargetPatient.PatientName;
- changingGlobalParams[FOSParameter.PatientRRN] = this.CurrentTargetPatient.PatientJuminNo;
- changingGlobalParams[FOSParameter.PatientRRNOrg] = this.CurrentTargetPatient.PatientJuminNoOrg;
- changingGlobalParams[FOSParameter.RoomNo] = this.CurrentTargetPatient.Ward + "/" + this.CurrentTargetPatient.RoomNo;
- changingGlobalParams[FOSParameter.VisitDate] = SetDateFormatting(this.CurrentTargetPatient.clnDate.Replace("-", ""));
- changingGlobalParams[FOSParameter.DeptName] = this.CurrentTargetPatient.clnDeptName;
- changingGlobalParams[FOSParameter.MainDoctor] = this.CurrentTargetPatient.MainDrNm;
- changingGlobalParams[FOSParameter.PatientAddress] = this.CurrentTargetPatient.PatientAddr;
- changingGlobalParams[FOSParameter.PatientTelNo] = this.CurrentTargetPatient.PatientTelNo;
- changingGlobalParams[FOSParameter.PatientTelNoFix] = this.CurrentTargetPatient.PatientTelNo;
- changingGlobalParams[FOSParameter.Insukind] = this.CurrentTargetPatient.Insukind;
- changingGlobalParams[FOSParameter.DeptCode] = this.CurrentTargetPatient.clnDeptCode;
- changingGlobalParams[FOSParameter.DiagName] = this.CurrentTargetPatient.OpDiagName;
- changingGlobalParams[FOSParameter.OpRsrvNo] = this.CurrentTargetPatient.OpRsrvNo;
- changingGlobalParams[FOSParameter.OperationName] = this.CurrentTargetPatient.OpName;
- changingGlobalParams[FOSParameter.OpDoctorName] = this.CurrentTargetPatient.PerfDrName;
- changingGlobalParams[FOSParameter.OpDeptName] = (this.CurrentTargetPatient.PerfDrFlag + "").Equals("전문의") ? this.CurrentTargetPatient.PerfDrDept ?? "" : "";
- changingGlobalParams[FOSParameter.OpCommDeptName] = !(this.CurrentTargetPatient.PerfDrFlag + "").Equals("전문의") ? this.CurrentTargetPatient.PerfDrDept ?? "" : "";
- changingGlobalParams[FOSParameter.AnstDrName1] = this.CurrentTargetPatient.AnstDrName1;
- changingGlobalParams[FOSParameter.AnstDeptName1] = (this.CurrentTargetPatient.AnstDrFlag1 + "").Equals("전문의") ? this.CurrentTargetPatient.AnstDeptName1 ?? "" : "";
- changingGlobalParams[FOSParameter.AnstCommDeptName1] = !(this.CurrentTargetPatient.AnstDrFlag1 + "").Equals("전문의") ? this.CurrentTargetPatient.AnstDeptName1 ?? "" : "";
- changingGlobalParams[FOSParameter.AnstDrName2] = this.CurrentTargetPatient.AnstDrName2;
- changingGlobalParams[FOSParameter.AnstDeptName2] = (this.CurrentTargetPatient.AnstDrFlag2 + "").Equals("전문의") ? this.CurrentTargetPatient.AnstDeptName2 ?? "" : "";
- changingGlobalParams[FOSParameter.AnstCommDeptName3] = !(this.CurrentTargetPatient.AnstDrFlag2 + "").Equals("전문의") ? this.CurrentTargetPatient.AnstDeptName2 ?? "" : "";
- changingGlobalParams[FOSParameter.AnstDrName3] = this.CurrentTargetPatient.AnstDrName3;
- changingGlobalParams[FOSParameter.AnstDeptName3] = (this.CurrentTargetPatient.AnstDrFlag3 + "").Equals("전문의") ? this.CurrentTargetPatient.AnstDeptName3 ?? "" : "";
- changingGlobalParams[FOSParameter.AnstCommDeptName3] = !(this.CurrentTargetPatient.AnstDrFlag3 + "").Equals("전문의") ? this.CurrentTargetPatient.AnstDeptName3 ?? "" : "";
- if(!string.IsNullOrEmpty(this.CurrentTargetPatient.PatientJuminNo) && this.CurrentTargetPatient.PatientJuminNo.Length > 6) {
- changingGlobalParams[FOSParameter.PatientBirthDay] = this.CurrentTargetPatient.PatientJuminNo.Substring(0, 6);
- changingGlobalParams[FOSParameter.PatientBirthDayFix] = this.CurrentTargetPatient.PatientJuminNo.Substring(0, 6);
- }
- if(string.IsNullOrEmpty(changingGlobalParams[FOSParameter.DiagName])) {
- changingGlobalParams[FOSParameter.DiagName] = this.CurrentPreviewConsent.opDiagName;
- }
- if(string.IsNullOrEmpty(changingGlobalParams[FOSParameter.DiagName])) {
- changingGlobalParams[FOSParameter.DiagName] = this.CurrentTargetPatient.clnDxNm;
- }
- if(string.IsNullOrEmpty(changingGlobalParams[FOSParameter.DiagName])) {
- if(!string.IsNullOrEmpty(consentMain.ConsentExecuteInfo["clnDxNm"])) {
- changingGlobalParams[FOSParameter.DiagName] = consentMain.ConsentExecuteInfo["clnDxNm"];
- }
- }
- if(string.IsNullOrEmpty(changingGlobalParams[FOSParameter.OperationName])) {
- changingGlobalParams[FOSParameter.OperationName] = this.CurrentPreviewConsent.opName;
- }
- // 설명일 (수술 확정일)
- var opDate = this.CurrentTargetPatient.OpCnfmDate;
- var targetDate = new DateTime();
- if(opDate != null && opDate.Length > 0) {
- targetDate = DateTime.ParseExact(opDate, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
- changingGlobalParams[FOSParameter.SignDate] = targetDate.ToLongDateString();
- }
- else {
- //changingGlobalParams[FOSParameter.SignDate] = this.CurrentTargetPatient.OpCnfmDate;
- }
- changingGlobalParams[FOSParameter.BP] = this.CurrentTargetPatient.Ex_bp;
- changingGlobalParams[FOSParameter.DM] = this.CurrentTargetPatient.Ex_dm;
- changingGlobalParams[FOSParameter.Heart] = this.CurrentTargetPatient.Ex_heart;
- changingGlobalParams[FOSParameter.Kidney] = this.CurrentTargetPatient.Ex_kidney;
- changingGlobalParams[FOSParameter.Respiration] = this.CurrentTargetPatient.Ex_respiration;
- changingGlobalParams[FOSParameter.MedicalHistory] = this.CurrentTargetPatient.Ex_hx;
- changingGlobalParams[FOSParameter.Allergy] = this.CurrentTargetPatient.Ex_allergy;
- changingGlobalParams[FOSParameter.Drug] = this.CurrentTargetPatient.Ex_drug;
- changingGlobalParams[FOSParameter.Smoking] = this.CurrentTargetPatient.Ex_smoking;
- changingGlobalParams[FOSParameter.Idiosyncrasy] = this.CurrentTargetPatient.Ex_idio;
- changingGlobalParams[FOSParameter.Nacrotics] = this.CurrentTargetPatient.Ex_nacrotics;
- changingGlobalParams[FOSParameter.Airway] = this.CurrentTargetPatient.Ex_airway;
- changingGlobalParams[FOSParameter.Hemorrhage] = this.CurrentTargetPatient.Ex_hemorrhage;
- changingGlobalParams[FOSParameter.EtcStatus] = this.CurrentTargetPatient.Ex_status_etc;
- // 외래일 경우 emr.mmbdhrcd.hardcdno = 6920 에 지정된 서식외에는 사용자를 진료의로 변경한다.
- if(CurrentTargetPatient.VisitType.Equals("O") && CurrentPreviewConsent.userDrFlag.Equals("Y") && !CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) {
- //consentMain.SetConsentUserInfo(consentMain.ConsentExecuteInfo["dutinstcd"]
- // , CurrentTargetPatient.MainDrId
- // , currentTargetPatient.clnDeptCode); // 외래 진료의는 근무 부서 이외의 과의 처방을 낼 수 없다.
- consentMain.SetConsentUserInfo(consentMain.ConsentExecuteInfo["dutinstcd"]
- , CurrentTargetPatient.MainDrId
- , currentTargetPatient.clnDeptCode, ""); // 외래 진료의는 근무 부서 이외의 과의 처방을 낼 수 없다.
- }
- else if(!CurrentEndUser.UserNo.Equals(consentMain.ConsentExecuteInfo["loginUserNo"])) {
- // 로그인 사용자와 다른 경우 재조회
- consentMain.SetConsentUserInfo(consentMain.ConsentExecuteInfo["dutinstcd"]
- , consentMain.ConsentExecuteInfo["loginUserNo"]
- , consentMain.ConsentExecuteInfo["userDeptCd"]);
- }
- string jobKindCd = !string.IsNullOrEmpty(currentEndUser.JobKindCd) ? currentEndUser.JobKindCd.Substring(0, 2) : "00";
- changingGlobalParams[FOSParameter.UserName] = this.CurrentEndUser.UserName;
- changingGlobalParams[FOSParameter.UserTelNo] = this.CurrentEndUser.UserTelNo;
- changingGlobalParams[FOSParameter.ExplDrName] = jobKindCd.Substring(0, 2).Equals("03") ? CurrentEndUser.UserName : string.Empty;
- changingGlobalParams[FOSParameter.ExplDrTelNo] = jobKindCd.Substring(0, 2).Equals("03") ? CurrentEndUser.UserTelNo : string.Empty;
- // 사용자의 서명 이미지를 가져온다
- UserSignImageVO vo = this.hospitalWebService.GetSignImage(this.CurrentEndUser.UserNo, this.consentMain.ConsentExecuteInfo["dutinstcd"]);
- if(vo != null && vo.SignImage != null && vo.SignImage.Length > 0) {
- // 서명 이미지를 BASE64 형식으로 변환한다.
- changingGlobalParams[FOSParameter.SignImage] = ImageToBase64(byteArrayToImage(vo.SignImage), System.Drawing.Imaging.ImageFormat.Png);
- // 의사의 경우라면 설명의사에 서명이미지를 설정한다
- changingGlobalParams[FOSParameter.ExplDrSign] = jobKindCd.Substring(0, 2).Equals("03") ? changingGlobalParams[FOSParameter.SignImage] : string.Empty;
- changingGlobalParams[FOSParameter.ExplDrSign_p] = changingGlobalParams[FOSParameter.ExplDrSign];
- }
- changingGlobalParams[FOSParameter.ExplDrName_P] = CurrentEndUser.UserName;
- changingGlobalParams[FOSParameter.ExplDrTelNo_p] = CurrentEndUser.UserTelNo;
-
- // 출력할 경우 설명 의사와 서명 이미지는 공백 처리
- if (consentMain.ConsentExecuteInfo["printYN"].Equals("Y")) {
- changingGlobalParams[FOSParameter.ExplDrName] = string.Empty;
- changingGlobalParams[FOSParameter.ExplDrTelNo] = string.Empty;
- changingGlobalParams[FOSParameter.ExplDrSign] = string.Empty;
- changingGlobalParams[FOSParameter.PatientName] = string.Empty;
- changingGlobalParams[FOSParameter.PatientBirthDay] = string.Empty;
- changingGlobalParams[FOSParameter.PatientTelNo] = string.Empty;
- // 보호자상주확인서 프린터 출력시 제외 항목
- //changingGlobalParams[FOSParameter.UserName] = string.Empty;
- //changingGlobalParams[FOSParameter.SignImage] = string.Empty;
- }
- // 원무 파라미터 설정
- 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"];
- // 경대병원 파리미터 추가
- changingGlobalParams[FOSParameter.tag1] = consentMain.ConsentExecuteInfo["tag1"];
- changingGlobalParams[FOSParameter.tag2] = consentMain.ConsentExecuteInfo["tag2"];
- changingGlobalParams[FOSParameter.tag3] = consentMain.ConsentExecuteInfo["tag3"];
- changingGlobalParams[FOSParameter.tag4] = consentMain.ConsentExecuteInfo["tag4"];
- changingGlobalParams[FOSParameter.tag5] = consentMain.ConsentExecuteInfo["tag5"];
- changingGlobalParams[FOSParameter.tag6] = consentMain.ConsentExecuteInfo["tag6"];
- changingGlobalParams[FOSParameter.tag7] = consentMain.ConsentExecuteInfo["tag7"];
- changingGlobalParams[FOSParameter.tag8] = consentMain.ConsentExecuteInfo["tag8"];
- changingGlobalParams[FOSParameter.tag9] = consentMain.ConsentExecuteInfo["tag9"];
- changingGlobalParams[FOSParameter.tag10] = consentMain.ConsentExecuteInfo["tag10"];
- // 한번 사용한 후 해당 설정은 초기화
- consentMain.ConsentExecuteInfo["tag1"] = string.Empty;
- consentMain.ConsentExecuteInfo["tag2"] = string.Empty;
- consentMain.ConsentExecuteInfo["tag3"] = string.Empty;
- consentMain.ConsentExecuteInfo["tag4"] = string.Empty;
- consentMain.ConsentExecuteInfo["tag5"] = string.Empty;
- consentMain.ConsentExecuteInfo["tag6"] = string.Empty;
- consentMain.ConsentExecuteInfo["tag7"] = string.Empty;
- consentMain.ConsentExecuteInfo["tag8"] = string.Empty;
- consentMain.ConsentExecuteInfo["tag9"] = string.Empty;
- consentMain.ConsentExecuteInfo["tag10"] = string.Empty;
- ChangeGlobalParametersToNew(globalParams, changingGlobalParams);
- }
- /// <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.ordType)) {
- if(!this.CurrentPreviewConsent.ordType.Equals("O")) {
- globalParams[FOSParameter.UserName] = consentMain.ConsentExecuteInfo["loginUserName"];
- }
- if(CurrentEndUser.JobKindCd.Contains("03")) {
- globalParams[FOSParameter.ExplDrName] = CurrentEndUser.UserName ?? string.Empty;
- globalParams[FOSParameter.ExplDrTelNo] = CurrentEndUser.UserTelNo ?? string.Empty;
- // 사용자의 서명 이미지를 가져온다
- UserSignImageVO vo = this.hospitalWebService.GetSignImage(this.CurrentEndUser.UserNo, this.consentMain.ConsentExecuteInfo["dutinstcd"]);
- if(vo != null && vo.SignImage != null && vo.SignImage.Length > 0) {
- // 서명 이미지를 BASE64 형식으로 변환한다.
- //globalParams[FOSParameter.SignImage] = ImageToBase64(byteArrayToImage(vo.SignImage), System.Drawing.Imaging.ImageFormat.Png);
- // 의사의 경우라면 설명의사에 서명이미지를 설정한다
- globalParams[FOSParameter.ExplDrSign] = ImageToBase64(byteArrayToImage(vo.SignImage), System.Drawing.Imaging.ImageFormat.Png) ?? string.Empty;
- }
- }
- }
- //string fos = Common.GetFosStringForEpt(actionParams, consentMain.PluginExecuteInfo["formServiceUrl"], globalParams, consentMain.ConsentExecuteInfo["dutinstcd"]);
- SingleReturnData returnData = this.consentWebService.CheckConsentState(int.Parse(this.CurrentPreviewConsent.consentMstRid), this.CurrentPreviewConsent.consentStateEng);
- int state = Int32.Parse(returnData.responseData);
- if(state == 1) {
- MessageBoxDlg.Show(this, "이미 저장된 서식 입니다."
- , string.Format(Properties.Resources.msg_caption_confirm),
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- string newFos = Common.getNewEptFosString(consentMain.PluginExecuteInfo["formServiceUrl"],
- consentMain.PluginExecuteInfo["baseConsentSvcURL"],
- globalParams,
- new List<String> { CurrentPreviewConsent.formId },
- new List<String> { CurrentPreviewConsent.consentMstRid });
- consentMain.PreviewConsent(newFos);
- // 외래 환자 외에는 작성 완료(확인) 버튼 안보이게 설정
- /*
- if(!CurrentTargetPatient.VisitType.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) {
- //int state = this.consentWebService.CheckConsentState(int.Parse(this.CurrentPreviewConsent.ConsentMstRid), this.CurrentPreviewConsent.ConsentState);
- SingleReturnData returnData = this.consentWebService.CheckConsentState(int.Parse(this.CurrentPreviewConsent.consentMstRid), this.CurrentPreviewConsent.consentStateEng);
- int state = Int32.Parse(returnData.responseData);
- if(state == 1) {
- MessageBoxDlg.Show(this, "이미 저장된 서식 입니다."
- , string.Format(Properties.Resources.msg_caption_confirm),
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- //string userId = CurrentEndUser.UserNo;
- //string userId = this.consentMain.ConsentExecuteInfo["loginUserNo"];
- //string userName = this.consentMain.ConsentExecuteInfo["loginUserName"];
- string userId = this.consentMain.ConsentExecuteInfo["loginUserNo"];
- string userName = this.consentMain.ConsentExecuteInfo["loginUserName"];
- string deptCd = this.consentMain.ConsentExecuteInfo["userDeptCd"];
- string hosType = this.consentMain.ConsentExecuteInfo["dutinstcd"];
- if (string.IsNullOrEmpty(userName)) {
- UserVO userVo = hospitalWebService.GetUserInfo(userId, hosType, deptCd);
- userName = userVo.userName;
- }
- string patientCode = CurrentTargetPatient.PatientCode;
- string clnDeptCode = CurrentTargetPatient.clnDeptCode;
- string vistType = CurrentTargetPatient.VisitType;
- string clnDate = CurrentTargetPatient.clnDate.Replace("-", "");
- int rewriteConsentMstRid = 0;
- string ward = CurrentTargetPatient.Ward;
- string roomcd = CurrentTargetPatient.RoomNo;
- string formRid = CurrentPreviewConsent.formId;
- 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;
- int.TryParse(CurrentTargetPatient.cretno, out int cretno);
- ConvertStringToInt(formRid, consentMstRid, out int formRidInt, out int consentMstRidInt);
- string deviceIdentNo = System.Environment.MachineName;
- Cursor currentCursor = this.Cursor;
- try {
- this.Cursor = Cursors.WaitCursor;
- string ocrCode = CurrentPreviewConsent.ocrCode;
- if(string.IsNullOrEmpty(ocrCode)) {
- ocrCode = CurrentPreviewConsent.ocrCode = GetOcrCode();
- }
-
- SingleReturnData returnData2 = this.consentWebService.SaveTempData(userId
- , patientCode
- , clnDeptCode
- , formRidInt
- , formCd
- , consentMstRidInt
- , rewriteConsentMstRid
- , eptXmlValue
- , dataValue
- , consentMain.ConsentExecuteInfo["DeviceType"] //"WIN"
- , deviceIdentNo
- , vistType
- , consentMain.ConsentExecuteInfo["dutinstcd"]
- , clnDate
- , ward
- , roomcd
- , orderNo
- , orderName
- , orderCode
- , ocrCode
- , cretno
- , userName
- , userName
- , mainDrId
- , CurrentEndUser.DeptCode
- , consentMain.GetTotalPageCount().ToString()
- , "T"
- , "P" // 임시저장 시 P 상태로 기록, 스캔 매수 입력 하도록 설정
- , CurrentTargetPatient.OpRsrvNo
- // dbs227, 확인 저장 시 일괄저장이 가능하도록 ELECTR_CMP 상태로 바꿈
- , m_IsComplete ? "ELECTR_CMP" : "");
- consentMstRidInt = Int32.Parse(returnData2.responseData);
- // 현재 사용하지 않음
- //기왕력 데이터 저장
- //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 {
- if (consentMain.multiParams == null)
- {
- 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 = "ELECTR_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;
- }
- // TODO 원무 인증 저장 pass
- // 원무 인증저장일 경우 인증 저장 pass
- if(this.consentWebService.getCertUseYn(this.currentPreviewConsent.formCd,
- consentMain.ConsentExecuteInfo["dutinstcd"]) == "Y")
- //if (false)
- {
- consentState = "CERTIFY_CMP";
- }
- else if(this.m_IsComplete) {
- // 인증저장 시 공인인증 처리 하지 않는다.
- }
- // 원무 인증저장이 아닐경우 기존루틴
- else {
- SignatureConfig sign = new SignatureConfig();
- try {
- // 공인인증 처리용
- sCertTarget = sign.getSHA256ImageHash(exportedImageFiles, string.Empty);
- // 공인인증 처리
- sCertResult = ConsentImageSignature(sCertTarget, CurrentEndUser.UserNo, CurrentEndUser.UserName);
- if(sCertResult == "-10") {
- // "로그인 사용자 정보를 통하여 공인인증서 정보가 정상적으로 조회되지 않았습니다."
- MessageBoxDlg.Show(true, Properties.Resources.msg_sign_user_info_fail
- , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail),
- MessageBoxButtons.OK, MessageBoxIcon.Error);
- saveResult = "-99";
- return true;
- }
- else if(sCertResult == "-20") {
- // "공인인증 서버 접속에 실패하였을 하였습니다."
- MessageBoxDlg.Show(true, Properties.Resources.msg_sign_server_connection_fail
- , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail),
- MessageBoxButtons.OK, MessageBoxIcon.Error);
- saveResult = "-99";
- return true;
- }
- else if(sCertResult == "-30") {
- // "공인인증 서버 접속에 실패하였을 하였습니다."
- MessageBoxDlg.Show(true, Properties.Resources.msg_sign_server_connection_fail
- , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail),
- MessageBoxButtons.OK, MessageBoxIcon.Error);
- saveResult = "-99";
- return true;
- }
- else if(sCertResult == "-35") {
- // 공인인증 비밀번호 입력하지 않고 닫음
- saveResult = "-99";
- return true;
- }
- else if(sCertResult == "-40") {
- // "공인인증서 비밀번호가 틀렸습니다.
- MessageBoxDlg.Show(true, Properties.Resources.msg_sign_password_fail
- , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail),
- MessageBoxButtons.OK, MessageBoxIcon.Error);
- saveResult = "-99";
- return true;
- }
- else if(sCertResult == "-50") {
- // "공인인증서명 처리를 실패하였을 하였습니다."
- MessageBoxDlg.Show(true, Properties.Resources.msg_sign_exec_fail
- , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail),
- MessageBoxButtons.OK, MessageBoxIcon.Error);
- saveResult = "-99";
- return true;
- }
- else if(sCertResult == "-99") {
- // "공인인증서명 처리를 실패하였을 하였습니다."
- MessageBoxDlg.Show(true, Properties.Resources.msg_sign_exec_fail
- , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail),
- MessageBoxButtons.OK, MessageBoxIcon.Error);
- saveResult = "-99";
- return true;
- }
- translateResult = 1;
- // 확인저장이 아니라면 인증저장이다
- if(!m_IsComplete) {
- consentState = "CERTIFY_CMP";
- }
- }
- catch(Exception ex) {
- string exMessage = ex.Message;
- if(ex.InnerException != null) {
- exMessage += Environment.NewLine + ex.InnerException.Message;
- }
- MessageBoxDlg.Show(true, string.Format(exMessage)
- , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail),
- MessageBoxButtons.OK, MessageBoxIcon.Error);
- saveResult = translateResult;
- return false;
- }
- // DB 저장용
- sCertTarget = sign.getSHA256ImageHash(exportedImageFiles, "^");
- }
- //string userId = CurrentEndUser.UserNo;
- //string userName = CurrentEndUser.UserName;
- string userId = this.consentMain.ConsentExecuteInfo["loginUserNo"];
- string userName = this.consentMain.ConsentExecuteInfo["loginUserName"];
- string deptCd = this.consentMain.ConsentExecuteInfo["userDeptCd"];
- string hosType = consentMain.ConsentExecuteInfo["dutinstcd"];
- if (string.IsNullOrEmpty(userName)) {
- UserVO userVo = hospitalWebService.GetUserInfo(userId, hosType, deptCd);
- userName = userVo.userName;
- }
- string patientCode = CurrentTargetPatient.PatientCode;
- string clnDeptCode = CurrentTargetPatient.clnDeptCode;
- string vistType = CurrentTargetPatient.VisitType;
- string clnDate = CurrentTargetPatient.clnDate.Replace("-", "").Replace("/", "");
- string ward = CurrentTargetPatient.Ward;
- string roomcd = CurrentTargetPatient.RoomNo;
- string formRid = CurrentPreviewConsent.formId;
- string formCd = CurrentPreviewConsent.formCd;
- string consentMstRid = CurrentPreviewConsent.consentMstRid;
- int rewriteConsentMstRid = CurrentPreviewConsent.RewriteConsentMstRid;
- int orderNo = CurrentTargetPatient.OrderNo;
- string orderCode = CurrentTargetPatient.clnDxCd;
- string orderName = CurrentTargetPatient.clnDxNm;
- string dschdd = CurrentTargetPatient.Dschdd;
- string mainDrId = this.CurrentTargetPatient.MainDrId;
- string 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(formRid, consentMstRid, out int formRidInt, out int consentMstRidInt);
- string deviceIdentNo = System.Environment.MachineName;
- Cursor currentCursor = this.Cursor;
- try {
- this.Cursor = Cursors.WaitCursor;
- string ocrCode = CurrentPreviewConsent.ocrCode;
- if(string.IsNullOrEmpty(ocrCode)) {
- ocrCode = CurrentPreviewConsent.ocrCode = GetOcrCode();
- }
- SingleReturnData returnData = this.consentWebService.SaveCompleteAll(userId
- , patientCode
- , clnDeptCode
- , formRidInt
- , formCd
- , consentMstRidInt
- , rewriteConsentMstRid
- , eptXmlValue
- , dataValue
- , consentMain.ConsentExecuteInfo["DeviceType"] //"WIN"
- , deviceIdentNo
- , vistType
- , consentMain.ConsentExecuteInfo["dutinstcd"] //hosType, hostype 대신 근무지기관코드를 전송한다
- , clnDate
- , ward
- , roomcd
- , orderNo
- , orderName
- , orderCode
- , ocrCode
- , cretno
- , userName
- , userName
- , this.exportedImageFilesJson
- , sCertTarget
- , sCertResult
- , dschdd
- , consentState
- , mainDrId
- , CurrentEndUser.DeptCode
- , consentMain.GetTotalPageCount().ToString()
- , actKind
- , "P"
- , CurrentTargetPatient.OpRsrvNo
- , sizeValue);
- consentMstRidInt = Int32.Parse(returnData.responseData);
- // 기왕력 데이터 저장 sPID
- //SetNewMedicalHistory(dataValue);
- if (consentMain.multiParams == null)
- {
- // 인증 저장 후에는 이력 탭 설정
- this.consentMain.ConsentListCtrl.InquiryConsentData(0);
- }
- // dbs227
- // TODO 인증저장 후 종료 메시지 및 닫기 버튼
- //MessageBoxDlg.Show(this, string.Format(Properties.Resources.msg_esign_N_comp_save_confirm)
- // , string.Format(Properties.Resources.msg_caption_confirm),
- // MessageBoxButtons.OK, MessageBoxIcon.Information);
- // 확인 저장 시 닫기 버튼 활성화 하지 않는다.
- if(!consentState.Equals("ELECTR_CMP")) {
- //연속서식의 경우 모든 서식을 작성할 때 까지 메시지를 띄우지 않는다.
- if (consentMain.multiParams != null)
- {
- int page = 0;
- Dictionary<string, object> pageParam = consentMain.multiParams[consentMain.multiParams.Count - 1];
- if (pageParam.ContainsKey("PAGE_COUNT"))
- {
- page = Int32.TryParse(pageParam["PAGE_COUNT"].ToString(), out int pageNumber) ? pageNumber : -1;
- }
- else
- {
- MessageBox.Show("연속서식 페이지오류", Properties.Resources.msg_caption_fail, MessageBoxButtons.OK, MessageBoxIcon.Error);
- saveResult = "-99";
- return true;
- }
- if ((consentMain.multiParams.Count - 2) == page)
- {
- MessageBox.Show("모든 서식을 저장하였습니다, 확인을 누르면 종료합니다.",
- string.Format(Properties.Resources.msg_caption_confirm),
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.consentMain.Parent_Disposed();
- }
- }
- else
- {
- 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)
- {
- if (this.consentMain.ConsentExecuteInfo["printAct"].Equals("Y"))
- {
- this.consentMain.Parent_Disposed();
- }
- else
- {
- this.ParentForm.WindowState = FormWindowState.Minimized;
- }
- }
- }
- }
- if (consentMain.multiParams == null)
- {
- 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;
- var fileInfo = new FileInfo(sFullPath[k]);
- if(k != 0) {
- fileSizes += ",";
- }
- 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.UserNo);
- // //LCTech 모듈을 위한 DB 작업을 하고 저장할 파일명을 얻는다.
- // string newFileFullName = this.hospitalWebService.GetFileName(CurrentTargetPatient.PatientCode, CurrentTargetPatient.VisitType,
- // CurrentTargetPatient.clnDate.Replace("-", ""), CurrentTargetPatient.Dschdd, CurrentTargetPatient.cretno,
- // "500", CurrentPreviewConsent.FormCd, i.ToString(),
- // CurrentPreviewConsent.Ocrcode, CurrentEndUser.UserNo);
- // //MessageBox.Show(newFileFullName); //O:\fnuImage\201607\19\100501967
- // string uploadFileName = newFileFullName + ".jpg";
- // if (string.IsNullOrEmpty(newFileFullName))
- // {
- // return -10;
- // }
- // //이미지 정보 DB에 저장
- // int consentImageRid = this.consentWebService.SaveImageUploadInfo("ELECTR_CMP", uploadFileName,
- // consentMstRidInt, CurrentEndUser.UserNo, int.Parse(CurrentPreviewConsent.FormRid));
- // /*
- // //저장된 이미지에서 해쉬정보 추출
- // string sCertTarget = GetImageCertification(imgFile);
- // //해쉬정보 DB에 저장
- // this.consentWebService.SaveImageSignInfo("ELECTR_CMP", consentMstRidInt, consentImageRid,
- // CurrentEndUser.UserNo, sCertTarget);
- // */
- // if (i == 0) consentImageRid_F = consentImageRid; //첫번째 consentImageRid 를 저장한다.
- // sCertTarget += GetImageCertification(imgFile) + "^";
- // //이미지를 서버에 업로드(서버에서 나스에 저장)
- // System.Net.WebClient wcClient = new System.Net.WebClient();
- // string imageUploadServerUrl = this.consentMain.PluginExecuteInfo["imageUploadServerUrl"];
- // System.Collections.Specialized.NameValueCollection values = new System.Collections.Specialized.NameValueCollection();
- // values.Add("up_path", uploadFileName);
- // wcClient.QueryString = values;
- // wcClient.UploadFile(imageUploadServerUrl, "POST", imgFile);
- // File.Delete(imgFile);
- // }
- // // 외래일 경우 공인인증 처리가 없음.
- // if (!string.IsNullOrEmpty(CurrentTargetPatient.VisitType) && !CurrentTargetPatient.VisitType.Equals("O"))
- // {
- // sCertTarget = sCertTarget.Substring(0, sCertTarget.Length - 1);
- // this.consentWebService.SaveImageSignInfo("ELECTR_CMP", consentMstRidInt, consentImageRid_F,
- // CurrentEndUser.UserNo, sCertTarget, sCertResult);
- // }
- // resultValue = 1;
- // }
- // catch (Exception err)
- // {
- // resultValue = -99;
- // throw err;
- // }
- // }
- // }
- // return resultValue;
- //}
- /// <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;
- }
- }
- private bool checkPrintablePatients(List<PatListVO> volist) {
- foreach(PatListVO patInfo in volist) {
- var cnt = hospitalWebService.checkPrintablePatient(consentMain.ConsentExecuteInfo["dutinstcd"],
- patInfo.pid,
- patInfo.inDd.Replace("/", "").Replace("-", ""),
- patInfo.cretNo.ToString());
- if(cnt > 0) {
- return false;
- }
- }
- return true;
- }
- /// <summary>
- /// 동의서 출력
- /// </summary>
- private void PrintConsent() {
- // 환자정보가 없을 경우 출력이 되지 않도록 적용
- if(this.CurrentTargetPatient == null || string.IsNullOrEmpty(this.CurrentTargetPatient.PatientCode) || string.IsNullOrEmpty(this.CurrentTargetPatient.PatientName)) {
- DialogResult result = MessageBox.Show(string.Format(Properties.Resources.msg_error_user_data)
- , string.Format(Properties.Resources.msg_caption_fail),
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- // 출력 : patientInfo 를 기반으로 출력하는 경우와 환자목록에서 멀티선택 출력의 경우로 나눠야 한다.
- List<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) {
- var cnt = hospitalWebService.getMultiprintable(consentMain.ConsentExecuteInfo["dutinstcd"], CurrentPreviewConsent.formCd);
- if(cnt < 1) {
- MessageBox.Show("멀티출력 가능한 서식이 아닙니다. 전산실에 문의 하세요.");
- return;
- }
- // 여러 환자 선택 시 출력 할 수 없는 수진이력이 있는지 확인한다.
- if(!checkPrintablePatients(volist)) {
- // 6961 [전자동의서]출력시 특정 진찰료 면제사유시 제어 switch
- var runCount = hospitalWebService.checkHardcd(consentMain.ConsentExecuteInfo["dutinstcd"], "6961", "Y");
- if(runCount > 0) {
- MessageBox.Show("다중 선택된 환자 중 출력할 수 없는 수진이력이 있습니다.\n(문의: 의무기록팀)", "확인", MessageBoxButtons.OK);
- return;
- }
- }
- 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];
- var util = CLIP.eForm.Consent.Common.LoggingUtility.GetLoggingUtility("ERROR", log4net.Core.Level.Error, false);
- for(int i = 0; i < this.CurrentPreviewConsent.prntCnt; i++) {
- Dictionary<FOSParameter, string> formParams = Common.CreateGlobalParamsDictionary(consentMain.ConsentExecuteInfo["dutinstcd"]);
- //formGuidList[i] = this.CurrentPreviewConsent.formGuid;
- SetPatientAndUser(formParams);
- //formParams[FOSParameter.OCRCode] = this.CurrentPreviewConsent.Ocrcode = GetOcrCode();
- if(i == 0) {
- formParams[FOSParameter.OCRCode] = this.CurrentPreviewConsent.ocrCode = GetOcrCode();
- if(!reprintStatus) {
- int cnt = hospitalWebService.checkOcrDup(consentMain.ConsentExecuteInfo["dutinstcd"], CurrentPreviewConsent.ocrCode);
- if(cnt > 0) {
- MessageBox.Show("OCRTAG 중복 발생입니다. 환자를 다시 선택하여 주십시요.");
- consentMain.ClearPreviewConsent(true);
- return;
- }
- }
- }
- else {
- var ocrStr = consentWebService.getOcrString(this.CurrentPreviewConsent.formCd,
- consentMain.ConsentExecuteInfo["dutinstcd"]);
- if(ocrStr == null) {
- ocrStr = "[환자 보관용]";
- }
- else {
- ocrStr = (ocrStr.Length < 0) ? "[환자 보관용]" : ocrStr;
- }
- //formParams[FOSParameter.OCRCode] = "[환자 보관용]";
- formParams[FOSParameter.OCRCode] = ocrStr;
- }
- if(string.IsNullOrEmpty(this.CurrentPreviewConsent.ocrCode)) {
- MessageBox.Show("OCRTAG 생성 오류. 전산실에 문의 하세요.");
- consentMain.ClearPreviewConsent(true);
- return;
- }
- 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);
- util.WriteDebug(String.Format("{0}, {1}, {2}, {3}, {4}", formParams[FOSParameter.PrintTime],
- formParams[FOSParameter.OCRCode],
- formParams[FOSParameter.PatientCode],
- CurrentTargetPatient.VisitType,
- CurrentPreviewConsent.consentState ?? "NULL"));
- }
- string fosOcdcd = string.Empty;
- string fos = Common.GetMultiFosString(formGuidList
- , this.consentMain.PluginExecuteInfo["formServiceUrl"]
- , null
- , formParamsList
- , consentMain.ConsentExecuteInfo["dutinstcd"]
- , out fosOcdcd);
- //PC클라이언트에서 프린트 출력을 눌렀을때 출력 데이타 입력 후 출력되게끔
- if(this.consentMain.getPrintButton()) {
- if(!CurrentPreviewConsent.ocrCode.Equals(fosOcdcd)) {
- MessageBox.Show("OCRTAG 설정 오류 발생. 전산실에 문의 하세요.");
- return;
- }
- this.consentMain.setPageCnt(CurrentPreviewConsent.prntCnt);
- SaveDataForPrintedConsent(String.Empty);
- }
- this.consentMain.PrintConsentDocument(fos);
- //util.CloseRoller();
- // 화면 상에 보이는 데로 출력을 원하면 아래 로직 적용
- //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;
- int cnt = hospitalWebService.checkOcrDup(consentMain.ConsentExecuteInfo["dutinstcd"], sOcrCd);
- if(cnt > 0) {
- MessageBox.Show("OCRTAG 중복 발생입니다. 환자를 다시 선택하여 주십시요.");
- consentMain.ClearPreviewConsent(true);
- return;
- }
- }
- else {
- changingFormParams[FOSParameter.OCRCode] = sOcrCd; //OCR코드
- }
- if(string.IsNullOrEmpty(this.CurrentPreviewConsent.ocrCode)) {
- MessageBox.Show("OCRTAG 생성 오류. 전산실에 문의 하세요.");
- consentMain.ClearPreviewConsent(true);
- return;
- }
- 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.pid;
- changingFormParams[FOSParameter.PatientSexAge] = vo.sa;
- changingFormParams[FOSParameter.PatientName] = vo.patientName;
- changingFormParams[FOSParameter.PatientRRN] = vo.juminNo;
- changingFormParams[FOSParameter.PatientRRNOrg] = vo.orgJuminNo;
- changingFormParams[FOSParameter.RoomNo] = vo.ward + "/" + vo.roomCd;
- changingFormParams[FOSParameter.VisitDate] = SetDateFormatting(vo.inDd);
- changingFormParams[FOSParameter.DeptName] = vo.deptEngAbbr;
- changingFormParams[FOSParameter.FormName] = this.CurrentPreviewConsent.formPrintName;
- changingFormParams[FOSParameter.MainDoctor] = vo.mainDrName;
- // dbs227 다중 출력 시 환자 이름을 추가하여 준다
- changingFormParams[FOSParameter.PatientNameFix] = vo.patientName;
- // 출력할 경우 설명 의사와 서명 이미지는 공백 처리
- //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) {
- HospitalSvcRef.SingleReturnData retData = hospitalWebService.GetOcrTag(this.consentMain.ConsentExecuteInfo["dutinstcd"]);
- vo.ocrCd = retData.responseData;
- int cnt = hospitalWebService.checkOcrDup(consentMain.ConsentExecuteInfo["dutinstcd"], vo.ocrCd);
- if(cnt > 0) {
- MessageBox.Show("OCRTAG 중복 발생입니다. 환자를 다시 선택하여 주십시요.");
- consentMain.ClearPreviewConsent(true);
- return;
- }
- changingFormParams[FOSParameter.OCRCode] = vo.ocrCd; //OCR코드
- this.CurrentPreviewConsent.multiOcrcode += vo.ocrCd + "^";
- this.CurrentPreviewConsent.multiMainDrIdCd += vo.mainDrId + "^";
- sOcrCd = vo.ocrCd;
- }
- else {
- changingFormParams[FOSParameter.OCRCode] = sOcrCd; //OCR코드
- }
- if(string.IsNullOrEmpty(sOcrCd)) {
- MessageBox.Show("OCRTAG 생성 오류. 전산실에 문의 하세요.");
- return;
- }
- 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(this, value + " 항목이 누락되었습니다.", Properties.Resources.msg_caption_warn, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- //MessageBoxDlg.Show(false, 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();
- 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;
- }
- public void setCurrentPreviewConsentForm(ConsentFormListVO vo, int orderNo, string inputId, string inputNm) {
- // 현재 preview 할동의서 정보 설정
- CurrentPreviewConsent = new PreviewConsent {
- formId = vo.formId.ToString(),
- //formGuid = vo.formGuid,
- formCd = vo.formCd.ToString(),
- formName = vo.formName,
- formPrintName = vo.formPrintName,
- prntCnt = vo.prntCnt,
- consentMstRid = vo.consentMstRid.ToString(),
- consentState = vo.consentState,
- orderNo = orderNo,
- inputId = inputId,
- inputNm = inputNm,
- ReissueConsentMstRid = 0,
- RewriteConsentMstRid = 0,
- ordType = CurrentTargetPatient.VisitType,
- ocrtagPrntyn = vo.ocrTagYN,
- userDrFlag = vo.userDrFlag,
- printOnly = vo.prntOnly,
- opDiagName = vo.opDiagName,
- drOnly = vo.DrOnly,
- opName = vo.opName
- };
- Dictionary<FOSParameter, string> globalParams = Common.CreateGlobalParamsDictionary(consentMain.ConsentExecuteInfo["dutinstcd"]);
- List<string> formGuids = new List<string> { /* CurrentPreviewConsent.formGuid */};
- SetPatientAndUser(globalParams);
- globalParams[FOSParameter.OCRCode] = string.Empty;
- var ocrBuf = GetOcrCode();
- if (string.IsNullOrEmpty(ocrBuf)) {
- MessageBox.Show("OCR 중복입니다. 다시 환자를 선택하여 주세요.");
- return;
- }
- int cnt = hospitalWebService.checkOcrDup(consentMain.ConsentExecuteInfo["dutinstcd"], ocrBuf);
- if (cnt > 0) {
- MessageBox.Show("OCRTAG 중복 발생입니다. 환자를 다시 선택하여 주십시요.");
- consentMain.ClearPreviewConsent(true);
- return;
- }
- globalParams[FOSParameter.OCRCode] = CurrentPreviewConsent.ocrCode = ocrBuf;
- globalParams[FOSParameter.Device] = "C";
- 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.PrintIp] = consentMain.ConsentExecuteInfo["printIP"];
- if (string.IsNullOrEmpty(CurrentPreviewConsent.ocrCode)) {
- MessageBox.Show("OCRTAG 생성 오류. 전산실에 문의 하세요.");
- consentMain.ClearPreviewConsent(true);
- return;
- }
- string fos = Common.GetFosString(formGuids
- , consentMain.PluginExecuteInfo["formServiceUrl"]
- , globalParams
- , null
- , consentMain.ConsentExecuteInfo["dutinstcd"]);
- SetEnableButtonsByCurrentConsent();
- consentMain.PreviewConsent(fos);
- RunConsentDualView();
- SetEnableConsentIssueCommands(true);
- }
- public void setToolstripEnabled(bool isEnabled)
- {
- this.toolStripButtonFirstPage.Enabled = isEnabled;//
- this.toolStripButtonPrevPage.Enabled = isEnabled;
- this.toolStripButtonNextPage.Enabled = isEnabled;
- this.toolStripButtonLastPage.Enabled = isEnabled;
- this.toolStripTextBoxPageIndex.Enabled = isEnabled;//페이지번호 보여주는부분 total page
- this.toolStripLabelTotalPages.Enabled = isEnabled;//
- this.toolStripTextBoxPageIndex.Text = consentMain.GetCurrentPageIndex().ToString();
- this.toolStripLabelTotalPages.Text = consentMain.GetTotalPageCount().ToString();
- this.toolStripComboBoxZoom.Enabled = isEnabled;//넓이 맞춤 서식 폭 조정
- this.toolStripButtonDeleteAllSignData.Enabled = isEnabled;//그림그린거 다없앤거
- }
- /// <summary>
- /// 다중서식 실행시 듀얼뷰어를 실행시켰을 때 버튼 설정
- /// </summary>
- public void setMultiParamsDualViewrStripButton()
- {
- // 전자동의서 실행 버튼
- this.toolStripButtonExecute.Enabled = false;
- // 출력 버튼
- this.toolStripButtonPrint.Enabled = true;
-
- if (this.CurrentPreviewConsent != null && this.CurrentPreviewConsent.outputType != null)
- {
- if (this.CurrentPreviewConsent.outputType.Equals("ELECTRONIC"))
- {
- this.toolStripButtonPrint.Enabled = false;
- }
- }
- // Dual Viewer 닫기 버튼
- this.toolStripButtonCloseDualViewer.Visible = true;
- SetEnableByUserType();
- base.SetEnablementExecuteWhenDualViewerActive(true);
- }
- }
- }
|