ConsentCommandCtrl.cs 146 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285
  1. #region Copyright ⓒ 2015 CLIPSOFT Co.,Ltd. All Rights Reserved.
  2. //
  3. // All rights are reserved. Reproduction or transmission in whole or in part,
  4. // in any form or by any means, electronic, mechanical or otherwise, is
  5. // prohibited without the prior written consent of the copyright owner.
  6. //
  7. // Filename:ConsentCommandCtrl.cs
  8. //
  9. #endregion
  10. using System;
  11. using System.ComponentModel;
  12. using System.Collections.Generic;
  13. using System.Windows.Forms;
  14. using System.IO;
  15. using System.Net;
  16. using System.Xml;
  17. using System.Drawing;
  18. using System.Security.Cryptography;
  19. using CLIP.eForm.Consent.UI.ConsentSvcRef;
  20. using CLIP.eForm.Consent.UI.HospitalSvcRef;
  21. using ClipSoft.eForm.Base.Dialog;
  22. using static CLIP.eForm.Consent.UI.Common;
  23. using ConsentFormListVO = CLIP.eForm.Consent.UI.ConsentSvcRef.ConsentFormListVO;
  24. using SingleReturnData = CLIP.eForm.Consent.UI.ConsentSvcRef.SingleReturnData;
  25. namespace CLIP.eForm.Consent.UI {
  26. /// <summary>
  27. /// 출력, 전자동의서 실행 버튼 클래스
  28. /// </summary>
  29. /// <remarks>
  30. /// <p>[설계자]</p>
  31. /// <p> 클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)</p>
  32. /// <p>[원본 작성자]</p>
  33. /// <p> 클립소프트 기술부 이창훈 (chlee@clipsoft.co.kr)</p>
  34. /// <p>[수정 작성자]</p>
  35. /// <p> 클립소프트 기술부 이인희</p>
  36. /// <p>----------------------------------------------------------------------------------------</p>
  37. /// <p>[HISTORY]</p>
  38. /// <p> 2016-06-21 : 최초작성</p>
  39. /// <p>----------------------------------------------------------------------------------------</p>
  40. /// </remarks>
  41. public partial class ConsentCommandCtrl : ConsentCommandCtrlBase {
  42. private PreviewConsent currentPreviewConsent = null;
  43. private TargetPatient currentTargetPatient = null;
  44. private EndUser currentEndUser = null;
  45. private IConsentMain consentMain = null;
  46. private ConsentSvcRef.ConsentSvcSoapClient consentWebService = null;
  47. private HospitalSvcRef.HospitalSvcSoapClient hospitalWebService = null;
  48. private string exportedImageFiles = string.Empty;
  49. private string exportedImageFilesJson = string.Empty;
  50. System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConsentCommandCtrl));
  51. private bool m_IsComplete = false;
  52. public bool IsComplete => m_IsComplete;
  53. public ConsentCommandCtrl() {
  54. InitializeComponent();
  55. }
  56. public override bool EnableRedo {
  57. get {
  58. return base.EnableRedo;
  59. }
  60. set {
  61. base.EnableRedo = value;
  62. this.toolStripButtonRedo.Enabled = base.EnableRedo;
  63. }
  64. }
  65. public override bool reprintStatus {
  66. get {
  67. return base.reprintStatus;
  68. }
  69. set {
  70. base.reprintStatus = value;
  71. }
  72. }
  73. public override bool EnableUndo {
  74. get {
  75. return base.EnableUndo;
  76. }
  77. set {
  78. base.EnableUndo = value;
  79. this.toolStripButtonUndo.Enabled = base.EnableUndo;
  80. }
  81. }
  82. public override bool EnableRemoveAll {
  83. get {
  84. return base.EnableRemoveAll;
  85. }
  86. set {
  87. base.EnableRemoveAll = value;
  88. this.toolStripButtonDelAllDraw.Enabled = base.EnableRemoveAll;
  89. }
  90. }
  91. public override bool EnablePenDrawing {
  92. get {
  93. return base.EnableRemoveAll;
  94. }
  95. set {
  96. base.EnablePenDrawing = value;
  97. this.toolStripButtonPen.Enabled = base.EnablePenDrawing;
  98. }
  99. }
  100. public override bool EnablePenConfig {
  101. get {
  102. return base.EnablePenConfig;
  103. }
  104. set {
  105. base.EnablePenConfig = value;
  106. this.toolStripButtonPenConfig.Enabled = base.EnablePenConfig;
  107. }
  108. }
  109. public PreviewConsent CurrentPreviewConsent {
  110. get {
  111. return currentPreviewConsent;
  112. }
  113. set {
  114. currentPreviewConsent = value;
  115. }
  116. }
  117. public TargetPatient CurrentTargetPatient {
  118. get {
  119. return currentTargetPatient;
  120. }
  121. set {
  122. currentTargetPatient = value;
  123. }
  124. }
  125. public EndUser CurrentEndUser {
  126. get {
  127. return currentEndUser;
  128. }
  129. set {
  130. currentEndUser = value;
  131. }
  132. }
  133. /// <summary>
  134. /// 임시저장 버튼 클릭 활성화 여부 반환
  135. /// </summary>
  136. /// <returns></returns>
  137. public override bool getTempSaveButton() {
  138. return this.toolStripButtonTempSaveToServer.Enabled;
  139. }
  140. /// <summary>
  141. /// 저장 버튼 클릭 활성화 여부 반환
  142. /// </summary>
  143. /// <returns></returns>
  144. public override bool getSaveButton() {
  145. return this.toolStripButtonSaveToServer.Enabled;
  146. }
  147. public override void setTempSaveButton(bool enabled) {
  148. this.toolStripButtonTempSaveToServer.Enabled = enabled;
  149. }
  150. public override void setSaveButton(bool enabled) {
  151. this.toolStripButtonSaveToServer.Enabled = enabled;
  152. }
  153. public void setZoomRate(int rate) {
  154. toolStripComboBoxZoom.SelectedIndex = rate;
  155. toolStripComboBoxZoom.Enabled = true; // zoom rate
  156. toolStripButtonPrevPage.Enabled = true; // 이전 페이지
  157. toolStripButtonNextPage.Enabled = true; // 다음 페이지
  158. toolStripTextBoxPageIndex.Enabled = true; // 페이지 인덱스
  159. toolStripLabelTotalPages.Enabled = true;
  160. toolStripButtonFirstPage.Enabled = true; // 처음 페이지
  161. toolStripButtonLastPage.Enabled = true; // 마지막페이지
  162. toolStripTextBoxPageIndex.Text = consentMain.GetCurrentPageIndex().ToString();
  163. toolStripLabelTotalPages.Text = consentMain.GetTotalPageCount().ToString();
  164. }
  165. public override void setCompleteSaveButton(bool enabled) {
  166. this.toolStripButtonCompleteSaveToServer.Enabled = enabled;
  167. }
  168. protected override void OnLoad(EventArgs e) {
  169. base.OnLoad(e);
  170. if(this.DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime) {
  171. return;
  172. }
  173. if(!ConsentMainControl.HasVerticalMonitor) {
  174. this.toolStripButtonExecute.Visible = false;
  175. }
  176. else {
  177. this.toolStripButtonExecute.Visible = true;
  178. }
  179. this.consentMain = ConsentMainControl.GetConsentMainInterface(this);
  180. this.consentWebService = WebMethodCommon.GetConsentWebService(consentMain.PluginExecuteInfo["consentSvcUrl"]);
  181. this.hospitalWebService = WebMethodCommon.GetHospitalWebService(consentMain.PluginExecuteInfo["hospitalSvcUrl"]);
  182. InitZoomRateDropdownItems();
  183. this.consentMain.OnLoadPartControls += ConsentMain_OnLoadPartControls;
  184. this.toolStripButtons.MouseEnter += ToolStripButtons_MouseEnter;
  185. }
  186. private void ConsentMain_OnLoadPartControls(object sender, EventArgs e) {
  187. this.consentMain.OnVisibleEFormControl += ConsentMain_OnVisibleEFormControl;
  188. this.consentMain.OnInvisibleEFormControl += ConsentMain_OnInvisibleEFormControl;
  189. }
  190. private void ConsentMain_OnInvisibleEFormControl(object sender, EventArgs e) {
  191. this.consentMain.ConsentCommandCtrl.Enabled = false;
  192. }
  193. private void ConsentMain_OnVisibleEFormControl(object sender, EventArgs e) {
  194. this.consentMain.ConsentCommandCtrl.Enabled = true;
  195. }
  196. private void InitZoomRateDropdownItems() {
  197. // 콤보 박스에 저장되는 형식을 ArrayList 로 바꿈
  198. List<ZoomRateDropdownItem> zoomRateList = new List<ZoomRateDropdownItem>();
  199. zoomRateList.Add(new ZoomRateDropdownItem("50%", "50"));
  200. zoomRateList.Add(new ZoomRateDropdownItem("75%", "75"));
  201. zoomRateList.Add(new ZoomRateDropdownItem("100%", "100"));
  202. zoomRateList.Add(new ZoomRateDropdownItem("200%", "200"));
  203. zoomRateList.Add(new ZoomRateDropdownItem("창 너비에 맞춤", "pagewidth"));
  204. zoomRateList.Add(new ZoomRateDropdownItem("창 크기에 맞춤", "wholepage"));
  205. toolStripComboBoxZoom.Items.AddRange(zoomRateList.ToArray());
  206. }
  207. #region toolStripButton 이벤트
  208. private void ToolStripButtons_MouseEnter(object sender, EventArgs e) {
  209. this.toolStripButtons.Focus();
  210. }
  211. /// <summary>
  212. /// 처음 페이지로 이동 버튼 클릭 이벤트
  213. /// </summary>
  214. /// <param name="sender">The source of the event.</param>
  215. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  216. private void toolStripButtonFirstPage_Click(object sender, EventArgs e) {
  217. this.consentMain.MoveFirstPage();
  218. }
  219. /// <summary>
  220. /// 이전 페이지로 이동 버튼 클릭 이벤트
  221. /// </summary>
  222. /// <param name="sender">The source of the event.</param>
  223. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  224. private void toolStripButtonPrevPage_Click(object sender, EventArgs e) {
  225. this.consentMain.MovePrevPage();
  226. }
  227. /// <summary>
  228. /// 다음 페이지 이동 버튼 클릭 이벤트
  229. /// </summary>
  230. /// <param name="sender">The source of the event.</param>
  231. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  232. private void toolStripButtonNextPage_Click(object sender, EventArgs e) {
  233. this.consentMain.MoveNextPage();
  234. }
  235. /// <summary>
  236. /// 마지막 페이지로 이동 버튼 클릭 이벤트
  237. /// </summary>
  238. /// <param name="sender">The source of the event.</param>
  239. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  240. private void toolStripButtonLastPage_Click(object sender, EventArgs e) {
  241. this.consentMain.MoveLastPage();
  242. }
  243. /// <summary>
  244. /// toolStripTextBoxPageIndex 텍스트 변경 이벤트
  245. /// </summary>
  246. /// <param name="sender">The source of the event.</param>
  247. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  248. private void toolStripTextBoxPageIndex_TextChanged(object sender, EventArgs e) {
  249. if(!string.IsNullOrEmpty(this.toolStripTextBoxPageIndex.Text)) {
  250. bool currentIndexParseResult;
  251. int currentIndex = 0;
  252. currentIndexParseResult = int.TryParse(this.toolStripTextBoxPageIndex.Text, out currentIndex);
  253. bool totalIndexParseResult;
  254. int totalIndex = 0;
  255. totalIndexParseResult = int.TryParse(this.toolStripTextBoxPageIndex.Text, out totalIndex);
  256. if(currentIndexParseResult == false || totalIndexParseResult == false) {
  257. return;
  258. }
  259. if(currentIndex > totalIndex) {
  260. }
  261. // 입력한 페이지수가 전체 페이지 이하일 경우 해당 페이지로 이동
  262. else {
  263. this.consentMain.MoveToPageIndex(currentIndex);
  264. }
  265. }
  266. }
  267. /// <summary>
  268. /// 동의서 확대비율 지정 콤보 박스 변경 이벤트
  269. /// </summary>
  270. /// <param name="sender">The source of the event.</param>
  271. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  272. private void toolStripComboBoxZoom_SelectedIndexChanged(object sender, EventArgs e) {
  273. ZoomRateDropdownItem zoomRateItem = this.toolStripComboBoxZoom.SelectedItem as ZoomRateDropdownItem;
  274. if(zoomRateItem == null) {
  275. }
  276. else {
  277. this.consentMain.SetZoomRate(zoomRateItem.ItemValue);
  278. }
  279. }
  280. private void setCurrentPreviewConsent(ConsentFormListVO vo, int orderNo, string inputId, string inputNm) {
  281. // 현재 preview 할동의서 정보 설정
  282. CurrentPreviewConsent = new PreviewConsent {
  283. formRid = vo.formRid.ToString(),
  284. formGuid = vo.formGuid,
  285. formCd = vo.formCd.ToString(),
  286. FormName = vo.formName,
  287. formPrintName = vo.formPrntNm,
  288. prntCnt = vo.printCnt,
  289. consentMstRid = "-1",
  290. consentState = string.Empty,
  291. orderNo = orderNo,
  292. inputId = inputId,
  293. inputNm = inputNm,
  294. ReissueConsentMstRid = 0,
  295. RewriteConsentMstRid = 0,
  296. ordType = CurrentTargetPatient.VisitType,
  297. ocrtagPrntyn = vo.ocrTagPrntYn,
  298. userDrFlag = vo.userDrFlag,
  299. printOnly = vo.printOnly,
  300. opDiagName = vo.opDiagNm,
  301. drOnly = vo.DrOnly,
  302. opName = vo.opNm
  303. };
  304. Dictionary<FOSParameter, string> globalParams = Common.CreateGlobalParamsDictionary(consentMain.ConsentExecuteInfo["dutinstcd"]);
  305. List<string> formGuids = new List<string> { CurrentPreviewConsent.formGuid };
  306. SetPatientAndUser(globalParams);
  307. globalParams[FOSParameter.OCRCode] = string.Empty;
  308. var ocrBuf = GetOcrCode();
  309. if(string.IsNullOrEmpty(ocrBuf)) {
  310. MessageBox.Show("OCR 중복입니다. 다시 환자를 선택하여 주세요.");
  311. return;
  312. }
  313. int cnt = hospitalWebService.checkOcrDup(consentMain.ConsentExecuteInfo["dutinstcd"], ocrBuf);
  314. if(cnt > 0) {
  315. MessageBox.Show("OCRTAG 중복 발생입니다. 환자를 다시 선택하여 주십시요.");
  316. consentMain.ClearPreviewConsent(true);
  317. return;
  318. }
  319. globalParams[FOSParameter.OCRCode] = CurrentPreviewConsent.ocrCode = ocrBuf;
  320. globalParams[FOSParameter.Device] = "P";
  321. globalParams[FOSParameter.PrintTime] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  322. globalParams[FOSParameter.SignTime] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  323. globalParams[FOSParameter.PrintIp] = consentMain.ConsentExecuteInfo["printIP"];
  324. if(string.IsNullOrEmpty(CurrentPreviewConsent.ocrCode)) {
  325. MessageBox.Show("OCRTAG 생성 오류. 전산실에 문의 하세요.");
  326. consentMain.ClearPreviewConsent(true);
  327. return;
  328. }
  329. CLIP.eForm.Consent.UI.HospitalSvcRef.SingleReturnData retVal = hospitalWebService.getEmrDataString(
  330. "A01"
  331. , this.CurrentTargetPatient.HosType
  332. , this.CurrentTargetPatient.PatientCode
  333. , this.CurrentTargetPatient.clnDate
  334. , this.CurrentTargetPatient.cretno
  335. , this.CurrentPreviewConsent.formCd);
  336. globalParams[FOSParameter.emrinfo] = retVal.responseData;
  337. string fos = Common.GetFosString(formGuids
  338. , consentMain.PluginExecuteInfo["formServiceUrl"]
  339. , globalParams
  340. , null
  341. , consentMain.ConsentExecuteInfo["dutinstcd"]);
  342. SetEnableButtonsByCurrentConsent();
  343. consentMain.PreviewConsent(fos);
  344. }
  345. /// <summary>
  346. /// 출력 버튼 클릭 이벤트
  347. /// </summary>
  348. /// <param name="sender">The source of the event.</param>
  349. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  350. private void toolStripButtonPrint_Click(object sender, EventArgs e) {
  351. // dbs227, 현재 동의서 상태가 null 이라면 skip
  352. if(CurrentPreviewConsent == null) {
  353. SetEnableButtonsByCurrentConsent();
  354. return;
  355. }
  356. int cnt = hospitalWebService.checkOcrDup(consentMain.ConsentExecuteInfo["dutinstcd"], CurrentPreviewConsent.ocrCode);
  357. if(cnt > 0) {
  358. MessageBox.Show("OCRTAG 중복 발생입니다. 환자를 다시 선택하여 주십시요.");
  359. consentMain.ClearPreviewConsent(true);
  360. return;
  361. }
  362. // 경북대학교병원 요청사항 출력 제어
  363. string printControlMsg = string.Empty;
  364. string printOnly = string.Empty;
  365. printOnly = hospitalWebService.getPrintOnly(consentMain.ConsentExecuteInfo["dutinstcd"], CurrentPreviewConsent.formCd);
  366. printControlMsg = hospitalWebService.getPrintControlMsg(consentMain.ConsentExecuteInfo["dutinstcd"], CurrentTargetPatient.VisitType.ToUpper());
  367. // 6961 [전자동의서]출력시 특정 진찰료 면제사유시 제어 switch
  368. var runCount = hospitalWebService.checkHardcd(consentMain.ConsentExecuteInfo["dutinstcd"], "6961", "Y");
  369. var runCount2 = hospitalWebService.checkHardcd(consentMain.ConsentExecuteInfo["dutinstcd"], "6952", CurrentPreviewConsent.formCd);
  370. // 출력 전용 서식이 아닐 경우 출력 제한을 한다.
  371. if(!string.IsNullOrEmpty(printOnly) && printOnly.Equals("N")) {
  372. if(!string.IsNullOrEmpty(printControlMsg) && runCount2 < 1) {
  373. MessageBox.Show(printControlMsg);
  374. return;
  375. }
  376. }
  377. var count = hospitalWebService.checkPrintablePatient(consentMain.ConsentExecuteInfo["dutinstcd"],
  378. consentMain.ConsentExecuteInfo["patientNo"],
  379. consentMain.ConsentExecuteInfo["clnDate"],
  380. consentMain.ConsentExecuteInfo["cretno"]);
  381. // 6961 [전자동의서]출력시 특정 진찰료 면제사유시 제어 switch
  382. //var runCount = hospitalWebService.checkHardcd(consentMain.ConsentExecuteInfo["dutinstcd"], "6961", "Y");
  383. //var runCount2 = hospitalWebService.checkHardcd(consentMain.ConsentExecuteInfo["dutinstcd"], "6952", CurrentPreviewConsent.FormCd);
  384. // 해당 기준자료가 설정 되었다면 아래기능 호출
  385. if(runCount > 0) {
  386. if(count > 0) {
  387. MessageBox.Show("출력할 수 없는 수진이력입니다.\n(문의: 의무기록팀)", "확인", MessageBoxButtons.OK);
  388. return;
  389. }
  390. }
  391. if(CurrentPreviewConsent.consentState.ToUpper().Equals("UNFINISHED") || CurrentPreviewConsent.consentState.ToUpper().Equals("TEMP")) {
  392. MessageBox.Show(string.Format(Properties.Resources.msg_cannot_print_temp_doc)
  393. , string.Format(Properties.Resources.title_info),
  394. MessageBoxButtons.OK, MessageBoxIcon.Information);
  395. return;
  396. }
  397. this.consentMain.setPrintButton(true);
  398. // 진정동의서 출력 서식 확인
  399. int result = this.consentWebService.checkJinJeongDocument(consentMain.ConsentExecuteInfo["dutinstcd"], currentPreviewConsent.formCd);
  400. if(result > 0) {
  401. // 진정동의서를 출력 해야 한다.
  402. this.CurrentPreviewConsent.linkFormCd = "1100010977";
  403. }
  404. // 연계 서식이 없다면 기존 출력 루틴으로 출력
  405. if(/*this.CurrentPreviewConsent.linkFormCd == null || */string.IsNullOrEmpty(this.CurrentPreviewConsent.linkFormCd)) {
  406. PrintConsent();
  407. if (consentMain.multiParams == null)
  408. {
  409. consentMain.ClearPreviewConsent(true);
  410. }
  411. else
  412. {
  413. consentMain.showNextPreview();
  414. }
  415. }
  416. // 연계 서식이 있다면
  417. else {
  418. // 기관별 마취 동의서 서식 코드를 조회 한다
  419. String anstFormCd = this.consentWebService.getLinkedAnstDocument(consentMain.ConsentExecuteInfo["dutinstcd"]);
  420. if(anstFormCd == null && this.currentPreviewConsent.linkFormCd.Equals("1100010977")) {
  421. // 마취동의서 코드를 찾지 못하면 메시지 박스를 보여준다
  422. MessageBox.Show("기준자료 오류, 전산실에 문의하세요", "경고", MessageBoxButtons.OK, MessageBoxIcon.Information);
  423. return;
  424. }
  425. // 마취 동의서 라면
  426. if(this.CurrentPreviewConsent.linkFormCd.Equals(anstFormCd)) {
  427. // 출력 후 연계서식 정보 초기화되기 때문에 미리 값을 저장 해 둔다
  428. var linkFormCd = this.CurrentPreviewConsent.linkFormCd;
  429. var orderNo = this.CurrentPreviewConsent.orderNo;
  430. var inputNm = this.CurrentPreviewConsent.inputNm;
  431. var inputId = this.CurrentPreviewConsent.inputId;
  432. MessageBox.Show(string.Format(Properties.Resources.msg_info_anes_docu_print)
  433. , string.Format(Properties.Resources.title_info),
  434. MessageBoxButtons.OK, MessageBoxIcon.Information);
  435. // 선택된 동의서 출력
  436. PrintConsent();
  437. // 연계 동의서 출력
  438. //ConsentFormListVO[] voArr = this.consentWebService.GetConsentByFormcd(linkFormCd, consentMain.ConsentExecuteInfo["dutinstcd"]);
  439. ConsentFormListVO vo = this.consentWebService.GetConsentByFormcd(linkFormCd, consentMain.ConsentExecuteInfo["dutinstcd"]);
  440. // 조회된 서식이 없다면 출력 하지 않음
  441. if(vo == null) {
  442. return;
  443. }
  444. //setCurrentPreviewConsent(voArr[0], orderNo, inputId, inputNm);
  445. setCurrentPreviewConsent(vo, orderNo, inputId, inputNm);
  446. consentMain.setPrintButton(true);
  447. // 프린트 한다
  448. PrintConsent();
  449. }
  450. // 진정동의서 출력 해야 되는 경우라면
  451. else if(this.currentPreviewConsent.linkFormCd.Equals("1100010977")) {
  452. DialogResult clickResult = MessageBox.Show(string.Format(Properties.Resources.msg_jinjeong)
  453. , string.Format(Properties.Resources.title_jinjeong),
  454. MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information);
  455. switch(clickResult) {
  456. case DialogResult.Yes: {
  457. // 출력 후 연계서식 정보 초기화되기 때문에 미리 값을 저장 해 둔다
  458. var linkFormCd = this.CurrentPreviewConsent.linkFormCd;
  459. var orderNo = this.CurrentPreviewConsent.orderNo;
  460. var inputNm = this.CurrentPreviewConsent.inputNm;
  461. var inputId = this.CurrentPreviewConsent.inputId;
  462. // 선택된 동의서 출력
  463. PrintConsent();
  464. // 연계 동의서 출력
  465. //ConsentBySearchVO[] voArr = this.consentWebService.GetConsentByFormcd(linkFormCd, consentMain.ConsentExecuteInfo["dutinstcd"]);
  466. ConsentFormListVO vo = this.consentWebService.GetConsentByFormcd(linkFormCd, consentMain.ConsentExecuteInfo["dutinstcd"]);
  467. // 조회된 서식이 없다면 출력 하지 않음
  468. if(vo == null) {
  469. return;
  470. }
  471. setCurrentPreviewConsent(vo, orderNo, inputId, inputNm);
  472. consentMain.setPrintButton(true);
  473. // 프린트 한다
  474. PrintConsent();
  475. }
  476. break;
  477. case DialogResult.No: {
  478. // 선택된 동의서만 프린트
  479. PrintConsent();
  480. }
  481. break;
  482. case DialogResult.Cancel:
  483. // do nothing
  484. break;
  485. }
  486. }
  487. if (consentMain.multiParams == null)
  488. {
  489. // 출력을 다 하였으면 화면을 닫는다.
  490. consentMain.ClearPreviewConsent(true);
  491. }
  492. else
  493. {
  494. consentMain.showNextPreview();
  495. }
  496. }
  497. }
  498. /// <summary>
  499. /// 동의서 닫기 버튼 클릭 이벤트
  500. /// </summary>
  501. /// <param name="sender">The source of the event.</param>
  502. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  503. private void toolStripButtonCloseDualViewer_Click(object sender, EventArgs e) {
  504. this.consentMain.CloseDualViewer();
  505. }
  506. /// <summary>
  507. /// 임시저장 버튼 클릭 이벤트
  508. /// </summary>
  509. /// <param name="sender">The source of the event.</param>
  510. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  511. private void toolStripButtonTempSaveToServer_Click(object sender, EventArgs e) {
  512. // 동의서 임시 저장
  513. this.consentMain.TempSave();
  514. }
  515. /// <summary>
  516. /// 서명 버튼 클릭 이벤트
  517. /// </summary>
  518. /// <param name="sender">The source of the event.</param>
  519. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  520. private void toolStripButtonSaveToServer_Click(object sender, EventArgs e) {
  521. // dbs227, 현재 동의서 상태가 null 이라면 skip
  522. if(CurrentPreviewConsent == null) {
  523. SetEnableButtonsByCurrentConsent();
  524. return;
  525. }
  526. // 로그인 사용자와 동의서 작성자가 다르면 인증 저장 제한
  527. if(!CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03") && !CurrentPreviewConsent.inputId.Equals(consentMain.ConsentExecuteInfo["loginUserNo"])) {
  528. MessageBox.Show("작성자만 인증 저장이 가능합니다.", "인증 저장 불가", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  529. return;
  530. }
  531. if(!CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03") && CurrentPreviewConsent.drOnly.ToUpper().Equals("Y")) {
  532. MessageBox.Show("의사만 인증저장 가능한 동의서 입니다.\n문의:보건의료정보관리(의무기록)팀", "인증 저장 불가", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  533. return;
  534. }
  535. this.consentMain.saveClickPoint = true;
  536. this.consentMain.Save();
  537. this.consentMain.saveClickPoint = false;
  538. //저장 후 로그인 사용자를 현재endUser로 세팅
  539. consentMain.SetConsentUserInfo(consentMain.ConsentExecuteInfo["dutinstcd"]
  540. , consentMain.ConsentExecuteInfo["loginUserNo"]
  541. , consentMain.ConsentExecuteInfo["userDeptCd"]);
  542. }
  543. /// <summary>
  544. /// 확인 저장 버튼 클릭 이벤트
  545. /// </summary>
  546. /// <param name="sender">The source of the event.</param>
  547. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  548. private void toolStripButtonCompleteSaveToServer_Click(object sender, EventArgs e) {
  549. if (this.consentWebService.getCertUseYn(this.currentPreviewConsent.formCd,
  550. consentMain.ConsentExecuteInfo["dutinstcd"]) == "Y")
  551. {
  552. MessageBox.Show("인증서가 필요없는 서식은 [확인저장] 할 수 없습니다.\r[인증저장] 으로 진행하시기 바랍니다.");
  553. return;
  554. }
  555. m_IsComplete = true;
  556. this.consentMain.Save();
  557. m_IsComplete = false;
  558. }
  559. /// <summary>
  560. /// 전자동의서 실행 버튼 클릭 이벤트
  561. /// </summary>
  562. /// <param name="sender">The source of the event.</param>
  563. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  564. private void toolStripButtonExecute_Click(object sender, EventArgs e) {
  565. RunConsentDualView();
  566. }
  567. /// <summary>
  568. /// 펜 그리기 모드 활성화/비활성화 버튼 클릭 이벤트
  569. /// </summary>
  570. /// <param name="sender">The source of the event.</param>
  571. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  572. private void toolStripButtonPen_Click(object sender, EventArgs e) {
  573. bool isDrawMode = this.consentMain.IsDrawMode();
  574. this.consentMain.EnableDrawing(!isDrawMode);
  575. this.toolStripButtonPen.Checked = !isDrawMode;
  576. }
  577. /// <summary>
  578. /// 그리기 펜 설정 버튼 클릭 이벤트
  579. /// </summary>
  580. /// <param name="sender">The source of the event.</param>
  581. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  582. private void toolStripButtonPenConfig_Click(object sender, EventArgs e) {
  583. // 펜 색상 및 두께 변경
  584. this.consentMain.ConfigDrawingPen();
  585. }
  586. /// <summary>
  587. /// 펜 그리기 데이터 모두 삭제 버튼 클릭 이벤트
  588. /// </summary>
  589. /// <param name="sender">The source of the event.</param>
  590. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  591. private void toolStripButtonDelAllDraw_Click(object sender, EventArgs e) {
  592. this.consentMain.RemoveAllDrawing();
  593. }
  594. /// <summary>
  595. /// 펜 그리기 undo 버튼 클릭 이벤트
  596. /// </summary>
  597. /// <param name="sender">The source of the event.</param>
  598. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  599. private void toolStripButtonUndo_Click(object sender, EventArgs e) {
  600. this.consentMain.UndoDrawing();
  601. }
  602. /// <summary>
  603. /// 펜 그리기 redo 버튼 클릭 이벤트
  604. /// </summary>
  605. /// <param name="sender">The source of the event.</param>
  606. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  607. private void toolStripButtonRedo_Click(object sender, EventArgs e) {
  608. this.consentMain.RedoDrawing();
  609. }
  610. #endregion
  611. /// <summary>
  612. /// 페지 변경시 이벤트
  613. /// 외부에서 호출하는 메서드
  614. /// </summary>
  615. /// <param name="currentPageIndex">Index of the current page.</param>
  616. public override void OnPaging(int currentPageIndex) {
  617. this.toolStripTextBoxPageIndex.Text = currentPageIndex.ToString();
  618. }
  619. /// <summary>
  620. /// 동의서 종이 출력
  621. /// </summary>
  622. /// <param name="value"></param>
  623. public override void OnPrint(string value) {
  624. Cursor currentCursor = this.Cursor;
  625. try {
  626. this.Cursor = Cursors.WaitCursor;
  627. SaveDataForPrintedConsent(string.Empty);
  628. // dbs227, 경대병원 프린트 연동 로그 추후 기록
  629. // 기존 저장 루틴 위치 변경
  630. //SaveDataForPrintedConsent(string.Empty);
  631. // 출력 카운트만큼 출력 된 후 처리
  632. /*
  633. if (this.consentMain.printSaveStatus) {
  634. if (consentMain.ConsentExecuteInfo["printAct"].Equals("N")) {
  635. //MessageBox.Show(string.Format(Properties.Resources.msg_temp_print_confirm)
  636. // , string.Format(Properties.Resources.msg_caption_confirm), MessageBoxButtons.OK, MessageBoxIcon.Information);
  637. //출력후에는 전체목록 탭이 선택되게 한다.
  638. this.consentMain.ConsentListCtrl.InquiryConsentData(-2);
  639. } else {
  640. //agent 구동시 바로 출력을 하는 경우 미작성 탭이 선택되게 한다.
  641. this.consentMain.ConsentListCtrl.InquiryConsentData(9);
  642. }
  643. //Agent에서 출력요청한 내용이 모두 끝나면 창을 닫는다.
  644. if (consentMain.ConsentExecuteInfo["printAct"].Equals("Y")) {
  645. this.consentMain.agentCallPrintCnt--;
  646. if (this.consentMain.agentCallPrintCnt == 0) {
  647. this.consentMain.Parent_Disposed();
  648. }
  649. }
  650. }
  651. */
  652. }
  653. catch(Exception ex) {
  654. throw ex;
  655. }
  656. finally {
  657. this.Cursor = currentCursor;
  658. // dbs227 저장이 끝나면 preview 객체를 초기화 하여 준다
  659. CurrentPreviewConsent = null;
  660. }
  661. base.OnPrint(value);
  662. }
  663. /// <summary>
  664. /// 동의서 동의서 미리보기 상태 활성화 처리
  665. /// </summary>
  666. /// <param name="isIssuable"></param>
  667. public override void SetEnableConsentIssueCommands(bool isIssuable) {
  668. this.toolStripButtonPrint.Enabled = isIssuable;//프린트
  669. this.toolStripButtonExecute.Enabled = isIssuable;//아큐실행버튼
  670. this.toolStripButtonFirstPage.Enabled = isIssuable;//
  671. this.toolStripButtonPrevPage.Enabled = isIssuable;
  672. this.toolStripButtonNextPage.Enabled = isIssuable;
  673. this.toolStripButtonLastPage.Enabled = isIssuable;
  674. this.toolStripTextBoxPageIndex.Enabled = isIssuable;//페이지번호 보여주는부분 total page
  675. this.toolStripLabelTotalPages.Enabled = isIssuable;//
  676. this.toolStripTextBoxPageIndex.Text = consentMain.GetCurrentPageIndex().ToString();
  677. this.toolStripLabelTotalPages.Text = consentMain.GetTotalPageCount().ToString();
  678. this.toolStripComboBoxZoom.Enabled = isIssuable;//넓이 맞춤 서식 폭 조정
  679. this.toolStripButtonDeleteAllSignData.Enabled = isIssuable;//그림그린거 다없앤거
  680. this.toolStripButtonInsertAttach.Enabled = isIssuable;//첨지
  681. this.toolStripButtonDeleteAttach.Enabled = isIssuable;//첨지삭제
  682. //this.toolStripButtonSaveToServer.Enabled = isIssuable; // 인증 저장
  683. //this.toolStripButtonTempSaveToServer.Enabled = isIssuable; // 임시 저장
  684. //this.toolStripButtonCompleteSaveToServer.Enabled = isIssuable; // 완료 저장
  685. }
  686. /// <summary>
  687. /// 동의서 상태에 따라 버튼들 활성화를 조절한다
  688. /// </summary>
  689. public override void SetEnableButtonsByCurrentConsent() {
  690. string state = string.Empty;
  691. if(this.CurrentPreviewConsent != null) {
  692. state = this.CurrentPreviewConsent.consentState;
  693. }
  694. if(this.CurrentTargetPatient != null && !string.IsNullOrEmpty(this.CurrentTargetPatient.PatientCode)
  695. && CurrentPreviewConsent != null) {
  696. if(!ConsentMainControl.HasVerticalMonitor) {
  697. this.toolStripButtonTempSaveToServer.Enabled = true;
  698. this.toolStripButtonSaveToServer.Enabled = true;
  699. //this.toolStripButtonCompleteSaveToServer.Enabled = true;
  700. this.toolStripButtonPrint.Enabled = true;
  701. SetEnableButtonsByConsentStateForSingleView(state);
  702. this.EnablePenDrawing = true;
  703. this.EnablePenConfig = true;
  704. }
  705. else {
  706. //this.toolStripButtonCompleteSaveToServer.Enabled = true;
  707. this.toolStripButtonSaveToServer.Enabled = true;
  708. this.toolStripButtonExecute.Enabled = true;
  709. this.toolStripButtonPrint.Enabled = true;
  710. SetEnableButtonsByConsentStateForDualView(state);
  711. }
  712. this.toolStripButtonDelAllDraw.Enabled = true;
  713. this.toolStripButtonRedo.Enabled = true;
  714. this.toolStripButtonUndo.Enabled = true;
  715. }
  716. else {
  717. this.toolStripButtonPrint.Enabled = false;
  718. this.toolStripButtonTempSaveToServer.Enabled = false;
  719. //this.toolStripButtonCompleteSaveToServer.Enabled = false;
  720. this.toolStripButtonSaveToServer.Enabled = false;
  721. this.toolStripButtonDelAllDraw.Enabled = false;
  722. this.toolStripButtonRedo.Enabled = false;
  723. this.toolStripButtonUndo.Enabled = false;
  724. }
  725. }
  726. /// <summary>
  727. /// Dual Viewer 활성화 시 버튼 활성화 설정
  728. /// </summary>
  729. /// <param name="enabled">활성화 여부</param>
  730. public override void SetEnablementExecuteWhenDualViewerActive(bool enabled) {
  731. // 전자동의서 실행 버튼
  732. this.toolStripButtonExecute.Enabled = enabled;
  733. // 출력 버튼
  734. this.toolStripButtonPrint.Enabled = enabled;
  735. if(enabled) {
  736. if(this.CurrentPreviewConsent != null && this.CurrentPreviewConsent.outputType != null) {
  737. if(this.CurrentPreviewConsent.outputType.Equals("ELECTRONIC")) {
  738. this.toolStripButtonPrint.Enabled = !enabled;
  739. }
  740. }
  741. }
  742. // Dual Viewer 닫기 버튼
  743. this.toolStripButtonCloseDualViewer.Visible = !enabled;
  744. SetEnableByUserType();
  745. base.SetEnablementExecuteWhenDualViewerActive(enabled);
  746. }
  747. /// <summary>
  748. /// 동의서 상태에 따른 Dual view 상태의 버튼 설정
  749. /// </summary>
  750. /// <param name="state">The state.</param>
  751. private void SetEnableButtonsByConsentStateForDualView(string state) {
  752. if(state.Equals("PAPER_OUT")) {
  753. this.toolStripButtonExecute.Enabled = false;
  754. }
  755. else if(state.Equals("ELECTR_CMP") || state.Equals("CERTIFY_CMP")) {
  756. this.toolStripButtonExecute.Enabled = false;
  757. this.toolStripButtonPrint.Enabled = false;
  758. }
  759. if(this.CurrentPreviewConsent.RewriteConsentMstRid > 0) {
  760. this.toolStripButtonExecute.Enabled = true;
  761. }
  762. }
  763. /// <summary>
  764. /// 동의서 상태에 따른 Single view 상태의 버튼 설정
  765. /// </summary>
  766. /// <param name="state">The state.</param>
  767. private void SetEnableButtonsByConsentStateForSingleView(string state) {
  768. if(state.Equals("PAPER_OUT")) {
  769. this.toolStripButtonSaveToServer.Enabled = false;
  770. //this.toolStripButtonCompleteSaveToServer.Enabled = false;
  771. this.toolStripButtonTempSaveToServer.Enabled = false;
  772. this.toolStripButtonExecute.Enabled = false;
  773. }
  774. else if(state.Equals("ELECTR_CMP") || state.Equals("CERTIFY_CMP")) {
  775. this.toolStripButtonTempSaveToServer.Enabled = false;
  776. //this.toolStripButtonCompleteSaveToServer.Enabled = false;
  777. this.toolStripButtonSaveToServer.Enabled = false;
  778. this.toolStripButtonPrint.Enabled = false;
  779. }
  780. if(this.CurrentPreviewConsent.RewriteConsentMstRid > 0) {
  781. this.toolStripButtonTempSaveToServer.Enabled = true;
  782. //this.toolStripButtonCompleteSaveToServer.Enabled = true;
  783. this.toolStripButtonSaveToServer.Enabled = true;
  784. }
  785. }
  786. /// <summary>
  787. /// 미작성 동의서 삭제
  788. /// </summary>
  789. /// <param name="reasonForUseN"></param>
  790. public override void DeleteRecordOfDeleteConsent(string reasonForUseN) {
  791. SaveDataForDeleteConsent(reasonForUseN);
  792. }
  793. /// <summary>
  794. /// 출력된 동의서를 저장
  795. /// </summary>
  796. /// <param name="reasonForUseN">The reason for use n.</param>
  797. //private void SaveDataForPrintedConsent(string reasonForUseN) {
  798. public void SaveDataForPrintedConsent(string reasonForUseN) {
  799. string consentOutputType = this.CurrentPreviewConsent.outputType;
  800. string consentState = this.CurrentPreviewConsent.consentState;
  801. //int result = -1;
  802. //인쇄(바코드제외)인 경우 CONSENT_MST에 데이터를 입력하지 않는다.
  803. if((!string.IsNullOrEmpty(consentOutputType) && consentOutputType.Equals("PAPER_EXCEPT_BARCODE"))) {
  804. //return result;
  805. return;
  806. }
  807. // 다중 출력 시
  808. if(consentOutputType != null && consentOutputType.Equals("MULTI")) {
  809. Cursor currentCursor = this.Cursor;
  810. try {
  811. this.Cursor = Cursors.WaitCursor;
  812. List<PatListVO> volist = consentMain.PatientListCtrl.GetSelectedPatientList();
  813. string[] strOcrCd = null;
  814. if(this.CurrentPreviewConsent.multiOcrcode.Length > 0) {
  815. strOcrCd = this.CurrentPreviewConsent.multiOcrcode.Split('^');
  816. }
  817. string[] strMainDrIdCd = null;
  818. if(this.CurrentPreviewConsent.multiMainDrIdCd.Length > 0) {
  819. strMainDrIdCd = this.CurrentPreviewConsent.multiMainDrIdCd.Split('^');
  820. }
  821. int lastRid = -1;
  822. for(int i = 0; i < volist.Count; i++) {
  823. PatientVO vo = GetPatientByPatList(volist[i]);
  824. //string userId = (vo.inputId == null) ? CurrentEndUser.UserNo : vo.inputId;
  825. //string userName = (vo.inputNm == null) ? CurrentEndUser.UserName : vo.inputNm;
  826. string userId = this.consentMain.ConsentExecuteInfo["loginUserNo"];
  827. string userName = this.consentMain.ConsentExecuteInfo["loginUserName"];
  828. string deptCd = this.consentMain.ConsentExecuteInfo["userDeptCd"];
  829. string hosType = (vo.instCd == null) ? consentMain.ConsentExecuteInfo["dutinstcd"] : vo.instCd;
  830. UserVO userVo = hospitalWebService.GetUserInfo(userId, hosType, deptCd);
  831. //if (string.IsNullOrEmpty(userName)) {
  832. // var date = CurrentTargetPatient.clnDate;
  833. // userName = userVo.userName;
  834. //}
  835. /**
  836. * 선택된 환자의 진료의가 퇴직한 경우 사용자 정보를 가져올 수 없어 로그인 한 사용자의 정보를 매핑하여 준다
  837. */
  838. var tmpOrddeptcd = CurrentEndUser?.DeptCode ?? String.Empty;
  839. if (String.IsNullOrEmpty(tmpOrddeptcd)) {
  840. userName = this.consentMain.ConsentExecuteInfo["loginUserName"];
  841. deptCd = this.consentMain.ConsentExecuteInfo["userDeptCd"];
  842. }
  843. else {
  844. deptCd = tmpOrddeptcd;
  845. }
  846. string patientCode = vo.pid;
  847. string clnDeptCode = vo.ordDeptCd;
  848. string vistType = vo.ordType;
  849. string clnDate = vo.inDd.Replace("-", "");
  850. int rewriteConsentMstRid = 0;
  851. string ward = vo.ward;
  852. string roomcd = vo.roomCd;
  853. string formRid = CurrentPreviewConsent.formRid;
  854. string formCd = CurrentPreviewConsent.formCd;
  855. string consentMstRid = CurrentPreviewConsent.consentMstRid;
  856. int orderNo = vo.orderNo;
  857. string orderCode = vo.dxCd;
  858. string orderName = vo.dxNm;
  859. string ocrCode = (strOcrCd != null && !string.IsNullOrEmpty(strOcrCd[i])) ? strOcrCd[i] : CurrentPreviewConsent.ocrCode;
  860. string mainDrId = (strMainDrIdCd != null && !string.IsNullOrEmpty(strMainDrIdCd[i])) ? strMainDrIdCd[i] : currentTargetPatient.MainDrId;
  861. int.TryParse(vo.cretNo, out int cretno);
  862. ConvertStringToInt(formRid, consentMstRid, out int formRidInt, out int consentMstRidInt);
  863. string deviceIdentNo = System.Environment.MachineName;
  864. // 동의서 프린트 출력 후 데이터를 저장
  865. consentMstRidInt = consentWebService.SavePrintOut(userId
  866. , patientCode
  867. , clnDeptCode
  868. , formRidInt
  869. , formCd
  870. , consentMstRidInt
  871. , rewriteConsentMstRid
  872. , null
  873. , null
  874. , "PRT"
  875. , deviceIdentNo
  876. , vistType
  877. , hosType
  878. , clnDate
  879. , ward
  880. , roomcd
  881. , orderNo
  882. , orderName
  883. , orderCode
  884. , ocrCode
  885. , cretno
  886. , userName
  887. , userName
  888. , mainDrId
  889. , deptCd
  890. , consentMain.GetTotalPageCount().ToString()
  891. , "P"
  892. , "P"
  893. , CurrentTargetPatient.OpRsrvNo);
  894. lastRid = consentMstRidInt;
  895. //result = lastRid;
  896. }
  897. this.consentMain.ConsentListCtrl.InquiryConsentData(lastRid);
  898. // dbs227,
  899. // 출력 모드가 아닐때는 초기화 하지 않는다.
  900. //if (!this.consentMain.ConsentExecuteInfo["printYN"].Equals("Y"))
  901. //{
  902. //this.consentMain.ConsentListCtrl.InquiryConsentData(lastRid);
  903. //}
  904. this.consentMain.multiPrintExecCnt++;
  905. }
  906. catch(Exception ex) {
  907. throw ex;
  908. }
  909. finally {
  910. this.Cursor = currentCursor;
  911. }
  912. consentMain.PatientListCtrl.SetClearCheckBox();
  913. if (consentMain.multiParams == null)
  914. {
  915. consentMain.ReInitializeViewer();
  916. }
  917. }
  918. else {
  919. if(this.CurrentTargetPatient != null && !string.IsNullOrEmpty(this.CurrentTargetPatient.PatientCode)) {
  920. //string userId = CurrentEndUser.UserNo;
  921. //string userName = CurrentEndUser.UserName;
  922. string userId = this.consentMain.ConsentExecuteInfo["loginUserNo"];
  923. string userName = this.consentMain.ConsentExecuteInfo["loginUserName"];
  924. string hosType = consentMain.ConsentExecuteInfo["dutinstcd"];
  925. string deptCd = this.consentMain.ConsentExecuteInfo["userDeptCd"];
  926. UserVO userVo = hospitalWebService.GetUserInfo(userId, hosType, deptCd);
  927. //if (string.IsNullOrEmpty(userName)) {
  928. // var date = CurrentTargetPatient.clnDate;
  929. // userName = userVo.userName;
  930. //}
  931. /**
  932. * 선택된 환자의 진료의가 퇴직한 경우 사용자 정보를 가져올 수 없어 로그인 한 사용자의 정보를 매핑하여 준다
  933. */
  934. var tmpOrddeptcd = CurrentEndUser?.DeptCode ?? String.Empty;
  935. if (String.IsNullOrEmpty(tmpOrddeptcd)) {
  936. userName = this.consentMain.ConsentExecuteInfo["loginUserName"];
  937. deptCd = this.consentMain.ConsentExecuteInfo["userDeptCd"];
  938. }
  939. else {
  940. deptCd = tmpOrddeptcd;
  941. }
  942. string patientCode = CurrentTargetPatient.PatientCode;
  943. string clnDeptCode = CurrentTargetPatient.clnDeptCode;
  944. string vistType = CurrentTargetPatient.VisitType;
  945. string clnDate = CurrentTargetPatient.clnDate.Replace("-", "");
  946. string ward = CurrentTargetPatient.Ward;
  947. string roomcd = currentTargetPatient.RoomNo;
  948. int orderNo = CurrentTargetPatient.OrderNo;
  949. string orderCode = CurrentTargetPatient.OPdeptCode;
  950. string orderName = CurrentTargetPatient.OPdeptName;
  951. string mainDrId = CurrentTargetPatient.MainDrId;
  952. string formRid = CurrentPreviewConsent.formRid;
  953. string formCd = CurrentPreviewConsent.formCd;
  954. string consentMstRid = CurrentPreviewConsent.consentMstRid;
  955. string ocrCode = CurrentPreviewConsent.ocrCode;
  956. int cretno = 0;
  957. int.TryParse(CurrentTargetPatient.cretno, out cretno);
  958. ConvertStringToInt(formRid, consentMstRid, out int formRidInt, out int consentMstRidInt);
  959. int reissueConsentMstRid = 0;
  960. string deviceIdentNo = System.Environment.MachineName;
  961. Cursor currentCursor = this.Cursor;
  962. try {
  963. this.Cursor = Cursors.WaitCursor;
  964. // 동의서 프린트 출력 후 데이터를 저장
  965. consentMstRidInt = consentWebService.SavePrintOut(userId
  966. , patientCode
  967. , clnDeptCode
  968. , formRidInt
  969. , formCd
  970. , consentMstRidInt
  971. , reissueConsentMstRid
  972. , null
  973. , null
  974. , "PRT"
  975. , deviceIdentNo
  976. , vistType
  977. , hosType
  978. , clnDate
  979. , ward
  980. , roomcd
  981. , orderNo
  982. , orderName
  983. , orderCode
  984. , ocrCode
  985. , cretno
  986. , userName
  987. , userName
  988. , mainDrId
  989. , deptCd /* currentEndUser.DeptCode */
  990. , consentMain.GetTotalPageCount().ToString()
  991. , "P"
  992. , "P"
  993. , CurrentTargetPatient.OpRsrvNo);
  994. if (consentMain.multiParams == null)
  995. {
  996. this.consentMain.ConsentListCtrl.InquiryConsentData(consentMstRidInt);
  997. }
  998. this.consentMain.multiPrintExecCnt++;
  999. //result = consentMstRidInt;
  1000. }
  1001. catch(Exception ex) {
  1002. throw ex;
  1003. }
  1004. finally {
  1005. this.Cursor = currentCursor;
  1006. }
  1007. }
  1008. }
  1009. //return result;
  1010. }
  1011. /// <summary>
  1012. /// 출력 히스토리 삭제
  1013. /// </summary>
  1014. public void erasePrintHistory() {
  1015. String consentMstRid = CurrentPreviewConsent.consentMstRid;
  1016. String ocrCode = CurrentPreviewConsent.ocrCode;
  1017. String instcd = consentMain.ConsentExecuteInfo["dutinstcd"];
  1018. String pid = CurrentTargetPatient.PatientCode;
  1019. Cursor currentCursor = this.Cursor;
  1020. try {
  1021. this.Cursor = Cursors.WaitCursor;
  1022. consentWebService.updatePrintHistory(pid, ocrCode, instcd);
  1023. }
  1024. catch(Exception ex) {
  1025. throw ex;
  1026. }
  1027. finally {
  1028. this.Cursor = currentCursor;
  1029. }
  1030. }
  1031. /// <summary>
  1032. /// 환자리스트의 한 환자의 상세정보를 조회한다
  1033. /// </summary>
  1034. /// <param name="patvo">조회할 환자의 PatListVO 인스턴스</param>
  1035. /// <returns></returns>
  1036. private PatientVO GetPatientByPatList(PatListVO patvo) {
  1037. string indd = string.Empty;
  1038. if(!string.IsNullOrEmpty(patvo.inDd)) indd = patvo.inDd.Replace("/", "").Replace("-", "");
  1039. PatientVO[] patientVOList = this.hospitalWebService.GetPatientInfo(patvo.pid
  1040. , indd
  1041. , patvo.ordType
  1042. , patvo.ordDeptCd
  1043. , patvo.cretNo.ToString()
  1044. , this.consentMain.ConsentExecuteInfo["dutinstcd"]
  1045. , this.consentMain.ConsentExecuteInfo["opRsrvNo"]);
  1046. if(patientVOList == null || patientVOList.Length == 0) {
  1047. return null;
  1048. }
  1049. else {
  1050. return patientVOList[0];
  1051. }
  1052. }
  1053. /// <summary>
  1054. /// 삭제 사유와 함께 전자동의서 삭제
  1055. /// </summary>
  1056. /// <param name="reasonForUseN">삭제할 사유</param>
  1057. private void SaveDataForDeleteConsent(string reasonForUseN) {
  1058. string userId = CurrentEndUser.UserNo;
  1059. string patientCode = CurrentTargetPatient.PatientCode;
  1060. string clnDeptCd = CurrentTargetPatient.clnDeptCode;
  1061. string ward = CurrentTargetPatient.Ward;
  1062. string roomcd = CurrentTargetPatient.RoomNo;
  1063. string formRid = CurrentPreviewConsent.formRid;
  1064. string consentMstRid = CurrentPreviewConsent.consentMstRid;
  1065. string consentState = CurrentPreviewConsent.consentState;
  1066. int rewriteConsentMstRid = CurrentPreviewConsent.RewriteConsentMstRid;
  1067. ConvertStringToInt(formRid, consentMstRid, out int formRidInt, out int consentMstRidInt);
  1068. int.TryParse(CurrentTargetPatient.cretno, out int cretno);
  1069. int reissueConsentMstRidInt = CurrentPreviewConsent.ReissueConsentMstRid;
  1070. string deviceIdentNo = System.Environment.MachineName;
  1071. this.consentWebService.SaveDelete(userId, Int32.Parse(consentMstRid), patientCode, clnDeptCd, CurrentPreviewConsent.formCd, CurrentTargetPatient.VisitType,
  1072. consentMain.ConsentExecuteInfo["dutinstcd"], CurrentTargetPatient.clnDate, reasonForUseN, CurrentPreviewConsent.ocrCode,
  1073. cretno, currentEndUser.DeptCode, consentMain.GetTotalPageCount().ToString(), "CP", "PC");
  1074. //this.consentWebService.SaveDelete(userId
  1075. // , consentMstRidInt
  1076. // , patientCode
  1077. // , clnDeptCd
  1078. // , ward
  1079. // , roomcd
  1080. // , formRidInt
  1081. // , CurrentPreviewConsent.FormCd
  1082. // , rewriteConsentMstRid
  1083. // , reissueConsentMstRidInt
  1084. // , consentState
  1085. // , deviceIdentNo
  1086. // , CurrentTargetPatient.VisitType
  1087. // , consentMain.ConsentExecuteInfo["dutinstcd"]
  1088. // , CurrentTargetPatient.clnDate
  1089. // , reasonForUseN
  1090. // , CurrentPreviewConsent.Ocrcode
  1091. // , cretno
  1092. // , currentEndUser.DeptCode
  1093. // , consentMain.GetTotalPageCount().ToString()
  1094. // , "CP"
  1095. // , "P");
  1096. }
  1097. private void SetHasMedicalHistoryInConsent(string patientCode) {
  1098. this.CurrentPreviewConsent.hasMedicalHistory = false;
  1099. }
  1100. /// <summary>
  1101. /// 동의서 뷰어에 동의서 로드
  1102. /// </summary>
  1103. public void RunConsentDualView() {
  1104. bool runDualView = true;
  1105. if(this.CurrentEndUser != null && this.CurrentPreviewConsent != null
  1106. && !string.IsNullOrEmpty(this.CurrentPreviewConsent.printOnly)
  1107. && this.CurrentPreviewConsent.printOnly.Equals("Y")
  1108. ) {
  1109. runDualView = false;
  1110. }
  1111. // 출력 상태일 경우 재출력만 가능하도록 버튼 조정
  1112. if(this.CurrentEndUser != null && this.CurrentPreviewConsent != null
  1113. && !string.IsNullOrEmpty(this.CurrentPreviewConsent.consentState)
  1114. && (this.CurrentPreviewConsent.consentState.ToUpper().Equals("PAPER_OUT"))) {
  1115. runDualView = false;
  1116. }
  1117. if(CurrentPreviewConsent == null) {
  1118. return;
  1119. }
  1120. // 동의서 로드 전 consent_mst_rid에 해당하는 동의서가 상위 상태값이 있는지 체크
  1121. SingleReturnData resultData = this.consentWebService.CheckConsentState(int.Parse(this.CurrentPreviewConsent.consentMstRid),
  1122. this.CurrentPreviewConsent.consentState);
  1123. int state = Int32.Parse(resultData.responseData);
  1124. if(state == 1) {
  1125. return;
  1126. }
  1127. // 출력만 가능하거나 출력상태일 경우 듀얼뷰어 실행 못하도록 적용
  1128. if(runDualView) this.consentMain.RunConsentDualView();
  1129. }
  1130. /// <summary>
  1131. /// 인증저장 된 동의서를 보여준다
  1132. /// </summary>
  1133. /// <param name="consentMain">The consent main.</param>
  1134. public void ShowCompleteConsent(IConsentMain consentMain) {
  1135. //SetEnableButtonsByCurrentConsent();
  1136. consentMain.ReviewConsent();
  1137. ConsentImageVO[] cImage = this.consentWebService.GetConsentImage(this.CurrentPreviewConsent.consentMstRid);
  1138. if(cImage != null && cImage.Length > 0) {
  1139. CLIP.eForm.ImageView.ImageViewCtrl iViewer = consentMain.GetImageViewerCtrl();
  1140. List<string> lStr = new List<string>();
  1141. string sPath = this.consentMain.PluginExecuteInfo["imageUploadPath"] + "/DataTempImage/";
  1142. string sLocal = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Clipsoft\ClipSoft.eForm.Viewer\DataTemp\";
  1143. DirectoryInfo di = new DirectoryInfo(sLocal);
  1144. if(di.Exists == false) {
  1145. di.Create();
  1146. }
  1147. foreach(ConsentImageVO img in cImage) {
  1148. if(File.Exists(sLocal + img.ImageFilename)) {
  1149. Image imgTemp = Image.FromFile(sLocal + img.ImageFilename);
  1150. lStr.Add(ImageToBase64(imgTemp, System.Drawing.Imaging.ImageFormat.Jpeg));
  1151. imgTemp.Dispose();
  1152. }
  1153. else {
  1154. string orgFile = img.ImagePath + "\\" + img.ImageFilename;
  1155. string tempImgNm = orgFile.Substring(orgFile.IndexOf("\\") + 1).Replace("\\", "");
  1156. using(WebClient myWebClient = new WebClient()) {
  1157. myWebClient.DownloadFile(sPath + img.ImageFilename, sLocal + img.ImageFilename);
  1158. if(File.Exists(sLocal + img.ImageFilename)) {
  1159. Image imgTemp = Image.FromFile(sLocal + img.ImageFilename);
  1160. lStr.Add(ImageToBase64(imgTemp, System.Drawing.Imaging.ImageFormat.Jpeg));
  1161. imgTemp.Dispose();
  1162. }
  1163. else {
  1164. break;
  1165. }
  1166. }
  1167. }
  1168. }
  1169. if(lStr.Count > 0)
  1170. iViewer.Show();
  1171. iViewer.SetBase64Images(lStr);
  1172. }
  1173. else {
  1174. // 검색된 이미지가 없습니다.
  1175. }
  1176. }
  1177. /// <summary>
  1178. /// 이미지를 BASE64 로 인코딩
  1179. /// </summary>
  1180. /// <param name="image">변환할 이미지</param>
  1181. /// <param name="format">저장할 이미지 포멧</param>
  1182. /// <returns></returns>
  1183. public string ImageToBase64(Image image, System.Drawing.Imaging.ImageFormat format) {
  1184. using(MemoryStream ms = new MemoryStream()) {
  1185. // Convert Image to byte[]
  1186. image.Save(ms, format);
  1187. byte[] imageBytes = ms.ToArray();
  1188. // Convert byte[] to Base64 String
  1189. string base64String = Convert.ToBase64String(imageBytes);
  1190. return base64String;
  1191. }
  1192. }
  1193. /// <summary>
  1194. /// 동의서 미리 보기
  1195. /// </summary>
  1196. /// <param name="consentMain">미리보기할 동의서가 있는 인스턴스</param>
  1197. public void PreviewConsent(IConsentMain consentMain) {
  1198. // 근무지기관별 공통파라미터를 설정
  1199. Dictionary<FOSParameter, string> globalParams = Common.CreateGlobalParamsDictionary(consentMain.ConsentExecuteInfo["dutinstcd"]);
  1200. SetPatientAndUser(globalParams);
  1201. globalParams[FOSParameter.OCRCode] = string.Empty;
  1202. var ocrBuf = GetOcrCode();
  1203. if(string.IsNullOrEmpty(ocrBuf)) {
  1204. MessageBox.Show("OCR 중복입니다. 다시 환자를 선택하여 주세요.");
  1205. return;
  1206. }
  1207. globalParams[FOSParameter.OCRCode] = CurrentPreviewConsent.ocrCode = ocrBuf;
  1208. globalParams[FOSParameter.OCRCode] = CurrentPreviewConsent.ocrCode = GetOcrCode(); // OCR 코드
  1209. if(string.IsNullOrEmpty(CurrentPreviewConsent.ocrCode)) {
  1210. MessageBox.Show("OCRTAG 생성 오류. 전산실에 문의 하세요.");
  1211. consentMain.ClearPreviewConsent(true);
  1212. return;
  1213. }
  1214. globalParams[FOSParameter.Device] = "C";
  1215. globalParams[FOSParameter.PrintTime] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  1216. globalParams[FOSParameter.SignTime] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  1217. globalParams[FOSParameter.PrintIp] = consentMain.ConsentExecuteInfo["printIP"];
  1218. CLIP.eForm.Consent.UI.HospitalSvcRef.SingleReturnData retVal = hospitalWebService.getEmrDataString(
  1219. "A01"
  1220. , this.CurrentTargetPatient.HosType
  1221. , this.CurrentTargetPatient.PatientCode
  1222. , this.CurrentTargetPatient.clnDate
  1223. , this.CurrentTargetPatient.cretno
  1224. , this.CurrentPreviewConsent.formCd);
  1225. globalParams[FOSParameter.emrinfo] = retVal.responseData;
  1226. //MessageBox.Show(retVal.responseData);
  1227. List<string> formGuids = new List<string> {
  1228. CurrentPreviewConsent.formGuid
  1229. };
  1230. string fos = Common.GetFosString(formGuids
  1231. , consentMain.PluginExecuteInfo["formServiceUrl"]
  1232. , globalParams
  1233. , null
  1234. , consentMain.ConsentExecuteInfo["dutinstcd"]);
  1235. SingleReturnData returnData = this.consentWebService.CheckConsentState(int.Parse(CurrentPreviewConsent.consentMstRid), CurrentPreviewConsent.consentState);
  1236. int state = Int32.Parse(returnData.responseData);
  1237. if(state == 1) {
  1238. MessageBoxDlg.Show(this, "이미 저장된 서식 입니다."
  1239. , string.Format(Properties.Resources.msg_caption_confirm),
  1240. MessageBoxButtons.OK, MessageBoxIcon.Information);
  1241. return;
  1242. }
  1243. consentMain.PreviewConsent(fos);//서식을 열도록 fos을 던짐
  1244. // 외래 환자 외에는 작성 완료(확인) 버튼 안보이게 설정
  1245. /*
  1246. if(CurrentTargetPatient.VisitType.Equals("O") && CurrentPreviewConsent.userDrFlag.Equals("Y")) {
  1247. toolStripButtonCompleteSaveToServer.Visible = true;
  1248. }
  1249. else {
  1250. toolStripButtonCompleteSaveToServer.Visible = false;
  1251. }
  1252. */
  1253. consentMain.ConsentCommandCtrl.SetEnableButtonsByCurrentConsent();
  1254. SetEnableByUserType();
  1255. }
  1256. /// <summary>
  1257. /// 현재 동의서의 OCR 코드를 가져온다. OCR 코드가 존재하지 않으면 서버로부터 얻어온다
  1258. /// </summary>
  1259. /// <returns>OCR 코드</returns>
  1260. public string GetOcrCode() {
  1261. string strOcrCode = "";
  1262. if(this.CurrentPreviewConsent.ocrtagPrntyn.Equals("N")) {
  1263. strOcrCode = " ";
  1264. }
  1265. else {
  1266. if(this.CurrentPreviewConsent != null
  1267. && !string.IsNullOrEmpty(this.CurrentPreviewConsent.ocrCode)) {
  1268. strOcrCode = this.CurrentPreviewConsent.ocrCode;
  1269. }
  1270. // OCR 코드가 없으면 서버로 부터 받아온다
  1271. // TODO 삭제
  1272. else {
  1273. if(this.CurrentPreviewConsent != null
  1274. && !string.IsNullOrEmpty(this.CurrentPreviewConsent.ocrtagPrntyn)
  1275. && this.CurrentPreviewConsent.ocrtagPrntyn.Equals("Y")) {
  1276. HospitalSvcRef.SingleReturnData returnData = hospitalWebService.GetOcrTag(this.consentMain.ConsentExecuteInfo["dutinstcd"]);
  1277. if(string.IsNullOrEmpty(returnData.responseData)){
  1278. throw new Exception("OCRTAG 생성 오류. 전산실에 문의 하세요.");
  1279. }
  1280. strOcrCode = returnData.responseData;
  1281. }
  1282. }
  1283. if(string.IsNullOrEmpty(strOcrCode)) {
  1284. throw new Exception("OCRTAG 생성 오류. 전산실에 문의 하세요.");
  1285. }
  1286. }
  1287. return strOcrCode;
  1288. }
  1289. /// <summary>
  1290. /// changingGlobalParams Dataset 에 FOS 파라미터의 name 과 value 를 설정한다
  1291. /// </summary>
  1292. /// <param name="globalParams"></param>
  1293. public void SetPatientAndUser(Dictionary<FOSParameter, string> globalParams) {
  1294. Dictionary<FOSParameter, string> changingGlobalParams = new Dictionary<FOSParameter, string>();
  1295. if(CurrentPreviewConsent == null) {
  1296. MessageBox.Show("동의서 정보가 없습니다.");
  1297. throw new Exception("동의서 정보가 없습니다.");
  1298. }
  1299. if(CurrentTargetPatient == null || string.IsNullOrEmpty(this.CurrentTargetPatient.PatientCode)) {
  1300. MessageBox.Show("환자 정보가 없습니다.");
  1301. throw new Exception("환자 정보가 없습니다.");
  1302. }
  1303. if(CurrentEndUser == null) {
  1304. MessageBox.Show("사용자 정보가 없습니다.");
  1305. throw new Exception("사용자 정보가 없습니다.");
  1306. }
  1307. // 동의서 정보
  1308. changingGlobalParams[FOSParameter.FormName] = this.CurrentPreviewConsent.formPrintName;
  1309. // 환자 정보
  1310. changingGlobalParams[FOSParameter.ImageUploadPath] = this.consentMain.PluginExecuteInfo["imageUploadPath"] + "/";
  1311. changingGlobalParams[FOSParameter.PatientCode] = this.CurrentTargetPatient.PatientCode;
  1312. changingGlobalParams[FOSParameter.PatientSexAge] = this.CurrentTargetPatient.PatientSexAge;
  1313. changingGlobalParams[FOSParameter.PatientName] = this.CurrentTargetPatient.PatientName;
  1314. changingGlobalParams[FOSParameter.PatientNameFix] = this.CurrentTargetPatient.PatientName;
  1315. changingGlobalParams[FOSParameter.PatientRRN] = this.CurrentTargetPatient.PatientJuminNo;
  1316. changingGlobalParams[FOSParameter.PatientRRNOrg] = this.CurrentTargetPatient.PatientJuminNoOrg;
  1317. changingGlobalParams[FOSParameter.RoomNo] = this.CurrentTargetPatient.Ward + "/" + this.CurrentTargetPatient.RoomNo;
  1318. changingGlobalParams[FOSParameter.VisitDate] = SetDateFormatting(this.CurrentTargetPatient.clnDate.Replace("-", ""));
  1319. changingGlobalParams[FOSParameter.DeptName] = this.CurrentTargetPatient.clnDeptName;
  1320. changingGlobalParams[FOSParameter.MainDoctor] = this.CurrentTargetPatient.MainDrNm;
  1321. changingGlobalParams[FOSParameter.PatientAddress] = this.CurrentTargetPatient.PatientAddr;
  1322. changingGlobalParams[FOSParameter.PatientTelNo] = this.CurrentTargetPatient.PatientTelNo;
  1323. changingGlobalParams[FOSParameter.PatientTelNoFix] = this.CurrentTargetPatient.PatientTelNo;
  1324. changingGlobalParams[FOSParameter.Insukind] = this.CurrentTargetPatient.Insukind;
  1325. changingGlobalParams[FOSParameter.DeptCode] = this.CurrentTargetPatient.clnDeptCode;
  1326. changingGlobalParams[FOSParameter.DiagName] = this.CurrentTargetPatient.OpDiagName;
  1327. changingGlobalParams[FOSParameter.OpRsrvNo] = this.CurrentTargetPatient.OpRsrvNo;
  1328. changingGlobalParams[FOSParameter.OperationName] = this.CurrentTargetPatient.OpName;
  1329. changingGlobalParams[FOSParameter.OpDoctorName] = this.CurrentTargetPatient.PerfDrName;
  1330. changingGlobalParams[FOSParameter.OpDeptName] = (this.CurrentTargetPatient.PerfDrFlag + "").Equals("전문의") ? this.CurrentTargetPatient.PerfDrDept ?? "" : "";
  1331. changingGlobalParams[FOSParameter.OpCommDeptName] = !(this.CurrentTargetPatient.PerfDrFlag + "").Equals("전문의") ? this.CurrentTargetPatient.PerfDrDept ?? "" : "";
  1332. changingGlobalParams[FOSParameter.AnstDrName1] = this.CurrentTargetPatient.AnstDrName1;
  1333. changingGlobalParams[FOSParameter.AnstDeptName1] = (this.CurrentTargetPatient.AnstDrFlag1 + "").Equals("전문의") ? this.CurrentTargetPatient.AnstDeptName1 ?? "" : "";
  1334. changingGlobalParams[FOSParameter.AnstCommDeptName1] = !(this.CurrentTargetPatient.AnstDrFlag1 + "").Equals("전문의") ? this.CurrentTargetPatient.AnstDeptName1 ?? "" : "";
  1335. changingGlobalParams[FOSParameter.AnstDrName2] = this.CurrentTargetPatient.AnstDrName2;
  1336. changingGlobalParams[FOSParameter.AnstDeptName2] = (this.CurrentTargetPatient.AnstDrFlag2 + "").Equals("전문의") ? this.CurrentTargetPatient.AnstDeptName2 ?? "" : "";
  1337. changingGlobalParams[FOSParameter.AnstCommDeptName3] = !(this.CurrentTargetPatient.AnstDrFlag2 + "").Equals("전문의") ? this.CurrentTargetPatient.AnstDeptName2 ?? "" : "";
  1338. changingGlobalParams[FOSParameter.AnstDrName3] = this.CurrentTargetPatient.AnstDrName3;
  1339. changingGlobalParams[FOSParameter.AnstDeptName3] = (this.CurrentTargetPatient.AnstDrFlag3 + "").Equals("전문의") ? this.CurrentTargetPatient.AnstDeptName3 ?? "" : "";
  1340. changingGlobalParams[FOSParameter.AnstCommDeptName3] = !(this.CurrentTargetPatient.AnstDrFlag3 + "").Equals("전문의") ? this.CurrentTargetPatient.AnstDeptName3 ?? "" : "";
  1341. if(!string.IsNullOrEmpty(this.CurrentTargetPatient.PatientJuminNo) && this.CurrentTargetPatient.PatientJuminNo.Length > 6) {
  1342. changingGlobalParams[FOSParameter.PatientBirthDay] = this.CurrentTargetPatient.PatientJuminNo.Substring(0, 6);
  1343. changingGlobalParams[FOSParameter.PatientBirthDayFix] = this.CurrentTargetPatient.PatientJuminNo.Substring(0, 6);
  1344. }
  1345. if(string.IsNullOrEmpty(changingGlobalParams[FOSParameter.DiagName])) {
  1346. changingGlobalParams[FOSParameter.DiagName] = this.CurrentPreviewConsent.opDiagName;
  1347. }
  1348. if(string.IsNullOrEmpty(changingGlobalParams[FOSParameter.DiagName])) {
  1349. changingGlobalParams[FOSParameter.DiagName] = this.CurrentTargetPatient.clnDxNm;
  1350. }
  1351. if(string.IsNullOrEmpty(changingGlobalParams[FOSParameter.DiagName])) {
  1352. if(!string.IsNullOrEmpty(consentMain.ConsentExecuteInfo["clnDxNm"])) {
  1353. changingGlobalParams[FOSParameter.DiagName] = consentMain.ConsentExecuteInfo["clnDxNm"];
  1354. }
  1355. }
  1356. if(string.IsNullOrEmpty(changingGlobalParams[FOSParameter.OperationName])) {
  1357. changingGlobalParams[FOSParameter.OperationName] = this.CurrentPreviewConsent.opName;
  1358. }
  1359. // 설명일 (수술 확정일)
  1360. var opDate = this.CurrentTargetPatient.OpCnfmDate;
  1361. var targetDate = new DateTime();
  1362. if(opDate != null && opDate.Length > 0) {
  1363. targetDate = DateTime.ParseExact(opDate, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
  1364. changingGlobalParams[FOSParameter.SignDate] = targetDate.ToLongDateString();
  1365. }
  1366. else {
  1367. //changingGlobalParams[FOSParameter.SignDate] = this.CurrentTargetPatient.OpCnfmDate;
  1368. }
  1369. changingGlobalParams[FOSParameter.BP] = this.CurrentTargetPatient.Ex_bp;
  1370. changingGlobalParams[FOSParameter.DM] = this.CurrentTargetPatient.Ex_dm;
  1371. changingGlobalParams[FOSParameter.Heart] = this.CurrentTargetPatient.Ex_heart;
  1372. changingGlobalParams[FOSParameter.Kidney] = this.CurrentTargetPatient.Ex_kidney;
  1373. changingGlobalParams[FOSParameter.Respiration] = this.CurrentTargetPatient.Ex_respiration;
  1374. changingGlobalParams[FOSParameter.MedicalHistory] = this.CurrentTargetPatient.Ex_hx;
  1375. changingGlobalParams[FOSParameter.Allergy] = this.CurrentTargetPatient.Ex_allergy;
  1376. changingGlobalParams[FOSParameter.Drug] = this.CurrentTargetPatient.Ex_drug;
  1377. changingGlobalParams[FOSParameter.Smoking] = this.CurrentTargetPatient.Ex_smoking;
  1378. changingGlobalParams[FOSParameter.Idiosyncrasy] = this.CurrentTargetPatient.Ex_idio;
  1379. changingGlobalParams[FOSParameter.Nacrotics] = this.CurrentTargetPatient.Ex_nacrotics;
  1380. changingGlobalParams[FOSParameter.Airway] = this.CurrentTargetPatient.Ex_airway;
  1381. changingGlobalParams[FOSParameter.Hemorrhage] = this.CurrentTargetPatient.Ex_hemorrhage;
  1382. changingGlobalParams[FOSParameter.EtcStatus] = this.CurrentTargetPatient.Ex_status_etc;
  1383. // 외래일 경우 emr.mmbdhrcd.hardcdno = 6920 에 지정된 서식외에는 사용자를 진료의로 변경한다.
  1384. if(CurrentTargetPatient.VisitType.Equals("O") && CurrentPreviewConsent.userDrFlag.Equals("Y") && !CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) {
  1385. //consentMain.SetConsentUserInfo(consentMain.ConsentExecuteInfo["dutinstcd"]
  1386. // , CurrentTargetPatient.MainDrId
  1387. // , currentTargetPatient.clnDeptCode); // 외래 진료의는 근무 부서 이외의 과의 처방을 낼 수 없다.
  1388. consentMain.SetConsentUserInfo(consentMain.ConsentExecuteInfo["dutinstcd"]
  1389. , CurrentTargetPatient.MainDrId
  1390. , currentTargetPatient.clnDeptCode, ""); // 외래 진료의는 근무 부서 이외의 과의 처방을 낼 수 없다.
  1391. }
  1392. else if(!CurrentEndUser.UserNo.Equals(consentMain.ConsentExecuteInfo["loginUserNo"])) {
  1393. // 로그인 사용자와 다른 경우 재조회
  1394. consentMain.SetConsentUserInfo(consentMain.ConsentExecuteInfo["dutinstcd"]
  1395. , consentMain.ConsentExecuteInfo["loginUserNo"]
  1396. , consentMain.ConsentExecuteInfo["userDeptCd"]);
  1397. }
  1398. string jobKindCd = !string.IsNullOrEmpty(currentEndUser.JobKindCd) ? currentEndUser.JobKindCd.Substring(0, 2) : "00";
  1399. changingGlobalParams[FOSParameter.UserName] = this.CurrentEndUser.UserName;
  1400. changingGlobalParams[FOSParameter.UserTelNo] = this.CurrentEndUser.UserTelNo;
  1401. changingGlobalParams[FOSParameter.ExplDrName] = jobKindCd.Substring(0, 2).Equals("03") ? CurrentEndUser.UserName : string.Empty;
  1402. changingGlobalParams[FOSParameter.ExplDrTelNo] = jobKindCd.Substring(0, 2).Equals("03") ? CurrentEndUser.UserTelNo : string.Empty;
  1403. // 사용자의 서명 이미지를 가져온다
  1404. UserSignImageVO vo = this.hospitalWebService.GetSignImage(this.CurrentEndUser.UserNo, this.consentMain.ConsentExecuteInfo["dutinstcd"]);
  1405. if(vo != null && vo.SignImage != null && vo.SignImage.Length > 0) {
  1406. // 서명 이미지를 BASE64 형식으로 변환한다.
  1407. changingGlobalParams[FOSParameter.SignImage] = ImageToBase64(byteArrayToImage(vo.SignImage), System.Drawing.Imaging.ImageFormat.Png);
  1408. // 의사의 경우라면 설명의사에 서명이미지를 설정한다
  1409. changingGlobalParams[FOSParameter.ExplDrSign] = jobKindCd.Substring(0, 2).Equals("03") ? changingGlobalParams[FOSParameter.SignImage] : string.Empty;
  1410. changingGlobalParams[FOSParameter.ExplDrSign_p] = changingGlobalParams[FOSParameter.ExplDrSign];
  1411. }
  1412. changingGlobalParams[FOSParameter.ExplDrName_P] = CurrentEndUser.UserName;
  1413. changingGlobalParams[FOSParameter.ExplDrTelNo_p] = CurrentEndUser.UserTelNo;
  1414. // 출력할 경우 설명 의사와 서명 이미지는 공백 처리
  1415. if (consentMain.ConsentExecuteInfo["printYN"].Equals("Y")) {
  1416. changingGlobalParams[FOSParameter.ExplDrName] = string.Empty;
  1417. changingGlobalParams[FOSParameter.ExplDrTelNo] = string.Empty;
  1418. changingGlobalParams[FOSParameter.ExplDrSign] = string.Empty;
  1419. changingGlobalParams[FOSParameter.PatientName] = string.Empty;
  1420. changingGlobalParams[FOSParameter.PatientBirthDay] = string.Empty;
  1421. changingGlobalParams[FOSParameter.PatientTelNo] = string.Empty;
  1422. // 보호자상주확인서 프린터 출력시 제외 항목
  1423. //changingGlobalParams[FOSParameter.UserName] = string.Empty;
  1424. //changingGlobalParams[FOSParameter.SignImage] = string.Empty;
  1425. }
  1426. // 원무 파라미터 설정
  1427. changingGlobalParams[FOSParameter.SpecDoctorYN] = consentMain.ConsentExecuteInfo["SpecDoctorYN"];
  1428. changingGlobalParams[FOSParameter.ContStartDate] = consentMain.ConsentExecuteInfo["ContStartDate"];
  1429. changingGlobalParams[FOSParameter.ContEndDate] = consentMain.ConsentExecuteInfo["ContEndDate"];
  1430. changingGlobalParams[FOSParameter.RoomCapa] = consentMain.ConsentExecuteInfo["RoomCapa"];
  1431. changingGlobalParams[FOSParameter.ContTelNo] = consentMain.ConsentExecuteInfo["ContTelNo"];
  1432. changingGlobalParams[FOSParameter.ContStaff1Name] = consentMain.ConsentExecuteInfo["ContStaff1Name"];
  1433. changingGlobalParams[FOSParameter.ContStaff2Name] = consentMain.ConsentExecuteInfo["ContStaff2Name"];
  1434. changingGlobalParams[FOSParameter.ContStaff3Name] = consentMain.ConsentExecuteInfo["ContStaff3Name"];
  1435. changingGlobalParams[FOSParameter.CardNo] = consentMain.ConsentExecuteInfo["CardNo"];
  1436. // 경대병원 파리미터 추가
  1437. changingGlobalParams[FOSParameter.tag1] = consentMain.ConsentExecuteInfo["tag1"];
  1438. changingGlobalParams[FOSParameter.tag2] = consentMain.ConsentExecuteInfo["tag2"];
  1439. changingGlobalParams[FOSParameter.tag3] = consentMain.ConsentExecuteInfo["tag3"];
  1440. changingGlobalParams[FOSParameter.tag4] = consentMain.ConsentExecuteInfo["tag4"];
  1441. changingGlobalParams[FOSParameter.tag5] = consentMain.ConsentExecuteInfo["tag5"];
  1442. changingGlobalParams[FOSParameter.tag6] = consentMain.ConsentExecuteInfo["tag6"];
  1443. changingGlobalParams[FOSParameter.tag7] = consentMain.ConsentExecuteInfo["tag7"];
  1444. changingGlobalParams[FOSParameter.tag8] = consentMain.ConsentExecuteInfo["tag8"];
  1445. changingGlobalParams[FOSParameter.tag9] = consentMain.ConsentExecuteInfo["tag9"];
  1446. changingGlobalParams[FOSParameter.tag10] = consentMain.ConsentExecuteInfo["tag10"];
  1447. CLIP.eForm.Consent.UI.HospitalSvcRef.SingleReturnData retVal = hospitalWebService.getEmrDataString(
  1448. "A01"
  1449. , this.CurrentTargetPatient.HosType
  1450. , this.CurrentTargetPatient.PatientCode
  1451. , this.CurrentTargetPatient.clnDate
  1452. , this.CurrentTargetPatient.cretno
  1453. , this.CurrentPreviewConsent.formCd);
  1454. changingGlobalParams[FOSParameter.emrinfo] = retVal.responseData;
  1455. // 한번 사용한 후 해당 설정은 초기화
  1456. consentMain.ConsentExecuteInfo["tag1"] = string.Empty;
  1457. consentMain.ConsentExecuteInfo["tag2"] = string.Empty;
  1458. consentMain.ConsentExecuteInfo["tag3"] = string.Empty;
  1459. consentMain.ConsentExecuteInfo["tag4"] = string.Empty;
  1460. consentMain.ConsentExecuteInfo["tag5"] = string.Empty;
  1461. consentMain.ConsentExecuteInfo["tag6"] = string.Empty;
  1462. consentMain.ConsentExecuteInfo["tag7"] = string.Empty;
  1463. consentMain.ConsentExecuteInfo["tag8"] = string.Empty;
  1464. consentMain.ConsentExecuteInfo["tag9"] = string.Empty;
  1465. consentMain.ConsentExecuteInfo["tag10"] = string.Empty;
  1466. ChangeGlobalParametersToNew(globalParams, changingGlobalParams);
  1467. }
  1468. /// <summary>
  1469. /// 임시저장 동의서를 보여준다
  1470. /// </summary>
  1471. /// <param name="consentMain"></param>
  1472. public void ShowTempSaveConsent(IConsentMain consentMain) {
  1473. if(string.IsNullOrEmpty(this.CurrentPreviewConsent.consentMstRid)
  1474. || this.CurrentPreviewConsent.consentMstRid.Equals("-1")) {
  1475. return;
  1476. }
  1477. List<string> formGuids = new List<string>();
  1478. formGuids.Add(this.CurrentPreviewConsent.formGuid);
  1479. Dictionary<string, string> actionParams = new Dictionary<string, string> {
  1480. { "rid", this.CurrentPreviewConsent.consentMstRid }//선택한 리스트의 rid, state
  1481. };
  1482. Dictionary<FOSParameter, string> globalParams = new Dictionary<FOSParameter, string>();
  1483. if(!string.IsNullOrEmpty(this.CurrentPreviewConsent.ordType)) {
  1484. if(!this.CurrentPreviewConsent.ordType.Equals("O")) {
  1485. globalParams[FOSParameter.UserName] = consentMain.ConsentExecuteInfo["loginUserName"];
  1486. }
  1487. if(CurrentEndUser.JobKindCd.Contains("03")) {
  1488. globalParams[FOSParameter.ExplDrName] = CurrentEndUser.UserName ?? string.Empty;
  1489. globalParams[FOSParameter.ExplDrTelNo] = CurrentEndUser.UserTelNo ?? string.Empty;
  1490. // 사용자의 서명 이미지를 가져온다
  1491. UserSignImageVO vo = this.hospitalWebService.GetSignImage(this.CurrentEndUser.UserNo, this.consentMain.ConsentExecuteInfo["dutinstcd"]);
  1492. if(vo != null && vo.SignImage != null && vo.SignImage.Length > 0) {
  1493. // 서명 이미지를 BASE64 형식으로 변환한다.
  1494. //globalParams[FOSParameter.SignImage] = ImageToBase64(byteArrayToImage(vo.SignImage), System.Drawing.Imaging.ImageFormat.Png);
  1495. // 의사의 경우라면 설명의사에 서명이미지를 설정한다
  1496. globalParams[FOSParameter.ExplDrSign] = ImageToBase64(byteArrayToImage(vo.SignImage), System.Drawing.Imaging.ImageFormat.Png) ?? string.Empty;
  1497. }
  1498. }
  1499. }
  1500. CLIP.eForm.Consent.UI.HospitalSvcRef.SingleReturnData retVal = hospitalWebService.getEmrDataString(
  1501. "A01"
  1502. , this.CurrentTargetPatient.HosType
  1503. , this.CurrentTargetPatient.PatientCode
  1504. , this.CurrentTargetPatient.clnDate
  1505. , this.CurrentTargetPatient.cretno
  1506. , this.CurrentPreviewConsent.formCd);
  1507. globalParams[FOSParameter.emrinfo] = retVal.responseData;
  1508. string fos = Common.GetFosStringForEpt(actionParams, consentMain.PluginExecuteInfo["formServiceUrl"], globalParams, consentMain.ConsentExecuteInfo["dutinstcd"]);
  1509. SingleReturnData returnData = this.consentWebService.CheckConsentState(int.Parse(this.CurrentPreviewConsent.consentMstRid), this.CurrentPreviewConsent.consentState);
  1510. int state = Int32.Parse(returnData.responseData);
  1511. if(state == 1) {
  1512. MessageBoxDlg.Show(this, "이미 저장된 서식 입니다."
  1513. , string.Format(Properties.Resources.msg_caption_confirm),
  1514. MessageBoxButtons.OK, MessageBoxIcon.Information);
  1515. return;
  1516. }
  1517. consentMain.PreviewConsent(fos);
  1518. // 외래 환자 외에는 작성 완료(확인) 버튼 안보이게 설정
  1519. /*
  1520. if(!CurrentTargetPatient.VisitType.Equals("O")) {
  1521. toolStripButtonCompleteSaveToServer.Visible = false;
  1522. }
  1523. else {
  1524. toolStripButtonCompleteSaveToServer.Visible = true;
  1525. }
  1526. */
  1527. consentMain.ConsentCommandCtrl.SetEnableConsentIssueCommands(true);
  1528. consentMain.ConsentCommandCtrl.SetEnableButtonsByCurrentConsent();
  1529. SetEnableByUserType();
  1530. }
  1531. private Image byteArrayToImage(byte[] byteArrayIn) {
  1532. MemoryStream ms = new MemoryStream(byteArrayIn);
  1533. Image returnImage = Image.FromStream(ms);
  1534. return returnImage;
  1535. }
  1536. /// <summary>
  1537. /// 동의서 임시 데이터 저장
  1538. /// </summary>
  1539. /// <param name="eptXmlValue"></param>
  1540. /// <param name="dataValue"></param>
  1541. public override void SaveTempConsentData(string eptXmlValue, string dataValue) {
  1542. //int state = this.consentWebService.CheckConsentState(int.Parse(this.CurrentPreviewConsent.ConsentMstRid), this.CurrentPreviewConsent.ConsentState);
  1543. SingleReturnData returnData = this.consentWebService.CheckConsentState(int.Parse(this.CurrentPreviewConsent.consentMstRid), this.CurrentPreviewConsent.consentState);
  1544. int state = Int32.Parse(returnData.responseData);
  1545. if(state == 1) {
  1546. MessageBoxDlg.Show(this, "이미 저장된 서식 입니다."
  1547. , string.Format(Properties.Resources.msg_caption_confirm),
  1548. MessageBoxButtons.OK, MessageBoxIcon.Information);
  1549. return;
  1550. }
  1551. //string userId = CurrentEndUser.UserNo;
  1552. //string userId = this.consentMain.ConsentExecuteInfo["loginUserNo"];
  1553. //string userName = this.consentMain.ConsentExecuteInfo["loginUserName"];
  1554. string userId = this.consentMain.ConsentExecuteInfo["loginUserNo"];
  1555. string userName = this.consentMain.ConsentExecuteInfo["loginUserName"];
  1556. string deptCd = this.consentMain.ConsentExecuteInfo["userDeptCd"];
  1557. string hosType = this.consentMain.ConsentExecuteInfo["dutinstcd"];
  1558. UserVO userVo = hospitalWebService.GetUserInfo(userId, hosType, deptCd);
  1559. //if (string.IsNullOrEmpty(userName)) {
  1560. // var date = CurrentTargetPatient.clnDate;
  1561. // userName = userVo.userName;
  1562. //}
  1563. /**
  1564. * 선택된 환자의 진료의가 퇴직한 경우 사용자 정보를 가져올 수 없어 로그인 한 사용자의 정보를 매핑하여 준다
  1565. */
  1566. var tmpOrddeptcd = CurrentEndUser?.DeptCode ?? String.Empty;
  1567. if (String.IsNullOrEmpty(tmpOrddeptcd)) {
  1568. userName = this.consentMain.ConsentExecuteInfo["loginUserName"];
  1569. deptCd = this.consentMain.ConsentExecuteInfo["userDeptCd"];
  1570. }
  1571. else {
  1572. deptCd = tmpOrddeptcd;
  1573. }
  1574. string patientCode = CurrentTargetPatient.PatientCode;
  1575. string clnDeptCode = CurrentTargetPatient.clnDeptCode;
  1576. string vistType = CurrentTargetPatient.VisitType;
  1577. string clnDate = CurrentTargetPatient.clnDate.Replace("-", "");
  1578. int rewriteConsentMstRid = 0;
  1579. string ward = CurrentTargetPatient.Ward;
  1580. string roomcd = CurrentTargetPatient.RoomNo;
  1581. string formRid = CurrentPreviewConsent.formRid;
  1582. string formCd = CurrentPreviewConsent.formCd;
  1583. string consentMstRid = CurrentPreviewConsent.consentMstRid;
  1584. int orderNo = CurrentTargetPatient.OrderNo;
  1585. string orderCode = CurrentTargetPatient.clnDxCd;
  1586. string orderName = CurrentTargetPatient.clnDxNm;
  1587. string mainDrId = this.CurrentTargetPatient.MainDrId;
  1588. int.TryParse(CurrentTargetPatient.cretno, out int cretno);
  1589. ConvertStringToInt(formRid, consentMstRid, out int formRidInt, out int consentMstRidInt);
  1590. string deviceIdentNo = System.Environment.MachineName;
  1591. Cursor currentCursor = this.Cursor;
  1592. try {
  1593. this.Cursor = Cursors.WaitCursor;
  1594. string ocrCode = CurrentPreviewConsent.ocrCode;
  1595. if(string.IsNullOrEmpty(ocrCode)) {
  1596. ocrCode = CurrentPreviewConsent.ocrCode = GetOcrCode();
  1597. }
  1598. SingleReturnData returnData2 = this.consentWebService.SaveTempData(userId
  1599. , patientCode
  1600. , clnDeptCode
  1601. , formRidInt
  1602. , formCd
  1603. , consentMstRidInt
  1604. , rewriteConsentMstRid
  1605. , eptXmlValue
  1606. , dataValue
  1607. , consentMain.ConsentExecuteInfo["DeviceType"] //"WIN"
  1608. , deviceIdentNo
  1609. , vistType
  1610. , consentMain.ConsentExecuteInfo["dutinstcd"]
  1611. , clnDate
  1612. , ward
  1613. , roomcd
  1614. , orderNo
  1615. , orderName
  1616. , orderCode
  1617. , ocrCode
  1618. , cretno
  1619. , userName
  1620. , userName
  1621. , mainDrId
  1622. , deptCd
  1623. , consentMain.GetTotalPageCount().ToString()
  1624. , "T"
  1625. , "P" // 임시저장 시 P 상태로 기록, 스캔 매수 입력 하도록 설정
  1626. , CurrentTargetPatient.OpRsrvNo
  1627. // dbs227, 확인 저장 시 일괄저장이 가능하도록 ELECTR_CMP 상태로 바꿈
  1628. , m_IsComplete ? "ELECTR_CMP" : "");
  1629. consentMstRidInt = Int32.Parse(returnData2.responseData);
  1630. // 현재 사용하지 않음
  1631. //기왕력 데이터 저장
  1632. //SetNewMedicalHistory(dataValue);
  1633. // 작성 완료 시
  1634. if(m_IsComplete) {
  1635. MessageBoxDlg.Show(this, string.Format(Properties.Resources.msg_confirm_save_confirm)
  1636. , string.Format(Properties.Resources.msg_caption_confirm),
  1637. MessageBoxButtons.OK, MessageBoxIcon.Information);
  1638. // 작성 완료 시는 이력 탭 보기
  1639. this.consentMain.ConsentListCtrl.InquiryConsentData(0);
  1640. }
  1641. else {
  1642. if (consentMain.multiParams == null)
  1643. {
  1644. this.consentMain.ConsentListCtrl.InquiryConsentData(consentMstRidInt);
  1645. }
  1646. // Ku2.0 연동 시에는 메시지를 띄우지 않는다
  1647. if(consentMain.ConsentExecuteInfo["printYN"].Equals("Y")) {
  1648. MessageBoxDlg.Show(this, string.Format(Properties.Resources.msg_temp_save_confirm)
  1649. , string.Format(Properties.Resources.msg_caption_confirm),
  1650. MessageBoxButtons.OK, MessageBoxIcon.Information);
  1651. }
  1652. }
  1653. }
  1654. catch(Exception ex) {
  1655. throw ex;
  1656. }
  1657. finally {
  1658. this.Cursor = currentCursor;
  1659. }
  1660. }
  1661. /// <summary>
  1662. /// 현재의 문진기록을 저장한다
  1663. /// </summary>
  1664. /// <param name="dataXml">The data XML.</param>
  1665. private void SetNewMedicalHistory(string dataXml) {
  1666. Dictionary<FOSParameter, string> outputDataDic = DataXmlToDictionary(dataXml);
  1667. if(outputDataDic.ContainsKey(FOSParameter.BP)) this.CurrentTargetPatient.Ex_bp = outputDataDic[FOSParameter.BP];
  1668. if(outputDataDic.ContainsKey(FOSParameter.DM)) this.CurrentTargetPatient.Ex_dm = outputDataDic[FOSParameter.DM];
  1669. if(outputDataDic.ContainsKey(FOSParameter.Heart)) this.CurrentTargetPatient.Ex_heart = outputDataDic[FOSParameter.Heart];
  1670. if(outputDataDic.ContainsKey(FOSParameter.Kidney)) this.CurrentTargetPatient.Ex_kidney = outputDataDic[FOSParameter.Kidney];
  1671. if(outputDataDic.ContainsKey(FOSParameter.Respiration)) this.CurrentTargetPatient.Ex_respiration = outputDataDic[FOSParameter.Respiration];
  1672. if(outputDataDic.ContainsKey(FOSParameter.MedicalHistory)) this.CurrentTargetPatient.Ex_hx = outputDataDic[FOSParameter.MedicalHistory];
  1673. if(outputDataDic.ContainsKey(FOSParameter.Allergy)) this.CurrentTargetPatient.Ex_allergy = outputDataDic[FOSParameter.Allergy];
  1674. if(outputDataDic.ContainsKey(FOSParameter.Drug)) this.CurrentTargetPatient.Ex_drug = outputDataDic[FOSParameter.Drug];
  1675. if(outputDataDic.ContainsKey(FOSParameter.Smoking)) this.CurrentTargetPatient.Ex_smoking = outputDataDic[FOSParameter.Smoking];
  1676. if(outputDataDic.ContainsKey(FOSParameter.Idiosyncrasy)) this.CurrentTargetPatient.Ex_idio = outputDataDic[FOSParameter.Idiosyncrasy];
  1677. if(outputDataDic.ContainsKey(FOSParameter.Nacrotics)) this.CurrentTargetPatient.Ex_nacrotics = outputDataDic[FOSParameter.Nacrotics];
  1678. if(outputDataDic.ContainsKey(FOSParameter.Airway)) this.CurrentTargetPatient.Ex_airway = outputDataDic[FOSParameter.Airway];
  1679. if(outputDataDic.ContainsKey(FOSParameter.Hemorrhage)) this.CurrentTargetPatient.Ex_hemorrhage = outputDataDic[FOSParameter.Hemorrhage];
  1680. if(outputDataDic.ContainsKey(FOSParameter.EtcStatus)) this.CurrentTargetPatient.Ex_status_etc = outputDataDic[FOSParameter.EtcStatus];
  1681. }
  1682. /// <summary>
  1683. /// Data XML을 Dictionary 타입으로 변환하여 반환
  1684. /// </summary>
  1685. /// <param name="dataXml">변환될 Data XML</param>
  1686. /// <returns></returns>
  1687. private static Dictionary<FOSParameter, string> DataXmlToDictionary(string dataXml) {
  1688. Dictionary<FOSParameter, string> outputDataDic;
  1689. XmlDocument xmlDocument = new XmlDocument();
  1690. xmlDocument.LoadXml(dataXml);
  1691. outputDataDic = outputDataDic = new Dictionary<FOSParameter, string>();
  1692. XmlNode rootNode = xmlDocument.SelectSingleNode("form-data");
  1693. foreach(XmlNode childNode in rootNode.ChildNodes) {
  1694. string fieldName = string.Empty;
  1695. string fieldValue = string.Empty;
  1696. XmlElement outFieldElement = childNode as XmlElement;
  1697. if(outFieldElement == null) {
  1698. }
  1699. else {
  1700. fieldName = outFieldElement.Name;
  1701. if(fieldName.Equals("state")) {
  1702. foreach(XmlNode childNode2 in childNode.ChildNodes) {
  1703. XmlElement outFieldElement2 = childNode2 as XmlElement;
  1704. FOSParameter fieldName2 = (FOSParameter)Enum.Parse(typeof(FOSParameter), outFieldElement2.Name);
  1705. string fieldValue2 = string.Empty;
  1706. if(outFieldElement2.ChildNodes.Count > 0
  1707. && outFieldElement2.ChildNodes[0] is XmlCDataSection) {
  1708. fieldValue2 = ((XmlCDataSection)outFieldElement2.ChildNodes[0]).InnerText;
  1709. }
  1710. if(outputDataDic.ContainsKey(fieldName2)) {
  1711. outputDataDic[fieldName2] = fieldValue2;
  1712. }
  1713. else {
  1714. outputDataDic.Add(fieldName2, fieldValue2);
  1715. }
  1716. }
  1717. }
  1718. }
  1719. }
  1720. return outputDataDic;
  1721. }
  1722. /// <summary>
  1723. /// 동의서 완료 데이터 저장
  1724. /// </summary>
  1725. /// <param name="eptXmlValue"></param>
  1726. /// <param name="dataValue"></param>
  1727. public override bool SaveCompleteConsentData(string eptXmlValue, string dataValue, out object saveResult) {
  1728. int translateResult = -1;
  1729. string sCertTarget = string.Empty;
  1730. string sCertResult = string.Empty;
  1731. string consentState = "ELECTR_CMP";
  1732. string sizeValue = string.Empty;
  1733. try {
  1734. // 인증저장된 이미지 파일을 서버로 전송
  1735. translateResult = TranslateConsentToImageServer(exportedImageFiles, sCertResult, out string fileSizes);
  1736. sizeValue = fileSizes;
  1737. }
  1738. catch(Exception ex) {
  1739. string exMessage = ex.Message;
  1740. if(ex.InnerException != null) {
  1741. exMessage += Environment.NewLine + ex.InnerException.Message;
  1742. }
  1743. MessageBoxDlg.Show(true, string.Format(exMessage)
  1744. , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail),
  1745. MessageBoxButtons.OK, MessageBoxIcon.Error);
  1746. saveResult = translateResult;
  1747. return false;
  1748. }
  1749. // TODO 원무 인증 저장 pass
  1750. // 원무 인증저장일 경우 인증 저장 pass
  1751. if(this.consentWebService.getCertUseYn(this.currentPreviewConsent.formCd,
  1752. consentMain.ConsentExecuteInfo["dutinstcd"]) == "Y")
  1753. //if (false)
  1754. {
  1755. consentState = "CERTIFY_CMP";
  1756. }
  1757. else if(this.m_IsComplete) {
  1758. // 인증저장 시 공인인증 처리 하지 않는다.
  1759. }
  1760. // 원무 인증저장이 아닐경우 기존루틴
  1761. else {
  1762. SignatureConfig sign = new SignatureConfig();
  1763. try {
  1764. // 공인인증 처리용
  1765. sCertTarget = sign.getSHA256ImageHash(exportedImageFiles, string.Empty);
  1766. // 공인인증 처리
  1767. sCertResult = ConsentImageSignature(sCertTarget, CurrentEndUser.UserNo, CurrentEndUser.UserName);
  1768. if(sCertResult == "-10") {
  1769. // "로그인 사용자 정보를 통하여 공인인증서 정보가 정상적으로 조회되지 않았습니다."
  1770. MessageBoxDlg.Show(true, Properties.Resources.msg_sign_user_info_fail
  1771. , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail),
  1772. MessageBoxButtons.OK, MessageBoxIcon.Error);
  1773. saveResult = "-99";
  1774. return true;
  1775. }
  1776. else if(sCertResult == "-20") {
  1777. // "공인인증 서버 접속에 실패하였을 하였습니다."
  1778. MessageBoxDlg.Show(true, Properties.Resources.msg_sign_server_connection_fail
  1779. , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail),
  1780. MessageBoxButtons.OK, MessageBoxIcon.Error);
  1781. saveResult = "-99";
  1782. return true;
  1783. }
  1784. else if(sCertResult == "-30") {
  1785. // "공인인증 서버 접속에 실패하였을 하였습니다."
  1786. MessageBoxDlg.Show(true, Properties.Resources.msg_sign_server_connection_fail
  1787. , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail),
  1788. MessageBoxButtons.OK, MessageBoxIcon.Error);
  1789. saveResult = "-99";
  1790. return true;
  1791. }
  1792. else if(sCertResult == "-35") {
  1793. // 공인인증 비밀번호 입력하지 않고 닫음
  1794. saveResult = "-99";
  1795. return true;
  1796. }
  1797. else if(sCertResult == "-40") {
  1798. // "공인인증서 비밀번호가 틀렸습니다.
  1799. MessageBoxDlg.Show(true, Properties.Resources.msg_sign_password_fail
  1800. , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail),
  1801. MessageBoxButtons.OK, MessageBoxIcon.Error);
  1802. saveResult = "-99";
  1803. return true;
  1804. }
  1805. else if(sCertResult == "-50") {
  1806. // "공인인증서명 처리를 실패하였을 하였습니다."
  1807. MessageBoxDlg.Show(true, Properties.Resources.msg_sign_exec_fail
  1808. , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail),
  1809. MessageBoxButtons.OK, MessageBoxIcon.Error);
  1810. saveResult = "-99";
  1811. return true;
  1812. }
  1813. else if(sCertResult == "-99") {
  1814. // "공인인증서명 처리를 실패하였을 하였습니다."
  1815. MessageBoxDlg.Show(true, Properties.Resources.msg_sign_exec_fail
  1816. , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail),
  1817. MessageBoxButtons.OK, MessageBoxIcon.Error);
  1818. saveResult = "-99";
  1819. return true;
  1820. }
  1821. translateResult = 1;
  1822. // 확인저장이 아니라면 인증저장이다
  1823. if(!m_IsComplete) {
  1824. consentState = "CERTIFY_CMP";
  1825. }
  1826. }
  1827. catch(Exception ex) {
  1828. string exMessage = ex.Message;
  1829. if(ex.InnerException != null) {
  1830. exMessage += Environment.NewLine + ex.InnerException.Message;
  1831. }
  1832. MessageBoxDlg.Show(true, string.Format(exMessage)
  1833. , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail),
  1834. MessageBoxButtons.OK, MessageBoxIcon.Error);
  1835. saveResult = translateResult;
  1836. return false;
  1837. }
  1838. // DB 저장용
  1839. sCertTarget = sign.getSHA256ImageHash(exportedImageFiles, "^");
  1840. }
  1841. //string userId = CurrentEndUser.UserNo;
  1842. //string userName = CurrentEndUser.UserName;
  1843. string userId = this.consentMain.ConsentExecuteInfo["loginUserNo"];
  1844. string userName = this.consentMain.ConsentExecuteInfo["loginUserName"];
  1845. string deptCd = this.consentMain.ConsentExecuteInfo["userDeptCd"];
  1846. string hosType = consentMain.ConsentExecuteInfo["dutinstcd"];
  1847. UserVO userVo = hospitalWebService.GetUserInfo(userId, hosType, deptCd);
  1848. //if (string.IsNullOrEmpty(userName)) {
  1849. // var date = CurrentTargetPatient.clnDate;
  1850. // userName = userVo.userName;
  1851. //}
  1852. /**
  1853. * 선택된 환자의 진료의가 퇴직한 경우 사용자 정보를 가져올 수 없어 로그인 한 사용자의 정보를 매핑하여 준다
  1854. */
  1855. var tmpOrddeptcd = CurrentEndUser?.DeptCode ?? String.Empty;
  1856. if (String.IsNullOrEmpty(tmpOrddeptcd)) {
  1857. userName = this.consentMain.ConsentExecuteInfo["loginUserName"];
  1858. deptCd = this.consentMain.ConsentExecuteInfo["userDeptCd"];
  1859. }
  1860. else {
  1861. deptCd = tmpOrddeptcd;
  1862. }
  1863. string patientCode = CurrentTargetPatient.PatientCode;
  1864. string clnDeptCode = CurrentTargetPatient.clnDeptCode;
  1865. string vistType = CurrentTargetPatient.VisitType;
  1866. string clnDate = CurrentTargetPatient.clnDate.Replace("-", "").Replace("/", "");
  1867. string ward = CurrentTargetPatient.Ward;
  1868. string roomcd = CurrentTargetPatient.RoomNo;
  1869. string formRid = CurrentPreviewConsent.formRid;
  1870. string formCd = CurrentPreviewConsent.formCd;
  1871. string consentMstRid = CurrentPreviewConsent.consentMstRid;
  1872. int rewriteConsentMstRid = CurrentPreviewConsent.RewriteConsentMstRid;
  1873. int orderNo = CurrentTargetPatient.OrderNo;
  1874. string orderCode = CurrentTargetPatient.clnDxCd;
  1875. string orderName = CurrentTargetPatient.clnDxNm;
  1876. string dschdd = CurrentTargetPatient.Dschdd;
  1877. string mainDrId = this.CurrentTargetPatient.MainDrId;
  1878. string actKind = (consentState.Equals("CERTIFY_CMP") ? "C" : "T");
  1879. //string ocrCode = CurrentPreviewConsent.Ocrcode;
  1880. //if (string.IsNullOrEmpty(ocrCode)) {
  1881. // ocrCode = CurrentPreviewConsent.Ocrcode = GetOcrCode();
  1882. //}
  1883. int.TryParse(CurrentTargetPatient.cretno, out int cretno);
  1884. ConvertStringToInt(formRid, consentMstRid, out int formRidInt, out int consentMstRidInt);
  1885. string deviceIdentNo = System.Environment.MachineName;
  1886. Cursor currentCursor = this.Cursor;
  1887. try {
  1888. this.Cursor = Cursors.WaitCursor;
  1889. string ocrCode = CurrentPreviewConsent.ocrCode;
  1890. if(string.IsNullOrEmpty(ocrCode)) {
  1891. ocrCode = CurrentPreviewConsent.ocrCode = GetOcrCode();
  1892. }
  1893. SingleReturnData returnData = this.consentWebService.SaveCompleteAll(userId
  1894. , patientCode
  1895. , clnDeptCode
  1896. , formRidInt
  1897. , formCd
  1898. , consentMstRidInt
  1899. , rewriteConsentMstRid
  1900. , eptXmlValue
  1901. , dataValue
  1902. , consentMain.ConsentExecuteInfo["DeviceType"] //"WIN"
  1903. , deviceIdentNo
  1904. , vistType
  1905. , consentMain.ConsentExecuteInfo["dutinstcd"] //hosType, hostype 대신 근무지기관코드를 전송한다
  1906. , clnDate
  1907. , ward
  1908. , roomcd
  1909. , orderNo
  1910. , orderName
  1911. , orderCode
  1912. , ocrCode
  1913. , cretno
  1914. , userName
  1915. , userName
  1916. , this.exportedImageFilesJson
  1917. , sCertTarget
  1918. , sCertResult
  1919. , dschdd
  1920. , consentState
  1921. , mainDrId
  1922. , deptCd // CurrentEndUser.DeptCode
  1923. , consentMain.GetTotalPageCount().ToString()
  1924. , actKind
  1925. , "P"
  1926. , CurrentTargetPatient.OpRsrvNo
  1927. , sizeValue);
  1928. consentMstRidInt = Int32.Parse(returnData.responseData);
  1929. // 기왕력 데이터 저장 sPID
  1930. //SetNewMedicalHistory(dataValue);
  1931. if (consentMain.multiParams == null)
  1932. {
  1933. // 인증 저장 후에는 이력 탭 설정
  1934. this.consentMain.ConsentListCtrl.InquiryConsentData(0);
  1935. }
  1936. // dbs227
  1937. // TODO 인증저장 후 종료 메시지 및 닫기 버튼
  1938. //MessageBoxDlg.Show(this, string.Format(Properties.Resources.msg_esign_N_comp_save_confirm)
  1939. // , string.Format(Properties.Resources.msg_caption_confirm),
  1940. // MessageBoxButtons.OK, MessageBoxIcon.Information);
  1941. // 확인 저장 시 닫기 버튼 활성화 하지 않는다.
  1942. if(!consentState.Equals("ELECTR_CMP")) {
  1943. //연속서식의 경우 모든 서식을 작성할 때 까지 메시지를 띄우지 않는다.
  1944. if (consentMain.multiParams != null)
  1945. {
  1946. int page = 0;
  1947. Dictionary<string, object> pageParam = consentMain.multiParams[consentMain.multiParams.Count - 1];
  1948. if (pageParam.ContainsKey("PAGE_COUNT"))
  1949. {
  1950. page = Int32.TryParse(pageParam["PAGE_COUNT"].ToString(), out int pageNumber) ? pageNumber : -1;
  1951. }
  1952. else
  1953. {
  1954. MessageBox.Show("연속서식 페이지오류", Properties.Resources.msg_caption_fail, MessageBoxButtons.OK, MessageBoxIcon.Error);
  1955. saveResult = "-99";
  1956. return true;
  1957. }
  1958. if ((consentMain.multiParams.Count - 2) == page)
  1959. {
  1960. MessageBox.Show("모든 서식을 저장하였습니다, 확인을 누르면 종료합니다.",
  1961. string.Format(Properties.Resources.msg_caption_confirm),
  1962. MessageBoxButtons.OK, MessageBoxIcon.Information);
  1963. this.consentMain.Parent_Disposed();
  1964. }
  1965. }
  1966. else
  1967. {
  1968. DialogResult dialogResult = MessageBoxDlg.Show(this, string.Format(Properties.Resources.msg_esign_N_comp_save_confirm)
  1969. , string.Format(Properties.Resources.msg_caption_confirm),
  1970. MessageBoxButtons.YesNo, MessageBoxIcon.Information);
  1971. if (dialogResult == DialogResult.Yes)
  1972. {
  1973. if (this.consentMain.ConsentExecuteInfo["printAct"].Equals("Y"))
  1974. {
  1975. this.consentMain.Parent_Disposed();
  1976. }
  1977. else
  1978. {
  1979. this.ParentForm.WindowState = FormWindowState.Minimized;
  1980. }
  1981. }
  1982. }
  1983. }
  1984. if (consentMain.multiParams == null)
  1985. {
  1986. this.consentMain.ReInitializeViewer();
  1987. }
  1988. }
  1989. catch(Exception ex) {
  1990. throw ex;
  1991. }
  1992. finally {
  1993. this.Cursor = currentCursor;
  1994. try {
  1995. if(!string.IsNullOrEmpty(exportedImageFiles)) {
  1996. string[] imgFile = exportedImageFiles.Split('^');
  1997. if(imgFile != null && imgFile.Length > 0) {
  1998. FileInfo fileInfo;
  1999. foreach(string sImgFileName in imgFile) {
  2000. fileInfo = new FileInfo(sImgFileName);
  2001. if(fileInfo != null) {
  2002. // 이미지 파일 삭제
  2003. fileInfo.Delete();
  2004. }
  2005. }
  2006. fileInfo = new FileInfo(imgFile[0].Replace("_0.jpg", ".xml"));
  2007. if(fileInfo != null) {
  2008. // EPT 파일 삭제
  2009. fileInfo.Delete();
  2010. }
  2011. }
  2012. }
  2013. }
  2014. catch(System.IO.IOException e) {
  2015. throw e;
  2016. }
  2017. }
  2018. saveResult = 1;
  2019. return true;
  2020. }
  2021. /// <summary>
  2022. /// 전자서명을 한다
  2023. /// </summary>
  2024. /// <param name="sCertTarget">전자서명 대상</param>
  2025. /// <param name="userId">사용자ID</param>
  2026. /// <param name="userName">사용자 이름</param>
  2027. /// <returns>전자서명의 결과값</returns>
  2028. private string ConsentImageSignature(string sCertTarget, string userId, string userName) {
  2029. string resultValue = string.Empty;
  2030. try {
  2031. if(!string.IsNullOrEmpty(sCertTarget)) {
  2032. // 공인인증 서명
  2033. SignatureConfig sign = new SignatureConfig();
  2034. string rtn = "";
  2035. // 메모리에 본인 공인인증서가 아닐 경우
  2036. string sSignIp = consentMain.PluginExecuteInfo["signatureServerUrl"];
  2037. string sSignPort = consentMain.PluginExecuteInfo["signatureServerPort"];
  2038. int iPort = 0;
  2039. int.TryParse(sSignPort, out iPort);
  2040. // 공인인증 서버 접속
  2041. rtn = sign.SetSignServerInfo(sSignIp, iPort, userId);
  2042. // 공인인증 서명
  2043. resultValue = sign.SignatureExec(sCertTarget, rtn, userName, userId, this.consentMain.saveClickPoint);
  2044. if(string.IsNullOrEmpty(resultValue) || resultValue == "-1") {
  2045. // 공인인증 서명에 실패하였을 경우
  2046. return "-50";
  2047. }
  2048. }
  2049. }
  2050. catch(Exception ex) {
  2051. MessageBoxDlg.Show(true, string.Format(ex.Message)
  2052. , string.Format(Properties.Resources.msg_caption_confirm),
  2053. MessageBoxButtons.OK, MessageBoxIcon.Information);
  2054. resultValue = "-99";
  2055. }
  2056. return resultValue;
  2057. }
  2058. /// <summary>
  2059. /// 서버로 이미지 파일 전송
  2060. /// </summary>
  2061. /// <param name="exportedImageFiles">전송할 이미지 파일</param>
  2062. /// <param name="sCertResult">공인인증 결과</param>
  2063. /// <returns></returns>
  2064. private int TranslateConsentToImageServer(string exportedImageFiles, string sCertResult, out string fileSizes) {
  2065. int resultValue = -1;
  2066. fileSizes = string.Empty;
  2067. if(!string.IsNullOrEmpty(exportedImageFilesJson) && !string.IsNullOrEmpty(exportedImageFiles)) {
  2068. Dictionary<string, object> jsonRoot = null;
  2069. try {
  2070. jsonRoot = fastJSON.JSON.Parse(exportedImageFilesJson) as Dictionary<string, object>;
  2071. if(jsonRoot != null && jsonRoot.Count > 0) {
  2072. string sPath = string.Empty;
  2073. string sFileName = string.Empty;
  2074. string[] sFullPath = exportedImageFiles.Split('^');
  2075. int k = 0;
  2076. foreach(KeyValuePair<string, object> jr in jsonRoot) {
  2077. if(jr.Value != null && !string.IsNullOrEmpty(jr.Value.ToString())) {
  2078. sPath = string.Empty;
  2079. sFileName = string.Empty;
  2080. string[] filepath = jr.Value.ToString().Split('/');
  2081. for(int i = 0; i < filepath.Length; i++) {
  2082. if(i == 0) {
  2083. sPath = filepath[i];
  2084. }
  2085. else if((i + 1) == filepath.Length) {
  2086. sFileName = filepath[i];
  2087. }
  2088. else {
  2089. sPath += "/" + filepath[i];
  2090. }
  2091. }
  2092. //이미지를 서버에 업로드(전자동의서 서버에 저장)
  2093. System.Net.WebClient wcClient = new System.Net.WebClient();
  2094. string imageUploadServerUrl = this.consentMain.PluginExecuteInfo["imageUploadServerUrl"];
  2095. System.Collections.Specialized.NameValueCollection values = new System.Collections.Specialized.NameValueCollection();
  2096. values.Add("up_path", sPath + "/" + sFileName);
  2097. wcClient.QueryString = values;
  2098. var fileInfo = new FileInfo(sFullPath[k]);
  2099. if(k != 0) {
  2100. fileSizes += ",";
  2101. }
  2102. if(fileInfo != null) {
  2103. fileSizes += fileInfo.Length / 1024;
  2104. }
  2105. byte[] response = wcClient.UploadFile(imageUploadServerUrl, "POST", sFullPath[k++]);
  2106. }
  2107. }
  2108. }
  2109. }
  2110. catch(Exception) {
  2111. return resultValue = -99;
  2112. }
  2113. resultValue = 1;
  2114. }
  2115. return resultValue;
  2116. }
  2117. //private int TranslateConsentToImageServer(string exportedImageFiles, int consentMstRidInt, string sCertResult)
  2118. //{
  2119. // int resultValue = -1;
  2120. // if (!string.IsNullOrEmpty(exportedImageFiles))
  2121. // {
  2122. // string[] aryimgFile = exportedImageFiles.Split('^');
  2123. // if (aryimgFile != null && aryimgFile.Length > 0)
  2124. // {
  2125. // try
  2126. // {
  2127. // int consentImageRid_F = 0;
  2128. // string sCertTarget = "";
  2129. // for (int i = 0; i < aryimgFile.Length; i++)
  2130. // {
  2131. // string imgFile = aryimgFile[i];
  2132. // //MessageBox.Show(CurrentTargetPatient.PatientCode + "," + CurrentTargetPatient.VisitType + "," + CurrentTargetPatient.clnDate + "," + "20150815" + "," + CurrentTargetPatient.cretno + "," + "500" + "," + CurrentPreviewConsent.FormCd + "," + i.ToString() + "," + CurrentPreviewConsent.Ocrcode + "," + CurrentEndUser.UserNo);
  2133. // //LCTech 모듈을 위한 DB 작업을 하고 저장할 파일명을 얻는다.
  2134. // string newFileFullName = this.hospitalWebService.GetFileName(CurrentTargetPatient.PatientCode, CurrentTargetPatient.VisitType,
  2135. // CurrentTargetPatient.clnDate.Replace("-", ""), CurrentTargetPatient.Dschdd, CurrentTargetPatient.cretno,
  2136. // "500", CurrentPreviewConsent.FormCd, i.ToString(),
  2137. // CurrentPreviewConsent.Ocrcode, CurrentEndUser.UserNo);
  2138. // //MessageBox.Show(newFileFullName); //O:\fnuImage\201607\19\100501967
  2139. // string uploadFileName = newFileFullName + ".jpg";
  2140. // if (string.IsNullOrEmpty(newFileFullName))
  2141. // {
  2142. // return -10;
  2143. // }
  2144. // //이미지 정보 DB에 저장
  2145. // int consentImageRid = this.consentWebService.SaveImageUploadInfo("ELECTR_CMP", uploadFileName,
  2146. // consentMstRidInt, CurrentEndUser.UserNo, int.Parse(CurrentPreviewConsent.FormRid));
  2147. // /*
  2148. // //저장된 이미지에서 해쉬정보 추출
  2149. // string sCertTarget = GetImageCertification(imgFile);
  2150. // //해쉬정보 DB에 저장
  2151. // this.consentWebService.SaveImageSignInfo("ELECTR_CMP", consentMstRidInt, consentImageRid,
  2152. // CurrentEndUser.UserNo, sCertTarget);
  2153. // */
  2154. // if (i == 0) consentImageRid_F = consentImageRid; //첫번째 consentImageRid 를 저장한다.
  2155. // sCertTarget += GetImageCertification(imgFile) + "^";
  2156. // //이미지를 서버에 업로드(서버에서 나스에 저장)
  2157. // System.Net.WebClient wcClient = new System.Net.WebClient();
  2158. // string imageUploadServerUrl = this.consentMain.PluginExecuteInfo["imageUploadServerUrl"];
  2159. // System.Collections.Specialized.NameValueCollection values = new System.Collections.Specialized.NameValueCollection();
  2160. // values.Add("up_path", uploadFileName);
  2161. // wcClient.QueryString = values;
  2162. // wcClient.UploadFile(imageUploadServerUrl, "POST", imgFile);
  2163. // File.Delete(imgFile);
  2164. // }
  2165. // // 외래일 경우 공인인증 처리가 없음.
  2166. // if (!string.IsNullOrEmpty(CurrentTargetPatient.VisitType) && !CurrentTargetPatient.VisitType.Equals("O"))
  2167. // {
  2168. // sCertTarget = sCertTarget.Substring(0, sCertTarget.Length - 1);
  2169. // this.consentWebService.SaveImageSignInfo("ELECTR_CMP", consentMstRidInt, consentImageRid_F,
  2170. // CurrentEndUser.UserNo, sCertTarget, sCertResult);
  2171. // }
  2172. // resultValue = 1;
  2173. // }
  2174. // catch (Exception err)
  2175. // {
  2176. // resultValue = -99;
  2177. // throw err;
  2178. // }
  2179. // }
  2180. // }
  2181. // return resultValue;
  2182. //}
  2183. /// <summary>
  2184. /// 공인인증 이미지를 가져옴
  2185. /// 사용되는 곳 없음
  2186. /// </summary>
  2187. /// <param name="exportedImageFile">The exported image file.</param>
  2188. /// <returns></returns>
  2189. private string GetImageCertification(string exportedImageFile) {
  2190. try {
  2191. FileStream fileStream = null;
  2192. fileStream = new FileStream(exportedImageFile, FileMode.Open);
  2193. fileStream.Position = 0;
  2194. SHA256 mySHA256 = SHA256Managed.Create();
  2195. byte[] hashValue = mySHA256.ComputeHash(fileStream);
  2196. fileStream.Close();
  2197. return byteArrayToString(hashValue);
  2198. }
  2199. catch(Exception ex) {
  2200. string exMessage = ex.Message;
  2201. if(ex.InnerException != null) {
  2202. exMessage += Environment.NewLine + ex.InnerException.Message;
  2203. }
  2204. return exMessage;
  2205. }
  2206. }
  2207. private string byteArrayToString(byte[] bStr) {
  2208. string hexOutput = string.Empty;
  2209. foreach(char letter in bStr) {
  2210. int value = Convert.ToInt32(letter);
  2211. hexOutput += String.Format("{0:x}", value);
  2212. }
  2213. return hexOutput;
  2214. }
  2215. /// <summary>
  2216. /// 이미지 업로드시 사용될 exportedImageFilesJson 객체에 JSON 스타일로 값을 설정
  2217. /// </summary>
  2218. /// <param name="savedImageFileDescription">저장될 이미지 파일 설명</param>
  2219. public override void WorkExtraWithSavedImageFiles(string savedImageFileDescription) {
  2220. string[] aryImageInfo = savedImageFileDescription.Split(';');
  2221. Dictionary<string, string> dicImageInfo = new Dictionary<string, string>();
  2222. foreach(string imageInfo in aryImageInfo) {
  2223. string[] aryInfo = imageInfo.Split('=');
  2224. if(aryInfo.Length == 2) {
  2225. dicImageInfo.Add(aryInfo[0], aryInfo[1]);
  2226. }
  2227. }
  2228. int baseIndex = -1;
  2229. int.TryParse(dicImageInfo["base-index"], out baseIndex);
  2230. int totalFiles = -1;
  2231. int.TryParse(dicImageInfo["total-files"], out totalFiles);
  2232. if(baseIndex > -1 && totalFiles > 0) {
  2233. this.exportedImageFiles = string.Empty;
  2234. this.exportedImageFilesJson = "{ ";
  2235. string sUploadPath = string.Empty;
  2236. for(int i = baseIndex; i < baseIndex + totalFiles; i++) {
  2237. string exportedImageFile = string.Format("{0}\\{1}_{2}.{3}", dicImageInfo["path"], dicImageInfo["key"], i, dicImageInfo["extention"]);
  2238. exportedImageFiles += exportedImageFile;
  2239. sUploadPath = string.Format("{0}/{1}", DateTime.Now.ToString("yyyyMM"), DateTime.Now.ToString("dd"));
  2240. this.exportedImageFilesJson += string.Format("\"imageFile{0}\" : \"{1}/{2}_{3}.{4}\"", i, sUploadPath, dicImageInfo["key"], i, dicImageInfo["extention"]);
  2241. if(i + 1 < (baseIndex + totalFiles)) {
  2242. exportedImageFiles += "^";
  2243. this.exportedImageFilesJson += ", ";
  2244. }
  2245. }
  2246. this.exportedImageFilesJson += " }";
  2247. System.Diagnostics.Debug.WriteLine("Debug=> exportedImageFiles: " + this.exportedImageFiles);
  2248. System.Diagnostics.Debug.WriteLine("Debug=> exportedImageFilesJson: " + this.exportedImageFilesJson);
  2249. }
  2250. }
  2251. private void ConvertStringToInt(string formRid, string consentMstRid, out int formRidInt, out int consentMstRidInt) {
  2252. formRidInt = 0;
  2253. int.TryParse(formRid, out formRidInt);
  2254. consentMstRidInt = 0;
  2255. int.TryParse(consentMstRid, out consentMstRidInt);
  2256. }
  2257. /// <summary>
  2258. /// baseGlobalParams 의 딕셔너리 객체에 changingGlobalParams 의 딕셔너리 객체의 요소들을 변경함
  2259. /// 기존 baseGlobalParams 딕셔너리에 key 가 없으면 추가되지 않음
  2260. /// </summary>
  2261. /// <param name="baseGlobalParams">복사될 딕셔너리 객체</param>
  2262. /// <param name="changingGlobalParams">복사할 딕셔너리 객체</param>
  2263. private void ChangeGlobalParametersToNew(Dictionary<FOSParameter, string> baseGlobalParams, Dictionary<FOSParameter, string> changingGlobalParams) {
  2264. foreach(FOSParameter dicKey in changingGlobalParams.Keys) {
  2265. if(baseGlobalParams.ContainsKey(dicKey)) {
  2266. baseGlobalParams[dicKey] = changingGlobalParams[dicKey];
  2267. }
  2268. }
  2269. }
  2270. /// <summary>
  2271. /// 사용자에 따른 버튼 활성화
  2272. /// </summary>
  2273. private void SetEnableByUserType() {
  2274. // 기록 테이블의 출력 유무에 따른 서명버튼 활성화 처리
  2275. SetSaveButtonDisabledWhenPrintYN();
  2276. }
  2277. /// <summary>
  2278. /// 출력, 임시저장, 출력 버튼 활성화 여부 설정
  2279. /// </summary>
  2280. private void SetSaveButtonDisabledWhenPrintYN() {
  2281. // 뷰어 모드 적용
  2282. if(consentMain.ConsentExecuteInfo["readOnly"].Equals("Y")) {
  2283. this.toolStripButtons.Enabled = false;
  2284. return;
  2285. }
  2286. if(CurrentEndUser == null || CurrentPreviewConsent == null) {
  2287. return;
  2288. }
  2289. string printOnly = CurrentPreviewConsent.printOnly ?? string.Empty;
  2290. string consentState = CurrentPreviewConsent.consentState ?? string.Empty;
  2291. // 출력만 가능하게 설정
  2292. if(printOnly.Equals("Y")) {
  2293. this.toolStripButtonPrint.Enabled = true;
  2294. //this.toolStripButtonCompleteSaveToServer.Enabled = false;
  2295. this.toolStripButtonSaveToServer.Enabled = false;
  2296. this.toolStripButtonTempSaveToServer.Enabled = false;
  2297. this.toolStripButtonExecute.Enabled = false;
  2298. }
  2299. // 출력 상태일 경우 재출력만 가능하도록 버튼 조정
  2300. else if(consentState.ToUpper().Equals("PAPER_OUT")) {
  2301. this.toolStripButtonExecute.Enabled = false;
  2302. }
  2303. // 작성 완료일 경우 임시 저장 불가
  2304. else if(consentState.ToUpper().Equals("ELECTR_CMP")) {
  2305. this.toolStripButtonTempSaveToServer.Enabled = false;
  2306. }
  2307. }
  2308. private bool checkPrintablePatients(List<PatListVO> volist) {
  2309. foreach(PatListVO patInfo in volist) {
  2310. var cnt = hospitalWebService.checkPrintablePatient(consentMain.ConsentExecuteInfo["dutinstcd"],
  2311. patInfo.pid,
  2312. patInfo.inDd.Replace("/", "").Replace("-", ""),
  2313. patInfo.cretNo.ToString());
  2314. if(cnt > 0) {
  2315. return false;
  2316. }
  2317. }
  2318. return true;
  2319. }
  2320. /// <summary>
  2321. /// 동의서 출력
  2322. /// </summary>
  2323. private void PrintConsent() {
  2324. // 환자정보가 없을 경우 출력이 되지 않도록 적용
  2325. if(this.CurrentTargetPatient == null || string.IsNullOrEmpty(this.CurrentTargetPatient.PatientCode) || string.IsNullOrEmpty(this.CurrentTargetPatient.PatientName)) {
  2326. DialogResult result = MessageBox.Show(string.Format(Properties.Resources.msg_error_user_data)
  2327. , string.Format(Properties.Resources.msg_caption_fail),
  2328. MessageBoxButtons.OK, MessageBoxIcon.Information);
  2329. return;
  2330. }
  2331. // 출력 : patientInfo 를 기반으로 출력하는 경우와 환자목록에서 멀티선택 출력의 경우로 나눠야 한다.
  2332. List<PatListVO> volist = consentMain.PatientListCtrl.GetSelectedPatientList();
  2333. // 1명 출력할 경우
  2334. if(volist.Count == 1) {
  2335. if(this.CurrentPreviewConsent.consentMstRid != null
  2336. && !string.IsNullOrEmpty(this.CurrentPreviewConsent.consentMstRid)
  2337. && !this.CurrentPreviewConsent.consentMstRid.Equals("-1")
  2338. && !this.CurrentPreviewConsent.consentMstRid.Equals("0")) {
  2339. DialogResult result = MessageBox.Show(string.Format(Properties.Resources.msg_multi_print_fail)
  2340. , string.Format(Properties.Resources.msg_caption_fail),
  2341. MessageBoxButtons.OK, MessageBoxIcon.Information);
  2342. }
  2343. else {
  2344. PrintConsentDocument();
  2345. }
  2346. // 환자 목록에서 여러명을 체크박스로 선택하여 출력할 경우
  2347. }
  2348. else if(volist.Count > 0) {
  2349. var cnt = hospitalWebService.getMultiprintable(consentMain.ConsentExecuteInfo["dutinstcd"], CurrentPreviewConsent.formCd);
  2350. if(cnt < 1) {
  2351. MessageBox.Show("멀티출력 가능한 서식이 아닙니다. 전산실에 문의 하세요.");
  2352. return;
  2353. }
  2354. // 여러 환자 선택 시 출력 할 수 없는 수진이력이 있는지 확인한다.
  2355. if(!checkPrintablePatients(volist)) {
  2356. // 6961 [전자동의서]출력시 특정 진찰료 면제사유시 제어 switch
  2357. var runCount = hospitalWebService.checkHardcd(consentMain.ConsentExecuteInfo["dutinstcd"], "6961", "Y");
  2358. if(runCount > 0) {
  2359. MessageBox.Show("다중 선택된 환자 중 출력할 수 없는 수진이력이 있습니다.\n(문의: 의무기록팀)", "확인", MessageBoxButtons.OK);
  2360. return;
  2361. }
  2362. }
  2363. if(this.CurrentPreviewConsent.consentMstRid != null
  2364. && !string.IsNullOrEmpty(this.CurrentPreviewConsent.consentMstRid)
  2365. && !this.CurrentPreviewConsent.consentMstRid.Equals("-1")
  2366. && !this.CurrentPreviewConsent.consentMstRid.Equals("0")) {
  2367. DialogResult result = MessageBox.Show(string.Format(Properties.Resources.msg_multi_print_fail)
  2368. , string.Format(Properties.Resources.msg_caption_fail),
  2369. MessageBoxButtons.OK, MessageBoxIcon.Information);
  2370. }
  2371. else {
  2372. DialogResult result = MessageBox.Show(string.Format(Properties.Resources.msg_multi_print_question)
  2373. , string.Format(Properties.Resources.msg_caption_fail),
  2374. MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
  2375. if(result == DialogResult.OK) {
  2376. this.CurrentPreviewConsent.outputType = "MULTI";
  2377. MultiPrintConsentDocument(volist);
  2378. }
  2379. }
  2380. }
  2381. else {
  2382. PrintConsentDocument();
  2383. }
  2384. }
  2385. /// <summary>
  2386. /// 미리보기 데이터를 출력하는 경우
  2387. /// </summary>
  2388. public void PrintConsentDocument() {
  2389. Dictionary<string, Dictionary<FOSParameter, string>> formParamsList = new Dictionary<string, Dictionary<FOSParameter, string>>();
  2390. string[] formGuidList = new string[this.CurrentPreviewConsent.prntCnt];
  2391. var util = CLIP.eForm.Consent.Common.LoggingUtility.GetLoggingUtility("ERROR", log4net.Core.Level.Error, false);
  2392. for(int i = 0; i < this.CurrentPreviewConsent.prntCnt; i++) {
  2393. Dictionary<FOSParameter, string> formParams = Common.CreateGlobalParamsDictionary(consentMain.ConsentExecuteInfo["dutinstcd"]);
  2394. formGuidList[i] = this.CurrentPreviewConsent.formGuid;
  2395. SetPatientAndUser(formParams);
  2396. //formParams[FOSParameter.OCRCode] = this.CurrentPreviewConsent.Ocrcode = GetOcrCode();
  2397. if(i == 0) {
  2398. formParams[FOSParameter.OCRCode] = this.CurrentPreviewConsent.ocrCode = GetOcrCode();
  2399. if(!reprintStatus) {
  2400. int cnt = hospitalWebService.checkOcrDup(consentMain.ConsentExecuteInfo["dutinstcd"], CurrentPreviewConsent.ocrCode);
  2401. if(cnt > 0) {
  2402. MessageBox.Show("OCRTAG 중복 발생입니다. 환자를 다시 선택하여 주십시요.");
  2403. consentMain.ClearPreviewConsent(true);
  2404. return;
  2405. }
  2406. }
  2407. }
  2408. else {
  2409. var ocrStr = consentWebService.getOcrString(this.CurrentPreviewConsent.formCd,
  2410. consentMain.ConsentExecuteInfo["dutinstcd"]);
  2411. if(ocrStr == null) {
  2412. ocrStr = "[환자 보관용]";
  2413. }
  2414. else {
  2415. ocrStr = (ocrStr.Length < 0) ? "[환자 보관용]" : ocrStr;
  2416. }
  2417. //formParams[FOSParameter.OCRCode] = "[환자 보관용]";
  2418. formParams[FOSParameter.OCRCode] = ocrStr;
  2419. }
  2420. if(string.IsNullOrEmpty(this.CurrentPreviewConsent.ocrCode)) {
  2421. MessageBox.Show("OCRTAG 생성 오류. 전산실에 문의 하세요.");
  2422. consentMain.ClearPreviewConsent(true);
  2423. return;
  2424. }
  2425. formParams[FOSParameter.Device] = "P";
  2426. formParams[FOSParameter.PrintTime] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  2427. formParams[FOSParameter.PrintIp] = consentMain.ConsentExecuteInfo["printIP"];
  2428. if(i == 1) formParams[FOSParameter.PrintComment] = Properties.Resources.msg_print_comment_2;
  2429. else if(i == 2) formParams[FOSParameter.PrintComment] = Properties.Resources.msg_print_comment_3;
  2430. // dbs227, KNUH 프린터 출력 시 출력 일 시 제외
  2431. formParams[FOSParameter.PatientName] = string.Empty; // parCMDCHD_1PatientNm
  2432. // 전자동의서 상 이름이 안아올 경우 파라미터 필드를 parCMDCHD_1PatientNmFix 로 변경
  2433. // 단 파라미터 필드가 정의되어 있지 않는 경우 파라미터 필드를 추가하여 매핑
  2434. formParams[FOSParameter.ExplDrName] = string.Empty; // 설명의 이름 제거
  2435. formParams[FOSParameter.ExplDrTelNo] = string.Empty; // 설명의 전화번호 제거
  2436. formParams[FOSParameter.ExplDrSign] = string.Empty; // 설명의사 싸인 제거
  2437. formParamsList.Add((i + 1).ToString(), formParams);
  2438. util.WriteDebug(String.Format("{0}, {1}, {2}, {3}, {4}", formParams[FOSParameter.PrintTime],
  2439. formParams[FOSParameter.OCRCode],
  2440. formParams[FOSParameter.PatientCode],
  2441. CurrentTargetPatient.VisitType,
  2442. CurrentPreviewConsent.consentState ?? "NULL"));
  2443. }
  2444. string fosOcdcd = string.Empty;
  2445. string fos = Common.GetMultiFosString(formGuidList
  2446. , this.consentMain.PluginExecuteInfo["formServiceUrl"]
  2447. , null
  2448. , formParamsList
  2449. , consentMain.ConsentExecuteInfo["dutinstcd"]
  2450. , out fosOcdcd);
  2451. //PC클라이언트에서 프린트 출력을 눌렀을때 출력 데이타 입력 후 출력되게끔
  2452. if(this.consentMain.getPrintButton()) {
  2453. if(!CurrentPreviewConsent.ocrCode.Equals(fosOcdcd)) {
  2454. MessageBox.Show("OCRTAG 설정 오류 발생. 전산실에 문의 하세요.");
  2455. return;
  2456. }
  2457. this.consentMain.setPageCnt(CurrentPreviewConsent.prntCnt);
  2458. SaveDataForPrintedConsent(String.Empty);
  2459. }
  2460. this.consentMain.PrintConsentDocument(fos);
  2461. //util.CloseRoller();
  2462. // 화면 상에 보이는 데로 출력을 원하면 아래 로직 적용
  2463. //this.consentMain.PrintConsentDocument("");
  2464. }
  2465. //private int g_pageCnt = 0;
  2466. /// <summary>
  2467. /// 사용되지 않음
  2468. /// </summary>
  2469. public void PrintDirectConsentDocument() {
  2470. if(this.currentPreviewConsent == null || this.CurrentTargetPatient == null || this.CurrentEndUser == null) {
  2471. return;
  2472. }
  2473. //미리보기 데이터를 바로 출력하는 경우는 미작성상태인 경우로만 한다. (임시작성 이상의 경우는 바로 출력을 안하도록)
  2474. if(!this.currentPreviewConsent.consentState.ToUpper().Equals("UNFINISHED")) {
  2475. return;
  2476. }
  2477. int prntCnt = 0;
  2478. prntCnt = this.CurrentPreviewConsent.prntCnt;
  2479. int prntMsgCnt = 0;
  2480. if(!string.IsNullOrEmpty(this.consentMain.ConsentExecuteInfo["printList"])) {
  2481. if(!consentMain.ConsentExecuteInfo["prntCnt"].Equals("-1")) {
  2482. int.TryParse(this.consentMain.ConsentExecuteInfo["prntCnt"].ToString(), out prntCnt);
  2483. prntMsgCnt++;
  2484. }
  2485. }
  2486. Dictionary<string, Dictionary<FOSParameter, string>> formParamsList = new Dictionary<string, Dictionary<FOSParameter, string>>();
  2487. string[] formGuidList = new string[prntCnt];
  2488. string sOcrCd = string.Empty;
  2489. for(int i = 0; i < prntCnt; i++) {
  2490. Dictionary<FOSParameter, string> formParams = Common.CreateGlobalParamsDictionary(consentMain.ConsentExecuteInfo["dutinstcd"]);
  2491. Dictionary<FOSParameter, string> changingFormParams = new Dictionary<FOSParameter, string>();
  2492. SetPatientAndUser(formParams);
  2493. changingFormParams[FOSParameter.Device] = "P";
  2494. changingFormParams[FOSParameter.PrintTime] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  2495. changingFormParams[FOSParameter.PrintIp] = consentMain.ConsentExecuteInfo["printIP"];
  2496. if(i == 0) {
  2497. changingFormParams[FOSParameter.OCRCode] = this.CurrentPreviewConsent.ocrCode = GetOcrCode(); // OCR 코드
  2498. sOcrCd = this.CurrentPreviewConsent.ocrCode;
  2499. int cnt = hospitalWebService.checkOcrDup(consentMain.ConsentExecuteInfo["dutinstcd"], sOcrCd);
  2500. if(cnt > 0) {
  2501. MessageBox.Show("OCRTAG 중복 발생입니다. 환자를 다시 선택하여 주십시요.");
  2502. consentMain.ClearPreviewConsent(true);
  2503. return;
  2504. }
  2505. }
  2506. else {
  2507. changingFormParams[FOSParameter.OCRCode] = sOcrCd; //OCR코드
  2508. }
  2509. if(string.IsNullOrEmpty(this.CurrentPreviewConsent.ocrCode)) {
  2510. MessageBox.Show("OCRTAG 생성 오류. 전산실에 문의 하세요.");
  2511. consentMain.ClearPreviewConsent(true);
  2512. return;
  2513. }
  2514. if(prntMsgCnt == 1) changingFormParams[FOSParameter.PrintComment] = Properties.Resources.msg_print_comment_2;
  2515. else if(prntMsgCnt == 2) changingFormParams[FOSParameter.PrintComment] = Properties.Resources.msg_print_comment_3;
  2516. ChangeGlobalParametersToNew(formParams, changingFormParams);
  2517. formGuidList[i] = this.CurrentPreviewConsent.formGuid;
  2518. formParamsList.Add((i + 1).ToString(), formParams);
  2519. prntMsgCnt++;
  2520. }
  2521. string fos = Common.GetMultiFosString(formGuidList
  2522. , this.consentMain.PluginExecuteInfo["formServiceUrl"]
  2523. , null
  2524. , formParamsList
  2525. , consentMain.ConsentExecuteInfo["dutinstcd"]);
  2526. this.consentMain.PrintDirect(fos);
  2527. }
  2528. /// <summary>
  2529. /// 단일 서식 다중 환자 출력
  2530. /// </summary>
  2531. /// <param name="voList">환자 목록 리스트</param>
  2532. private void MultiPrintConsentDocument(List<PatListVO> voList) {
  2533. Dictionary<string, Dictionary<FOSParameter, string>> formParamsList = new Dictionary<string, Dictionary<FOSParameter, string>>();
  2534. List<string> formGuids = new List<string>();
  2535. int guidCnt = 0;
  2536. if(voList.Count > 0 && this.CurrentPreviewConsent.prntCnt > 0) {
  2537. guidCnt = voList.Count * this.CurrentPreviewConsent.prntCnt;
  2538. }
  2539. string[] formGuidList = new string[guidCnt];
  2540. int prntCnt = 0;
  2541. string sOcrCd = string.Empty;
  2542. for(int i = 0; i < voList.Count; i++) {
  2543. sOcrCd = string.Empty;
  2544. for(int j = 0; j < this.CurrentPreviewConsent.prntCnt; j++) {
  2545. PatientVO vo = GetPatientByPatList(voList[i]);
  2546. Dictionary<FOSParameter, string> formParams = Common.CreateGlobalParamsDictionary(consentMain.ConsentExecuteInfo["dutinstcd"]);
  2547. Dictionary<FOSParameter, string> changingFormParams = new Dictionary<FOSParameter, string>();
  2548. changingFormParams[FOSParameter.ImageUploadPath] = this.consentMain.PluginExecuteInfo["imageUploadPath"] + "/";
  2549. changingFormParams[FOSParameter.Device] = "P";
  2550. changingFormParams[FOSParameter.PatientCode] = vo.pid;
  2551. changingFormParams[FOSParameter.PatientSexAge] = vo.sa;
  2552. changingFormParams[FOSParameter.PatientName] = vo.patientName;
  2553. changingFormParams[FOSParameter.PatientRRN] = vo.juminNo;
  2554. changingFormParams[FOSParameter.PatientRRNOrg] = vo.orgJuminNo;
  2555. changingFormParams[FOSParameter.RoomNo] = vo.ward + "/" + vo.roomCd;
  2556. changingFormParams[FOSParameter.VisitDate] = SetDateFormatting(vo.inDd);
  2557. changingFormParams[FOSParameter.DeptName] = vo.deptEngAbbr;
  2558. changingFormParams[FOSParameter.FormName] = this.CurrentPreviewConsent.formPrintName;
  2559. changingFormParams[FOSParameter.MainDoctor] = vo.mainDrName;
  2560. // dbs227 다중 출력 시 환자 이름을 추가하여 준다
  2561. changingFormParams[FOSParameter.PatientNameFix] = vo.patientName;
  2562. // 출력할 경우 설명 의사와 서명 이미지는 공백 처리
  2563. //if (consentMain.ConsentExecuteInfo["printYN"].Equals("Y"))
  2564. {
  2565. //changingFormParams[FOSParameter.ExplDrName] = string.Empty;
  2566. //changingFormParams[FOSParameter.ExplDrTelNo] = string.Empty;
  2567. //changingFormParams[FOSParameter.ExplDrSign] = string.Empty;
  2568. //changingFormParams[FOSParameter.PatientName] = string.Empty;
  2569. //changingFormParams[FOSParameter.PatientBirthDay] = string.Empty;
  2570. //changingFormParams[FOSParameter.PatientTelNo] = string.Empty; // parCMSGBD_PT_tel
  2571. // 보호자상주확인서 프린터 출력시 제외 항목
  2572. //changingGlobalParams[FOSParameter.UserName] = string.Empty;
  2573. //changingGlobalParams[FOSParameter.SignImage] = string.Empty;
  2574. }
  2575. if(j == 0) {
  2576. HospitalSvcRef.SingleReturnData retData = hospitalWebService.GetOcrTag(this.consentMain.ConsentExecuteInfo["dutinstcd"]);
  2577. vo.ocrCd = retData.responseData;
  2578. int cnt = hospitalWebService.checkOcrDup(consentMain.ConsentExecuteInfo["dutinstcd"], vo.ocrCd);
  2579. if(cnt > 0) {
  2580. MessageBox.Show("OCRTAG 중복 발생입니다. 환자를 다시 선택하여 주십시요.");
  2581. consentMain.ClearPreviewConsent(true);
  2582. return;
  2583. }
  2584. changingFormParams[FOSParameter.OCRCode] = vo.ocrCd; //OCR코드
  2585. this.CurrentPreviewConsent.multiOcrcode += vo.ocrCd + "^";
  2586. this.CurrentPreviewConsent.multiMainDrIdCd += vo.mainDrId + "^";
  2587. sOcrCd = vo.ocrCd;
  2588. }
  2589. else {
  2590. changingFormParams[FOSParameter.OCRCode] = sOcrCd; //OCR코드
  2591. }
  2592. if(string.IsNullOrEmpty(sOcrCd)) {
  2593. MessageBox.Show("OCRTAG 생성 오류. 전산실에 문의 하세요.");
  2594. return;
  2595. }
  2596. if(j == 1) changingFormParams[FOSParameter.PrintComment] = Properties.Resources.msg_print_comment_2;
  2597. else if(j == 2) changingFormParams[FOSParameter.PrintComment] = Properties.Resources.msg_print_comment_3;
  2598. changingFormParams[FOSParameter.PrintTime] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  2599. changingFormParams[FOSParameter.PrintIp] = consentMain.ConsentExecuteInfo["printIP"];
  2600. ChangeGlobalParametersToNew(formParams, changingFormParams);
  2601. formGuidList[prntCnt] = this.CurrentPreviewConsent.formGuid;
  2602. //formGuids.Add(this.CurrentPreviewConsent.FormGuid);
  2603. formParamsList.Add((prntCnt + 1).ToString(), formParams);
  2604. prntCnt++;
  2605. }
  2606. }
  2607. if(this.CurrentPreviewConsent.multiOcrcode.Length > 0) {
  2608. this.CurrentPreviewConsent.multiOcrcode = this.CurrentPreviewConsent.multiOcrcode.Substring(0, this.CurrentPreviewConsent.multiOcrcode.Length - 1);
  2609. }
  2610. if(this.CurrentPreviewConsent.multiMainDrIdCd.Length > 0) {
  2611. this.CurrentPreviewConsent.multiMainDrIdCd = this.CurrentPreviewConsent.multiMainDrIdCd.Substring(0, this.CurrentPreviewConsent.multiMainDrIdCd.Length - 1);
  2612. }
  2613. string fos = Common.GetMultiFosString(formGuidList
  2614. , this.consentMain.PluginExecuteInfo["formServiceUrl"]
  2615. , null
  2616. , formParamsList
  2617. , consentMain.ConsentExecuteInfo["dutinstcd"]);
  2618. //PC클라이언트에서 프린트 출력을 눌렀을때 출력 데이타 입력 후 출력되게끔
  2619. if(this.consentMain.getPrintButton()) {
  2620. this.consentMain.setPageCnt(CurrentPreviewConsent.prntCnt);
  2621. SaveDataForPrintedConsent(String.Empty);
  2622. }
  2623. this.consentMain.PrintConsentDocument(fos);
  2624. }
  2625. private string SetDateFormatting(string adDate) {
  2626. if(adDate.Length == 8)
  2627. return string.Format("{0}/{1}/{2}", adDate.Substring(0, 4), adDate.Substring(4, 2), adDate.Substring(6, 2));
  2628. else
  2629. return adDate;
  2630. }
  2631. public override void OnRequiredInputViolation(string value) {
  2632. MessageBox.Show(this, value + " 항목이 누락되었습니다.", Properties.Resources.msg_caption_warn, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  2633. //MessageBoxDlg.Show(false, value + " 항목이 누락되었습니다.", Properties.Resources.msg_caption_warn, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  2634. }
  2635. /// <summary>
  2636. /// toolStripButtonPen 체크박스 활성화 여부 체크 및 이미지 변경
  2637. /// </summary>
  2638. /// <param name="enabled">if set to <c>true</c> [enabled].</param>
  2639. public override void onEnableDrawing(bool enabled) {
  2640. this.toolStripButtonPen.Checked = enabled;
  2641. if(this.toolStripButtonPen.Checked) this.toolStripButtonPen.Image = global::CLIP.eForm.Consent.UI.Properties.Resources.newDrawingClick;
  2642. else this.toolStripButtonPen.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonPen.Image")));
  2643. }
  2644. /// <summary>
  2645. /// 첨지 삭제 버튼 클릭 이벤트
  2646. /// </summary>
  2647. /// <param name="sender">The source of the event.</param>
  2648. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  2649. private void toolStripButtonDeleteAttach_Click(object sender, EventArgs e) {
  2650. this.consentMain.DeleteAttach();
  2651. setViewerPageInit();
  2652. }
  2653. /// <summary>
  2654. /// 첨지 추가 버튼 클릭 이벤트
  2655. /// </summary>
  2656. /// <param name="sender">The source of the event.</param>
  2657. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  2658. private void toolStripButtonInsertAttach_Click(object sender, EventArgs e) {
  2659. this.consentMain.InsertAttach();
  2660. setViewerPageInit();
  2661. }
  2662. /// <summary>
  2663. /// 뷰어 페이지 초기화
  2664. /// </summary>
  2665. public override void setViewerPageInit() {
  2666. this.toolStripLabelTotalPages.Text = this.consentMain.GetTotalPageCount().ToString();
  2667. this.toolStripTextBoxPageIndex.Text = this.consentMain.GetCurrentPageIndex().ToString();
  2668. }
  2669. /// <summary>
  2670. /// 환경설정 버튼 클릭 이벤트
  2671. /// </summary>
  2672. /// <param name="sender">The source of the event.</param>
  2673. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  2674. private void toolStripButtonConfig_Click(object sender, EventArgs e) {
  2675. ShowConfigDialog();
  2676. }
  2677. /// <summary>
  2678. /// 환경설정 다이얼로그를 불러온다
  2679. /// </summary>
  2680. private void ShowConfigDialog() {
  2681. ConfigForm configForm = new ConfigForm();
  2682. configForm.ShowDialog(this);
  2683. }
  2684. class ZoomRateDropdownItem {
  2685. private string caption = string.Empty;
  2686. public string Caption {
  2687. get { return caption; }
  2688. set { caption = value; }
  2689. }
  2690. private string itemValue = string.Empty;
  2691. public string ItemValue {
  2692. get { return itemValue; }
  2693. set { itemValue = value; }
  2694. }
  2695. public ZoomRateDropdownItem() {
  2696. }
  2697. public ZoomRateDropdownItem(string caption, string itemValue) {
  2698. this.caption = caption;
  2699. this.itemValue = itemValue;
  2700. }
  2701. public override string ToString() {
  2702. return caption;
  2703. }
  2704. }
  2705. /// <summary>
  2706. /// 환경설정 버튼 클릭 이벤트
  2707. /// </summary>
  2708. /// <param name="sender">The source of the event.</param>
  2709. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  2710. private void toolStripButtonConfig_Click_1(object sender, EventArgs e) {
  2711. ShowConfigDialog();
  2712. }
  2713. private void ConsentCommandCtrl_Click(object sender, EventArgs e) {
  2714. MessageBoxDlg.MessageBoxParent = this;
  2715. }
  2716. public void setCurrentPreviewConsentForm(ConsentFormListVO vo, int orderNo, string inputId, string inputNm) {
  2717. // 현재 preview 할동의서 정보 설정
  2718. CurrentPreviewConsent = new PreviewConsent {
  2719. formRid = vo.formRid.ToString(),
  2720. formGuid = vo.formGuid,
  2721. formCd = vo.formCd.ToString(),
  2722. FormName = vo.formName,
  2723. formPrintName = vo.formPrntNm,
  2724. prntCnt = vo.printCnt,
  2725. consentMstRid = vo.consentMstRid.ToString(),
  2726. consentState = vo.consentState,
  2727. orderNo = orderNo,
  2728. inputId = inputId,
  2729. inputNm = inputNm,
  2730. ReissueConsentMstRid = 0,
  2731. RewriteConsentMstRid = 0,
  2732. ordType = CurrentTargetPatient.VisitType,
  2733. ocrtagPrntyn = vo.ocrTagPrntYn,
  2734. userDrFlag = vo.userDrFlag,
  2735. printOnly = vo.printOnly,
  2736. opDiagName = vo.opDiagNm,
  2737. drOnly = vo.DrOnly,
  2738. opName = vo.opNm
  2739. };
  2740. Dictionary<FOSParameter, string> globalParams = Common.CreateGlobalParamsDictionary(consentMain.ConsentExecuteInfo["dutinstcd"]);
  2741. List<string> formGuids = new List<string> { CurrentPreviewConsent.formGuid };
  2742. SetPatientAndUser(globalParams);
  2743. globalParams[FOSParameter.OCRCode] = string.Empty;
  2744. var ocrBuf = GetOcrCode();
  2745. if (string.IsNullOrEmpty(ocrBuf)) {
  2746. MessageBox.Show("OCR 중복입니다. 다시 환자를 선택하여 주세요.");
  2747. return;
  2748. }
  2749. int cnt = hospitalWebService.checkOcrDup(consentMain.ConsentExecuteInfo["dutinstcd"], ocrBuf);
  2750. if (cnt > 0) {
  2751. MessageBox.Show("OCRTAG 중복 발생입니다. 환자를 다시 선택하여 주십시요.");
  2752. consentMain.ClearPreviewConsent(true);
  2753. return;
  2754. }
  2755. globalParams[FOSParameter.OCRCode] = CurrentPreviewConsent.ocrCode = ocrBuf;
  2756. globalParams[FOSParameter.Device] = "C";
  2757. globalParams[FOSParameter.PrintTime] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  2758. globalParams[FOSParameter.SignTime] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  2759. globalParams[FOSParameter.PrintIp] = consentMain.ConsentExecuteInfo["printIP"];
  2760. if (string.IsNullOrEmpty(CurrentPreviewConsent.ocrCode)) {
  2761. MessageBox.Show("OCRTAG 생성 오류. 전산실에 문의 하세요.");
  2762. consentMain.ClearPreviewConsent(true);
  2763. return;
  2764. }
  2765. CLIP.eForm.Consent.UI.HospitalSvcRef.SingleReturnData retVal = hospitalWebService.getEmrDataString(
  2766. "A01"
  2767. , this.CurrentTargetPatient.HosType
  2768. , this.CurrentTargetPatient.PatientCode
  2769. , this.CurrentTargetPatient.clnDate
  2770. , this.CurrentTargetPatient.cretno
  2771. , this.CurrentPreviewConsent.formCd);
  2772. globalParams[FOSParameter.emrinfo] = retVal.responseData;
  2773. string fos = Common.GetFosString(formGuids
  2774. , consentMain.PluginExecuteInfo["formServiceUrl"]
  2775. , globalParams
  2776. , null
  2777. , consentMain.ConsentExecuteInfo["dutinstcd"]);
  2778. SetEnableButtonsByCurrentConsent();
  2779. consentMain.PreviewConsent(fos);
  2780. RunConsentDualView();
  2781. SetEnableConsentIssueCommands(true);
  2782. }
  2783. public void setToolstripEnabled(bool isEnabled)
  2784. {
  2785. this.toolStripButtonFirstPage.Enabled = isEnabled;//
  2786. this.toolStripButtonPrevPage.Enabled = isEnabled;
  2787. this.toolStripButtonNextPage.Enabled = isEnabled;
  2788. this.toolStripButtonLastPage.Enabled = isEnabled;
  2789. this.toolStripTextBoxPageIndex.Enabled = isEnabled;//페이지번호 보여주는부분 total page
  2790. this.toolStripLabelTotalPages.Enabled = isEnabled;//
  2791. this.toolStripTextBoxPageIndex.Text = consentMain.GetCurrentPageIndex().ToString();
  2792. this.toolStripLabelTotalPages.Text = consentMain.GetTotalPageCount().ToString();
  2793. this.toolStripComboBoxZoom.Enabled = isEnabled;//넓이 맞춤 서식 폭 조정
  2794. this.toolStripButtonDeleteAllSignData.Enabled = isEnabled;//그림그린거 다없앤거
  2795. }
  2796. /// <summary>
  2797. /// 다중서식 실행시 듀얼뷰어를 실행시켰을 때 버튼 설정
  2798. /// </summary>
  2799. public void setMultiParamsDualViewrStripButton()
  2800. {
  2801. // 전자동의서 실행 버튼
  2802. this.toolStripButtonExecute.Enabled = false;
  2803. // 출력 버튼
  2804. this.toolStripButtonPrint.Enabled = true;
  2805. if (this.CurrentPreviewConsent != null && this.CurrentPreviewConsent.outputType != null)
  2806. {
  2807. if (this.CurrentPreviewConsent.outputType.Equals("ELECTRONIC"))
  2808. {
  2809. this.toolStripButtonPrint.Enabled = false;
  2810. }
  2811. }
  2812. // Dual Viewer 닫기 버튼
  2813. this.toolStripButtonCloseDualViewer.Visible = true;
  2814. SetEnableByUserType();
  2815. base.SetEnablementExecuteWhenDualViewerActive(true);
  2816. }
  2817. }
  2818. }