ConsentMainControl.cs 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Windows.Forms;
  4. using CLIP.eForm.Consent.Common;
  5. using System.Reflection;
  6. using System.Threading;
  7. using System.Xml;
  8. using System.IO;
  9. using System.ComponentModel;
  10. using System.Configuration;
  11. using System.Drawing;
  12. using CLIP.eForm.Consent.Dfh.UI.ConsentSvcRef;
  13. using ClipSoft.eForm.Base.Dialog;
  14. namespace CLIP.eForm.Consent.Dfh.UI
  15. {
  16. /// <summary>
  17. /// 동의서 관리 메인 컨트롤 클래스
  18. /// </summary>
  19. /// <remarks>
  20. /// <p>[설계자]</p>
  21. /// <p> 클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)</p>
  22. /// <p>[원본 작성자]</p>
  23. /// <p> 클립소프트 기술부 이창훈 (chlee@clipsoft.co.kr)</p>
  24. /// <p>[수정 작성자]</p>
  25. /// <p> 클립소프트 기술부 이인희</p>
  26. /// <p>----------------------------------------------------------------------------------------</p>
  27. /// <p>[HISTORY]</p>
  28. /// <p> 2015-07-30 : 최초작성</p>
  29. /// <p>----------------------------------------------------------------------------------------</p>
  30. /// </remarks>
  31. public partial class ConsentMainControl : UserControl, IConsentMainCtrl, IConsentMain
  32. {
  33. private string currentFormGuid = string.Empty;
  34. private ConsentSvcRef.ConsentSvcSoapClient consentWebService;
  35. private HospitalSvcRef.HospitalSvcSoapClient hospitalWebService;
  36. [Browsable(false)]
  37. public ConsentSvcRef.ConsentSvcSoapClient ConsentWebService { get { return consentWebService; } }
  38. [Browsable(false)]
  39. public HospitalSvcRef.HospitalSvcSoapClient HospitalWebService { get { return hospitalWebService; } }
  40. public string PluginModuleName { get; set; }
  41. private Dictionary<string, string> outputDataDic = null;
  42. private Dictionary<string, object> processResultValues = new Dictionary<string, object>();
  43. public Dictionary<string, string> ConsentExecuteInfo { get; set; }
  44. public Dictionary<string, string> PluginExecuteInfo { get; set; }
  45. public Dictionary<string, object> ProcessResultValues { get { return processResultValues; } }
  46. public List<ConsentVO> PrintInfoList { get; set; }
  47. public event EventHandler OnLoadPartControls;
  48. public event EventHandler OnResizeReviewConsent;
  49. public event EventHandler OnVisibleEFormControl;
  50. public event EventHandler OnInvisibleEFormControl;
  51. public event ProcessResultHandler ProcessResult;
  52. public delegate void ProcessResultHandler(string result);
  53. public object _callParm = null;
  54. public bool printSaveStatus { get; set; }
  55. public int multiPrintPlanCnt { get; set; }
  56. public int multiPrintExecCnt { get; set; }
  57. public bool saveClickPoint { get; set; } // true : 메인창, false : 듀얼뷰어창
  58. public bool checkAutoPrint { get; set; } // true : 입실저장 자동출력, false : 수동출력
  59. private static bool startform = true;
  60. public int agentCallPrintCnt { get; set; }
  61. object IConsentMainCtrl.CallParam
  62. {
  63. get
  64. {
  65. return _callParm;
  66. }
  67. set
  68. {
  69. _callParm = value;
  70. }
  71. }
  72. private System.Windows.Forms.Timer _timer;
  73. public ConsentMainControl(object callParam)
  74. {
  75. this.ConsentExecuteInfo = new Dictionary<string, string>();
  76. this.PluginExecuteInfo = new Dictionary<string, string>();
  77. SetWebServiceUrlAndTimeout(callParam);
  78. InitializeComponent();
  79. this.PluginModuleName = ConfigurationManager.AppSettings["UIPluginAssembly"];
  80. //MainControl의 resize가 일어난 직후 직접출력 처리를 위해서 추가되었음
  81. _timer = new System.Windows.Forms.Timer();
  82. _timer.Interval = 500;
  83. _timer.Tick += (sender, e) => ResizeFinished();
  84. this.SizeChanged += new System.EventHandler(this.ConsentMainControl_SizeChanged);
  85. }
  86. private void ConsentMainControl_SizeChanged(object sender, EventArgs e)
  87. {
  88. _timer.Start();
  89. }
  90. private void ResizeFinished()
  91. {
  92. _timer.Stop();
  93. //agent 구동시 바로 출력을 하는 경우
  94. if (this.ConsentExecuteInfo.ContainsKey("printAct") && !string.IsNullOrEmpty(this.ConsentExecuteInfo["printAct"]) && this.ConsentExecuteInfo["printAct"].Equals("Y"))
  95. {
  96. Form parentForm = this.Parent as Form;
  97. if (parentForm != null)
  98. {
  99. parentForm.Visible = false;
  100. }
  101. if (this.ConsentExecuteInfo.ContainsKey("printList") && !string.IsNullOrEmpty(this.ConsentExecuteInfo["printList"]))
  102. {
  103. if (this.PrintInfoList != null && this.PrintInfoList.Count > 0)
  104. {
  105. this.agentCallPrintCnt = PrintInfoList.Count;
  106. foreach (ConsentVO consentVO in this.PrintInfoList)
  107. {
  108. this.ConsentExecuteInfo["patientNo"] = consentVO.PatientCode;
  109. this.ConsentExecuteInfo["clnDate"] = consentVO.ClnDate;
  110. this.ConsentExecuteInfo["clnDept"] = consentVO.ClnDeptCd;
  111. this.ConsentExecuteInfo["visitType"] = consentVO.VisitType;
  112. this.ConsentExecuteInfo["cretno"] = consentVO.Cretno.ToString();
  113. this.ConsentExecuteInfo["prntCnt"] = consentVO.PrntCnt.ToString();
  114. this.ConsentExecuteInfo["startFormCd"] = consentVO.FormCd;
  115. this.patientInfoCtrl.OnRefeashPartControls("");
  116. this.consentListCtrl.OnRefeashPartControls();
  117. this.consentCommandCtrl.PrintDirectConsentDocument();
  118. }
  119. }
  120. }
  121. else
  122. {
  123. this.agentCallPrintCnt = 1;
  124. this.consentCommandCtrl.PrintDirectConsentDocument();
  125. }
  126. this.ConsentExecuteInfo["printAct"] = "N";
  127. if (parentForm != null)
  128. {
  129. parentForm.WindowState = FormWindowState.Normal;
  130. parentForm.Close();
  131. }
  132. }
  133. }
  134. public static bool HasVerticalMonitor
  135. {
  136. get
  137. {
  138. if (Screen.AllScreens.Length > 1)
  139. {
  140. foreach (Screen screen in Screen.AllScreens)
  141. {
  142. if (screen.Bounds.Width < screen.Bounds.Height)
  143. {
  144. return true;
  145. }
  146. }
  147. }
  148. return false;
  149. }
  150. }
  151. public static Dictionary<string, string> GetConfigDictionary()
  152. {
  153. string serviceTarget = string.Empty;
  154. Dictionary<string, string> result = new Dictionary<string, string>();
  155. XmlDocument configXml = new XmlDocument();
  156. configXml.Load(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + string.Format("/CLIP.Consent.xml"));
  157. XmlNodeList addNodes = configXml.SelectNodes("configuration/settings/add");
  158. foreach (XmlNode xmlNode in addNodes)
  159. {
  160. if (xmlNode.Attributes["key"].InnerText == "serviceTarget")
  161. {
  162. serviceTarget = ((XmlCDataSection)xmlNode.ChildNodes[0]).InnerText;
  163. }
  164. }
  165. configXml = new XmlDocument();
  166. configXml.Load(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + string.Format("/CLIP.Consent-{0}.xml", serviceTarget));
  167. addNodes = configXml.SelectNodes("configuration/settings/add");
  168. foreach (XmlNode xmlNode in addNodes)
  169. {
  170. result.Add(xmlNode.Attributes["key"].InnerText, ((XmlCDataSection)xmlNode.ChildNodes[0]).InnerText);
  171. }
  172. return result;
  173. }
  174. /// <summary>
  175. /// childControl의 부모와 그의 부모들에서 IConsentMain 인터페이스를 구현하는 클래스를 찾는다.
  176. /// </summary>
  177. /// <param name="childControl"></param>
  178. /// <returns></returns>
  179. public static IConsentMain GetConsentMainInterface(Control childControl)
  180. {
  181. if (childControl.Parent == null)
  182. {
  183. return null;
  184. }
  185. else
  186. {
  187. if (childControl.Parent is IConsentMain)
  188. {
  189. return childControl.Parent as IConsentMain;
  190. }
  191. else
  192. {
  193. return GetConsentMainInterface(childControl.Parent);
  194. }
  195. }
  196. }
  197. private void SetWebServiceUrlAndTimeout(object _callParm)
  198. {
  199. try
  200. {
  201. if (_callParm != null)
  202. {
  203. Dictionary<string, object> callParam = _callParm as Dictionary<string, object>;
  204. if (callParam.ContainsKey("CALL_PARAMS"))
  205. {
  206. _callParm = callParam["CALL_PARAMS"] as object;
  207. }
  208. }
  209. Dictionary<string, string> configDic = GetConfigDictionary();
  210. this.PluginExecuteInfo.Add("consentSvcUrl", configDic["consentSvcUrl"]);
  211. this.PluginExecuteInfo.Add("hospitalSvcUrl", configDic["hospitalSvcUrl"]);
  212. this.PluginExecuteInfo.Add("formServiceUrl", configDic["formServiceUrl"]);
  213. this.PluginExecuteInfo.Add("imageUploadServerUrl", configDic["imageUploadServerUrl"]);
  214. this.PluginExecuteInfo.Add("signatureServerUrl", configDic["signatureServerUrl"]);
  215. this.PluginExecuteInfo.Add("signatureServerPort", configDic["signatureServerPort"]);
  216. this.PluginExecuteInfo.Add("imageUploadPath", configDic["imageUploadPath"]);
  217. this.PluginExecuteInfo.Add("ConsentSearchStartDate", configDic["ConsentSearchStartDate"]);
  218. this.PluginExecuteInfo.Add("timeOut", "10");
  219. this.consentWebService = WebMethodCommon.GetConsentWebService(configDic["consentSvcUrl"]);
  220. this.hospitalWebService = WebMethodCommon.GetHospitalWebService(configDic["hospitalSvcUrl"]);
  221. }
  222. catch (Exception ex)
  223. {
  224. throw ex;
  225. }
  226. }
  227. public ConsentSvcRef.ConsentSvcSoapClient getConsentWebService()
  228. {
  229. return this.consentWebService;
  230. }
  231. public HospitalSvcRef.HospitalSvcSoapClient getHospitalWebService()
  232. {
  233. return this.hospitalWebService;
  234. }
  235. protected override void OnLoad(EventArgs e)
  236. {
  237. if (string.IsNullOrEmpty(this.PluginModuleName))
  238. {
  239. return;
  240. }
  241. if (startform)
  242. {
  243. startform = false;
  244. SignatureConfig sign = new SignatureConfig();
  245. sign.SignAllClear();
  246. }
  247. //MessageBoxDlg.Show(this, "시작부분.", string.Format(Properties.Resources.msg_caption_confirm),MessageBoxButtons.OK, MessageBoxIcon.Information);
  248. InitParamSetting();
  249. InitEFormControl();
  250. InvokeDelayedLoadEvent();
  251. //agent 구동시 바로 출력을 하는 경우
  252. if (!(this.ConsentExecuteInfo.ContainsKey("printAct") && !string.IsNullOrEmpty(this.ConsentExecuteInfo["printAct"]) && this.ConsentExecuteInfo["printAct"].Equals("Y")))
  253. {
  254. // 화면이 종료될때 Agent도 종료되도록 수정
  255. //this.Parent.Disposed += Parent_Disposed;
  256. }
  257. this.eFormViewerCtrl.GetCurrentViewer().UIUpdateOnDrawing
  258. += new Viewer.UIUpdateOnDrawingHandler(ConsentMainControl_UIUpdateOnDrawing);
  259. base.OnLoad(e);
  260. // 폰트 설치여부 체크
  261. string familyName;
  262. string familyList = "";
  263. FontFamily[] fontFamilies;
  264. System.Drawing.Text.InstalledFontCollection installedFontCollection = new System.Drawing.Text.InstalledFontCollection();
  265. fontFamilies = installedFontCollection.Families;
  266. int count = fontFamilies.Length;
  267. int fontCheck = 0;
  268. for (int j = 0; j < count; ++j)
  269. {
  270. familyName = fontFamilies[j].Name;
  271. familyList = familyList + familyName;
  272. familyList = familyList + ", ";
  273. if (fontCheck != 1 && (familyName == "나눔고딕" || familyName == "NanumGothic"))
  274. {
  275. fontCheck = fontCheck + 1;
  276. }
  277. if (fontCheck < 100 && (familyName == "나눔고딕 ExtraBold" || familyName == "NanumGothicExtraBold" || familyName == "나눔고딕 아주 굵게"))
  278. {
  279. fontCheck = fontCheck + 10;
  280. }
  281. }
  282. // 폰트 설치 실행
  283. if (fontCheck < 11)
  284. {
  285. System.Diagnostics.Process UserProcess = new System.Diagnostics.Process();
  286. UserProcess.StartInfo.UseShellExecute = true;
  287. UserProcess.StartInfo.FileName = "NanumFontSetup.exe";
  288. UserProcess.StartInfo.WorkingDirectory = Path.GetDirectoryName(Application.StartupPath + "/Font/");
  289. UserProcess.StartInfo.CreateNoWindow = true;
  290. UserProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
  291. UserProcess.Start();
  292. }
  293. try
  294. {
  295. // 임시파일 삭제로직
  296. string sTempPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Clipsoft\ClipSoft.eForm.Viewer\DataTemp\";
  297. if (Directory.Exists(sTempPath))
  298. {
  299. string[] filePaths = Directory.GetFiles(sTempPath);
  300. foreach (string fileName in filePaths)
  301. {
  302. FileInfo fileInfo = new FileInfo(fileName);
  303. if (fileInfo.Extension.Equals(".ept") || fileInfo.Extension.Equals(".jpg") || fileInfo.Extension.Equals(".xml"))
  304. {
  305. fileInfo.Delete();
  306. }
  307. }
  308. }
  309. }
  310. catch (Exception ex)
  311. {
  312. throw ex;
  313. }
  314. }
  315. // 화면이 종료될때 Agent도 종료되도록 수정
  316. private void Parent_Disposed(object sender, EventArgs e)
  317. {
  318. foreach (Form form in Application.OpenForms)
  319. {
  320. if (form.Name.Equals("ConsentAgentForm"))
  321. {
  322. form.Dispose();
  323. break;
  324. }
  325. }
  326. }
  327. // 화면이 종료될때 Agent도 종료되도록 수정
  328. public void Parent_Disposed()
  329. {
  330. foreach (Form form in Application.OpenForms)
  331. {
  332. if (form.Name.Equals("ConsentAgentForm"))
  333. {
  334. form.Dispose();
  335. break;
  336. }
  337. }
  338. }
  339. private void InitParamSetting()
  340. {
  341. try
  342. {
  343. if (_callParm != null)
  344. {
  345. Dictionary<string, object> callParam = _callParm as Dictionary<string, object>;
  346. if (callParam != null && callParam.Count < 2)
  347. {
  348. if (callParam["CALL_PARAMS"] != null)
  349. {
  350. _callParm = callParam["CALL_PARAMS"] as object;
  351. }
  352. }
  353. foreach (KeyValuePair<string, object> callKV in _callParm as Dictionary<string, object>)
  354. {
  355. if (callKV.Key != null && !string.IsNullOrEmpty(callKV.Key.ToString()) && callKV.Key.ToString() == "USER_INFO")
  356. {
  357. // 사용자 정보
  358. foreach (KeyValuePair<string, object> userKV in callKV.Value as Dictionary<string, object>)
  359. {
  360. if (userKV.Key != null && !string.IsNullOrEmpty(userKV.Key.ToString()) && userKV.Key.ToString() == "USER_ID")
  361. {
  362. if (userKV.Value != null)
  363. {
  364. this.ConsentExecuteInfo.Add("loginUserNo", userKV.Value.ToString()); // 사용자NO
  365. this.ConsentExecuteInfo.Add("userNo", userKV.Value.ToString()); // 사용자NO
  366. }
  367. }
  368. }
  369. }
  370. if (callKV.Key != null && !string.IsNullOrEmpty(callKV.Key.ToString()) && callKV.Key.ToString() == "PATIENT_INFO")
  371. {
  372. // 환자 정보
  373. foreach (KeyValuePair<string, object> patientKV in callKV.Value as Dictionary<string, object>)
  374. {
  375. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "PTNT_NO")
  376. {
  377. if (patientKV.Value != null) this.ConsentExecuteInfo.Add("patientNo", patientKV.Value.ToString()); // 환자 등록번호
  378. }
  379. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "VISIT_TYPE")
  380. {
  381. if (patientKV.Value != null) this.ConsentExecuteInfo.Add("visitType", patientKV.Value.ToString()); // 내원구분
  382. }
  383. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CLN_DEPT")
  384. {
  385. if (patientKV.Value != null) this.ConsentExecuteInfo.Add("clnDept", patientKV.Value.ToString()); // 진료과
  386. }
  387. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CLN_DATE")
  388. {
  389. if (patientKV.Value != null) this.ConsentExecuteInfo.Add("clnDate", patientKV.Value.ToString()); // 진료일자/입원일자
  390. }
  391. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CRETNO")
  392. {
  393. if (patientKV.Value != null) this.ConsentExecuteInfo.Add("cretno", patientKV.Value.ToString()); // 수진번호
  394. }
  395. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CLN_DX_NM")
  396. {
  397. if (patientKV.Value != null) this.ConsentExecuteInfo.Add("clnDxNm", patientKV.Value.ToString()); // 진단명
  398. }
  399. }
  400. }
  401. if (callKV.Key != null && !string.IsNullOrEmpty(callKV.Key.ToString()) && callKV.Key.ToString() == "EXEC_OPT")
  402. {
  403. // 화면 설정 정보
  404. foreach (KeyValuePair<string, object> execKV in callKV.Value as Dictionary<string, object>)
  405. {
  406. if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "USE_LIST_VIEW")
  407. {
  408. if (execKV.Value != null) this.ConsentExecuteInfo.Add("useListView", execKV.Value.ToString()); // 동의서 리스트 사용 유무
  409. }
  410. if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "PTNT_LIST_VIEW")
  411. {
  412. if (execKV.Value != null) this.ConsentExecuteInfo.Add("patientListView", execKV.Value.ToString()); // 환자 리스트 사용 유무
  413. }
  414. if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "START_FORM_CD")
  415. {
  416. if (execKV.Value != null) this.ConsentExecuteInfo.Add("startFormCd", execKV.Value.ToString()); // 시작 FORM ID
  417. }
  418. if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "PTNT_ACT")
  419. {
  420. if (execKV.Value != null) this.ConsentExecuteInfo.Add("printAct", execKV.Value.ToString()); // 초기 프린트
  421. }
  422. if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "PRINT_LIST")
  423. {
  424. if (execKV.Value != null)
  425. {
  426. // OrderInfoList, OrderInfo, ConsentVO
  427. List<object> PatientList = execKV.Value as List<object>;
  428. if (PatientList != null && PatientList.Count > 0)
  429. {
  430. PrintInfoList = new List<ConsentVO>();
  431. ConsentVO consentVO = new ConsentVO();
  432. for (int i = 0; i < PatientList.Count; i++)
  433. {
  434. consentVO = new ConsentVO();
  435. consentVO.PrntCnt = -1;
  436. foreach (KeyValuePair<string, object> callOrderKV in PatientList[i] as Dictionary<string, object>)
  437. {
  438. if (callOrderKV.Key != null && !string.IsNullOrEmpty(callOrderKV.Key.ToString()) && callOrderKV.Value != null)
  439. {
  440. if (callOrderKV.Key.ToString() == "START_FORM_CD") consentVO.FormCd = callOrderKV.Value.ToString(); // 출력 서식코드
  441. if (callOrderKV.Key.ToString() == "PTNT_NO") consentVO.PatientCode = callOrderKV.Value.ToString(); // 환자번호
  442. if (callOrderKV.Key.ToString() == "VISIT_TYPE") consentVO.VisitType = callOrderKV.Value.ToString(); // 내원구분
  443. if (callOrderKV.Key.ToString() == "CLN_DATE") consentVO.ClnDate = callOrderKV.Value.ToString(); // 진료일자
  444. if (callOrderKV.Key.ToString() == "CLN_DEPT") consentVO.ClnDeptCd = callOrderKV.Value.ToString(); // 진료과
  445. if (callOrderKV.Key.ToString() == "PRINT_CNT")
  446. {
  447. int PrntCnt = 0;
  448. int.TryParse(callOrderKV.Value.ToString(), out PrntCnt);
  449. consentVO.PrntCnt = PrntCnt; // 출력 카운트
  450. }
  451. if (callOrderKV.Key.ToString() == "CRETNO")
  452. {
  453. int cretno = 0;
  454. int.TryParse(callOrderKV.Value.ToString(), out cretno);
  455. consentVO.Cretno = cretno; // 차트번호
  456. }
  457. }
  458. }
  459. PrintInfoList.Add(consentVO);
  460. }
  461. if (execKV.Value != null) this.ConsentExecuteInfo.Add("printList", PrintInfoList.Count.ToString()); // 출력 데이터
  462. }
  463. }
  464. }
  465. }
  466. }
  467. }
  468. }
  469. else
  470. {
  471. throw new Exception("CallParam 미전달");
  472. }
  473. bool printMode = false;
  474. if (this.ConsentExecuteInfo.ContainsKey("printAct") && !string.IsNullOrEmpty(this.ConsentExecuteInfo["printAct"]) && this.ConsentExecuteInfo["printAct"].Equals("Y"))
  475. {
  476. printMode = true;
  477. }
  478. MoniterViewSetting(printMode);
  479. }
  480. catch (Exception ex)
  481. {
  482. throw ex;
  483. }
  484. }
  485. private void MoniterViewSetting(bool printMode)
  486. {
  487. if(printMode)
  488. {
  489. return;
  490. }
  491. //현재 프로그램이 실행되고 있는정보 가져오기: 디버깅 모드라면 bin/debug/프로그램명.exe
  492. FileInfo exefileinfo = new FileInfo(Path.GetDirectoryName(Application.StartupPath));
  493. // AppDomain.CurrentDomain.DynamicDirectory
  494. // Server.MapPath("~")
  495. string path = Path.GetDirectoryName(Application.StartupPath);//
  496. string fileName = @"\config.ini"; //파일명
  497. //만약 현재 실행 되는 경로가 아닌 특정한 위치를 원한다면 위에 과정 상관없이 바로 경로셋팅 해 주면 된다. (예: c:\config.ini)
  498. string filePath = path + fileName; //ini 파일 경로
  499. iniUtil ini = new iniUtil(filePath); // 만들어 놓았던 iniUtil 객체 생성(생성자 인자로 파일경로 정보 넘겨줌)
  500. //이제 ini 객체를 이용해 맘것 사용하면 된다.
  501. string sMoniterNumber = ini.GetIniValue("DFH", "MONITER_NUMBER");
  502. int iMoniterNumber = 0;
  503. int.TryParse(sMoniterNumber, out iMoniterNumber);
  504. Point location = Point.Empty;
  505. int j = 1;
  506. FormWindowState windowStateBackup;
  507. foreach (Screen sc in Screen.AllScreens)
  508. {
  509. if (j == iMoniterNumber)
  510. {
  511. Form parentForm = this.Parent as Form;
  512. if (parentForm != null)
  513. {
  514. windowStateBackup = parentForm.WindowState;
  515. Size size = parentForm.Bounds.Size;
  516. parentForm.WindowState = FormWindowState.Normal;
  517. parentForm.StartPosition = FormStartPosition.Manual;
  518. parentForm.ClientSize = new Size(size.Width, size.Height);
  519. parentForm.Location = new Point(sc.Bounds.Left, sc.Bounds.Top);
  520. parentForm.WindowState = windowStateBackup;
  521. }
  522. break;
  523. }
  524. j++;
  525. }
  526. }
  527. private void InitEFormControl()
  528. {
  529. Screen screen = Screen.FromControl(this);
  530. if (screen.Primary)
  531. {
  532. this.eFormViewerCtrl.SetRunOption("DEFAULT_ZOOM_RATE", "pagewidth");
  533. }
  534. else
  535. {
  536. this.eFormViewerCtrl.SetRunOption("DEFAULT_ZOOM_RATE", "pagewidth");
  537. }
  538. //this.eFormViewerCtrl.SetRunOption("ENABLE_DEBUG_VIEW", "true");
  539. //this.eFormViewerCtrl.SetRunOption("DEFAULT_TOOL_BAR_VISIBLE", "true");
  540. this.eFormViewerCtrl.SetRunOption("USE_CREDITCARD_SIGNPAD", "false");
  541. this.eFormViewerCtrl.SetRunOption("DEFAULT_TOOL_BAR_VISIBLE", "false");
  542. this.eFormViewerCtrl.SetRunOption("SET_EXTERNAL_CONTROL_DEFINED_PATH", this.PluginExecuteInfo["formServiceUrl"]);
  543. this.eFormViewerCtrl.SetRunOption("USE_EITHER_SIDE_MOVE_BUTTON", "true");
  544. this.eFormViewerCtrl.SetRunOption("DUALVIEWER_TOOL_BAR_SIZE", "32");
  545. this.eFormViewerCtrl.SetRunOption("DRAWING_PEN", "{ \"width\":\"2\",\"color\":{ \"a\":\"255\", \"r\":\"0\", \"g\":\"0\", \"b\":\"0\"} }");
  546. this.eFormViewerCtrl.SetRunOption("SET_VISIBLE_BUTTONS", "PAGE_ATTACH=true");
  547. this.eFormViewerCtrl.SetRunOption("IMAGE_SAVE_OPTION", "{\"dpi\":\"150\",\"gray\":\"false\",\"encode\":\"jpeg\",\"base-index\":\"1\",\"quality\":\"100\"}");
  548. if (HasVerticalMonitor)
  549. {
  550. this.eFormViewerCtrl.SetRunOption("RUN_AS_DUALVIEWER", "CLIP.eForm.DualViewer.dll");
  551. // this.eFormViewerCtrl.SetRunOption("READ_ONLY", "true");
  552. this.eFormViewerCtrl.SetRunOption("DUALVIEWER_TO_ACTIVATE_CONTROLS", "true");
  553. this.eFormViewerCtrl.SetRunOption("SET_VISIBLE_DUALVIEWER_TOOLSTRIP_MENU", "true");
  554. this.eFormViewerCtrl.SetRunOption("DUALVIEWER_TOOL_BAR_ENABLE", "true");
  555. // 툴바 위치 조절(true : 상단, false : 하단)
  556. this.eFormViewerCtrl.SetRunOption("USE_DUALVIEWER_TOOL_BAR_TOP", "false");
  557. // 가상키보드 사용 여부
  558. this.eFormViewerCtrl.SetRunOption("DUALVIEWER_VIRTUAL_KEYBOARD_VISIBLE", "true");
  559. // 관리자 권한 실행 저장 여부
  560. this.eFormViewerCtrl.SetRunOption("USE_ADMIN_PRIVILEGES_SAVE_EXECUTE", "false");
  561. this.eFormViewerCtrl.SetRunOption("DUALVIEWER_RESOLUTION", "{\"width\":\"768\",\"height\":\"1024\"}");
  562. }
  563. }
  564. private void InvokeDelayedLoadEvent() // TODO: 리팩터링 대상 comment by jchong 2016.06.11
  565. {
  566. if (this.OnLoadPartControls != null)
  567. {
  568. Application.DoEvents();
  569. Thread.Sleep(1);
  570. OnLoadPartControls.Invoke(this, new EventArgs());
  571. }
  572. }
  573. protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
  574. {
  575. if (msg.Msg == 0x100)
  576. {
  577. if (keyData == Keys.PageUp)
  578. {
  579. this.eFormViewerCtrl.MovePrevPage();
  580. }
  581. if (keyData == Keys.Next)
  582. {
  583. this.eFormViewerCtrl.MoveNextPage();
  584. }
  585. }
  586. return base.ProcessCmdKey(ref msg, keyData);
  587. }
  588. void ConsentMainControl_UIUpdateOnDrawing(object sender, int undoStackCount, int redoStackCount, int totalStrokeCount)
  589. {
  590. if (undoStackCount > 0)
  591. {
  592. this.consentCommandCtrl.EnableUndo = true;
  593. }
  594. else
  595. {
  596. this.consentCommandCtrl.EnableUndo = false;
  597. }
  598. if (redoStackCount > 0)
  599. {
  600. this.consentCommandCtrl.EnableRedo = true;
  601. }
  602. else
  603. {
  604. this.consentCommandCtrl.EnableRedo = false;
  605. }
  606. if (totalStrokeCount > 0)
  607. {
  608. this.consentCommandCtrl.EnableRemoveAll = true;
  609. }
  610. else
  611. {
  612. this.consentCommandCtrl.EnableRemoveAll = false;
  613. }
  614. }
  615. ConsentListCtrlBase IConsentMain.ConsentListCtrl
  616. {
  617. get { return this.consentListCtrl; }
  618. }
  619. PatientInfoCtrlBase IConsentMain.PatientInfoCtrl
  620. {
  621. get { return this.patientInfoCtrl; }
  622. }
  623. PatientListCtrlBase IConsentMain.PatientListCtrl
  624. {
  625. get { return this.patientListCtrl; }
  626. }
  627. Dictionary<string, string> IConsentMain.ConsentExecuteInfo
  628. {
  629. get
  630. {
  631. return this.ConsentExecuteInfo;
  632. }
  633. set
  634. {
  635. this.ConsentExecuteInfo = value;
  636. }
  637. }
  638. Dictionary<string, string> IConsentMain.PluginExecuteInfo
  639. {
  640. get
  641. {
  642. return this.PluginExecuteInfo;
  643. }
  644. set
  645. {
  646. this.PluginExecuteInfo = value;
  647. }
  648. }
  649. ConsentCommandCtrlBase IConsentMain.ConsentCommandCtrl
  650. {
  651. get
  652. {
  653. return this.consentCommandCtrl;
  654. }
  655. }
  656. public Dictionary<string, object> ProcessResultValue
  657. {
  658. get
  659. {
  660. return processResultValues;
  661. }
  662. }
  663. // 환자 정보가 바뀌었을때 컨트롤들의 정보를 재조회
  664. void IConsentMain.UIControlsRefeash(string visitType)
  665. {
  666. this.patientInfoCtrl.OnRefeashPartControls(visitType);
  667. this.consentListCtrl.OnRefeashPartControls();
  668. }
  669. void IConsentMain.PreviewConsent(string fos)
  670. {
  671. this.pnlCommand.Visible = true;
  672. this.pnlViewer.Visible = false;
  673. this.eFormViewerCtrl.Visible = true;
  674. this.eFormViewerCtrl.OpenFos(fos);
  675. }
  676. void IConsentMain.ClearConsent()
  677. {
  678. this.pnlCommand.Visible = true;
  679. this.pnlViewer.Visible = false;
  680. this.eFormViewerCtrl.Visible = true;
  681. this.eFormViewerCtrl.Open();
  682. }
  683. void IConsentMain.ReviewConsent()
  684. {
  685. this.pnlCommand.Visible = false;
  686. this.pnlViewer.Visible = true;
  687. this.eFormViewerCtrl.Visible = false;
  688. }
  689. void IConsentMain.RunConsentDualView()
  690. {
  691. this.eFormViewerCtrl.OpenDualViewer();
  692. }
  693. //일반 출력의 경우에도 기본프린터로 바로 출력하는 것으로 변경됨 // 수동으로 찾아서출력
  694. void IConsentMain.PrintConsentDocument(string fos)
  695. {
  696. if (!string.IsNullOrEmpty(fos))
  697. {
  698. this.eFormViewerCtrl.OpenFos(fos);
  699. }
  700. this.printSaveStatus = false;
  701. int iPrntCnt = consentCommandCtrl.CurrentPreviewConsent.PrntCnt;
  702. this.multiPrintPlanCnt = iPrntCnt;
  703. this.multiPrintExecCnt = 0;
  704. this.checkAutoPrint = false;//수동출력
  705. if(iPrntCnt > 0)
  706. {
  707. // 출력매수만큼 동의서 출력
  708. //for (int i = 0; i < iPrntCnt; i++)
  709. //{
  710. // if((i+1) == iPrntCnt) this.printSaveStatus = true;
  711. this.printSaveStatus = true;
  712. //기본프린터로 바로 출력하기로 함
  713. this.eFormViewerCtrl.PrintByPrinterName("");
  714. //}
  715. }
  716. this.printSaveStatus = false;
  717. }
  718. //기본프린터로 출력, Agent에서 직접출력
  719. void IConsentMain.PrintDirect(string fos)
  720. {
  721. if (!string.IsNullOrEmpty(fos))
  722. {
  723. this.eFormViewerCtrl.OpenFos(fos);
  724. }
  725. int prntCnt = 0;
  726. prntCnt = consentCommandCtrl.CurrentPreviewConsent.PrntCnt;
  727. this.checkAutoPrint = true;//자동출력
  728. if (this.ConsentExecuteInfo.ContainsKey("printList") && !string.IsNullOrEmpty(this.ConsentExecuteInfo["printList"]))
  729. {
  730. if (this.ConsentExecuteInfo.ContainsKey("prntCnt") && !string.IsNullOrEmpty(this.ConsentExecuteInfo["prntCnt"])
  731. && !this.ConsentExecuteInfo["prntCnt"].ToString().Equals("-1"))
  732. {
  733. int.TryParse(this.ConsentExecuteInfo["prntCnt"].ToString(), out prntCnt);
  734. }
  735. }
  736. this.multiPrintPlanCnt = prntCnt;
  737. this.multiPrintExecCnt = 0;
  738. if (prntCnt > 0)
  739. {
  740. //this.printSaveStatus = false;
  741. //// 출력매수만큼 동의서 출력
  742. //for (int i = 0; i < prntCnt; i++)
  743. //{
  744. // if ((i + 1) == prntCnt) this.printSaveStatus = true;
  745. this.printSaveStatus = true;
  746. //기본프린터로 바로 출력하기로 함
  747. this.eFormViewerCtrl.PrintByPrinterName("");
  748. //}
  749. //this.printSaveStatus = false;
  750. }
  751. }
  752. void IConsentMain.MoveFirstPage()
  753. {
  754. this.eFormViewerCtrl.MoveFirstPage();
  755. }
  756. void IConsentMain.MovePrevPage()
  757. {
  758. this.eFormViewerCtrl.MovePrevPage();
  759. }
  760. void IConsentMain.MoveNextPage()
  761. {
  762. this.eFormViewerCtrl.MoveNextPage();
  763. }
  764. void IConsentMain.MoveLastPage()
  765. {
  766. this.eFormViewerCtrl.MoveLastPage();
  767. }
  768. void IConsentMain.Save()
  769. {
  770. this.eFormViewerCtrl.Save();
  771. }
  772. void IConsentMain.TempSave()
  773. {
  774. this.eFormViewerCtrl.TempSave();
  775. }
  776. int IConsentMain.GetCurrentPageIndex()
  777. {
  778. return this.eFormViewerCtrl.GetCurrentPageIndex();
  779. }
  780. int IConsentMain.GetTotalPageCount()
  781. {
  782. return this.eFormViewerCtrl.GetTotalPageCount();
  783. }
  784. void IConsentMain.MoveToPageIndex(int pageIndex)
  785. {
  786. this.eFormViewerCtrl.MoveToPageIndex(pageIndex);
  787. }
  788. void IConsentMain.SetZoomRate(string zoomRate)
  789. {
  790. this.eFormViewerCtrl.SetZoomRate(zoomRate);
  791. }
  792. void IConsentMain.EnableDrawing(bool enable)
  793. {
  794. this.eFormViewerCtrl.EnableDrawing(enable);
  795. }
  796. bool IConsentMain.IsDrawMode()
  797. {
  798. return this.eFormViewerCtrl.IsDrawMode();
  799. }
  800. void IConsentMain.RemoveAllDrawing()
  801. {
  802. this.eFormViewerCtrl.RemoveAllDrawing();
  803. }
  804. void IConsentMain.UndoDrawing()
  805. {
  806. this.eFormViewerCtrl.UndoDrawing();
  807. }
  808. void IConsentMain.RedoDrawing()
  809. {
  810. this.eFormViewerCtrl.RedoDrawing();
  811. }
  812. void IConsentMain.ConfigDrawingPen()
  813. {
  814. this.eFormViewerCtrl.ConfigDrawingPen();
  815. }
  816. void IConsentMain.SetFingerScanValue(string controlId, string base64Image)
  817. {
  818. this.eFormViewerCtrl.SetFingerPrintImage(controlId, base64Image, true);
  819. }
  820. void IConsentMain.SetSignatureImage(string controlId, string base64Image)
  821. {
  822. this.eFormViewerCtrl.SetSignatureImage(controlId, base64Image, true);
  823. }
  824. public CLIP.eForm.ImageView.ImageViewCtrl GetImageViewerCtrl()
  825. {
  826. return this.imageViewCtrl1;
  827. }
  828. void IConsentMain.CloseSignaturePopup(string controlId)
  829. {
  830. this.eFormViewerCtrl.CloseSignaturePopup(controlId);
  831. }
  832. void IConsentMain.SetRunOption(string optionKey, string optionValue)
  833. {
  834. this.eFormViewerCtrl.SetRunOption(optionKey, optionValue);
  835. }
  836. void IConsentMain.TerminateConsentMain()
  837. {
  838. if (this.Parent is System.Windows.Forms.Form)
  839. {
  840. ((Form)this.Parent).DialogResult = DialogResult.Cancel;
  841. ((Form)this.Parent).Close();
  842. }
  843. }
  844. void IConsentMain.DeleteAttach()
  845. {
  846. this.eFormViewerCtrl.DeleteAttach();
  847. }
  848. void IConsentMain.InsertAttach()
  849. {
  850. this.eFormViewerCtrl.InsertAttach();
  851. }
  852. public void CloseDualViewer()
  853. {
  854. this.eFormViewerCtrl.CloseDualViewer();
  855. this.consentCommandCtrl.SetEnableConsentIssueCommands(true);
  856. this.consentCommandCtrl.SetEnableButtonsByCurrentConsent();
  857. }
  858. private void OnWrittenImageFile(string value)
  859. {
  860. this.consentCommandCtrl.WorkExtraWithSavedImageFiles(value);
  861. }
  862. private void OnWrittenDataXmlFile(string value)
  863. {
  864. string dataXmlValue = string.Empty;
  865. if (!string.IsNullOrEmpty(value))
  866. {
  867. XmlDocument xmlDocument = new XmlDocument();
  868. xmlDocument.Load(value);
  869. dataXmlValue = xmlDocument.InnerXml;
  870. outputDataDic = new Dictionary<string, string>();
  871. XmlNode rootNode = xmlDocument.SelectSingleNode("form-data");
  872. foreach (XmlNode childNode in rootNode.ChildNodes)
  873. {
  874. string fieldName = string.Empty;
  875. string fieldValue = string.Empty;
  876. XmlElement outFieldElement = childNode as XmlElement;
  877. if (outFieldElement != null)
  878. {
  879. fieldName = outFieldElement.Name;
  880. if (outFieldElement.ChildNodes.Count > 0
  881. && outFieldElement.ChildNodes[0] is XmlCDataSection)
  882. {
  883. fieldValue = ((XmlCDataSection)outFieldElement.ChildNodes[0]).InnerText;
  884. }
  885. if (outputDataDic.ContainsKey(fieldName))
  886. {
  887. outputDataDic[fieldName] = fieldValue;
  888. }
  889. else
  890. {
  891. outputDataDic.Add(fieldName, fieldValue);
  892. }
  893. }
  894. }
  895. if (processResultValues.ContainsKey("OUTPUT_VALUES"))
  896. {
  897. processResultValues["OUTPUT_VALUES"] = outputDataDic;
  898. }
  899. else
  900. {
  901. processResultValues.Add("OUTPUT_VALUES", outputDataDic);
  902. }
  903. }
  904. try
  905. {
  906. int state = this.consentWebService.CheckConsentState(int.Parse(consentCommandCtrl.CurrentPreviewConsent.ConsentMstRid), consentCommandCtrl.CurrentPreviewConsent.ConsentState);
  907. if (state == 1)
  908. {
  909. MessageBoxDlg.Show(this, "이미 저장된 서식 입니다."
  910. , string.Format(Properties.Resources.msg_caption_confirm),
  911. MessageBoxButtons.OK, MessageBoxIcon.Information);
  912. return;
  913. }
  914. string eptXmlValue = this.eFormViewerCtrl.GetTempSaveForm();
  915. object saveResult = null;
  916. bool isSaved = this.consentCommandCtrl.SaveCompleteConsentData(eptXmlValue, dataXmlValue, out saveResult);
  917. if (processResultValues.ContainsKey("OTHER_VALUE_1"))
  918. {
  919. processResultValues["OTHER_VALUE_1"] = saveResult;
  920. }
  921. else
  922. {
  923. processResultValues.Add("OTHER_VALUE_1", saveResult);
  924. }
  925. if (isSaved)
  926. {
  927. if (ProcessResult != null)
  928. {
  929. ProcessResult.Invoke("SUCCESS");
  930. }
  931. }
  932. else
  933. {
  934. ProcessResult.Invoke("FAIL");
  935. }
  936. }
  937. catch (Exception ex)
  938. {
  939. System.Diagnostics.Trace.WriteLine(string.Format("CLIP.eForm error: {0}", ex.Message));
  940. MessageBoxDlg.Show(true, string.Format(ex.Message)
  941. , string.Format(Properties.Resources.msg_caption_fail),
  942. MessageBoxButtons.OK, MessageBoxIcon.Error);
  943. ProcessResult.Invoke("FAIL");
  944. return;
  945. }
  946. finally
  947. {
  948. this.eFormViewerCtrl.CloseDualViewer();
  949. }
  950. }
  951. private void OnWrittenTempSaveFile(string value)
  952. {
  953. XmlDocument xmlDocument = new XmlDocument();
  954. xmlDocument.Load(value);
  955. string eptXmlValue = xmlDocument.InnerXml;
  956. try
  957. {
  958. string dataXml = this.eFormViewerCtrl.GetDataXml();
  959. this.consentCommandCtrl.SaveTempConsentData(eptXmlValue, dataXml);
  960. // 전자인증 서명 유무에 따른 분기
  961. // 전자인증 서명여부가 "Y"가 아닐 경우 임시저장일경우 서명처리 한다.
  962. string esignYn = this.consentCommandCtrl.getPreviewConsentEsignYn();
  963. if (!string.IsNullOrEmpty(esignYn) && esignYn.Equals("Y"))
  964. {
  965. // 임시 저장
  966. this.consentCommandCtrl.SaveTempConsentData(eptXmlValue, dataXml);
  967. try
  968. {
  969. if (!string.IsNullOrEmpty(value))
  970. {
  971. FileInfo fileInfo;
  972. fileInfo = new FileInfo(value);
  973. if (fileInfo != null)
  974. {
  975. // EPT 파일 삭제
  976. fileInfo.Delete();
  977. }
  978. }
  979. }
  980. catch (System.IO.IOException e)
  981. {
  982. throw e;
  983. }
  984. }
  985. else
  986. {
  987. // 서명 저장 프로세스(전자인증은 안함)
  988. this.OnWrittenDataXmlFile(value);
  989. }
  990. }
  991. catch (Exception ex)
  992. {
  993. System.Diagnostics.Trace.WriteLine(string.Format("CLIP.eForm error: {0}", ex.Message));
  994. //MessageBox.Show(string.Format(Properties.Resources.msg_temp_save_fail)
  995. // , string.Format(Properties.Resources.msg_caption_fail),
  996. // MessageBoxButtons.OK, MessageBoxIcon.Error);
  997. return;
  998. }
  999. finally
  1000. {
  1001. this.eFormViewerCtrl.CloseDualViewer();
  1002. }
  1003. }
  1004. public void SetConsentListSplitPanelVisibility(bool visibility)
  1005. {
  1006. if (!visibility)
  1007. {
  1008. this.splitConsent.Panel1Collapsed = true;
  1009. }
  1010. }
  1011. public void SetPatientListSplitPanelVisibility(bool visibility)
  1012. {
  1013. if (!visibility)
  1014. {
  1015. this.splitPatient.Panel2Collapsed = true;
  1016. }
  1017. }
  1018. public bool UseFingerScan { get; set; }
  1019. public bool viewStatus { get; set; }
  1020. private void panelReview_Resize(object sender, EventArgs e)
  1021. {
  1022. if (this.pnlViewer.Visible)
  1023. {
  1024. if (OnResizeReviewConsent != null)
  1025. {
  1026. OnResizeReviewConsent.Invoke(this, new EventArgs());
  1027. }
  1028. }
  1029. }
  1030. private void eFormViewerCtrl_OnError(string errorCode, string errorMessage)
  1031. {
  1032. }
  1033. private void eFormViewerCtrl_OnProcess(string eventCode, string value)
  1034. {
  1035. System.Diagnostics.Trace.WriteLine(string.Format("eventCode: {0} - value: {1}", eventCode, value));
  1036. if (eventCode.Equals("PAGING"))
  1037. {
  1038. this.consentCommandCtrl.OnPaging(this.eFormViewerCtrl.GetCurrentPageIndex());
  1039. }
  1040. if (eventCode.Equals("DUAL_VIEWER"))
  1041. {
  1042. if (value.Equals("OPEN"))
  1043. {
  1044. this.consentListCtrl.Enabled = false;
  1045. this.patientInfoCtrl.Enabled = false;
  1046. this.patientListCtrl.Enabled = false;
  1047. // this.eFormViewerCtrl.SetRunOption("READ_ONLY", "false");
  1048. this.consentCommandCtrl.EnablePenDrawing = true;
  1049. this.consentCommandCtrl.EnablePenConfig = true;
  1050. this.consentCommandCtrl.SetEnablementExecuteWhenDualViewerActive(false);
  1051. }
  1052. if (value.Equals("CLOSE"))
  1053. {
  1054. this.consentListCtrl.Enabled = true;
  1055. this.patientInfoCtrl.Enabled = true;
  1056. this.patientListCtrl.Enabled = true;
  1057. // this.eFormViewerCtrl.SetRunOption("READ_ONLY", "true");
  1058. this.consentCommandCtrl.EnablePenDrawing = false;
  1059. this.consentCommandCtrl.EnablePenConfig = false;
  1060. this.consentCommandCtrl.onEnableDrawing(false);
  1061. this.eFormViewerCtrl.EnableDrawing(false);
  1062. this.consentCommandCtrl.SetEnablementExecuteWhenDualViewerActive(true);
  1063. }
  1064. }
  1065. if (eventCode.Equals("WRITTEN_IMAGE_FILE"))
  1066. {
  1067. this.OnWrittenImageFile(value);
  1068. }
  1069. if (eventCode.Equals("DATA_XML_PATH"))
  1070. {
  1071. // 작성완료 버튼이 활성화 되어 있을 경우에만 작성완료 로직을 진행한다.
  1072. if(this.consentCommandCtrl.getSaveButton())
  1073. {
  1074. this.consentCommandCtrl.setSaveButton(false);
  1075. this.OnWrittenDataXmlFile(value);
  1076. this.consentCommandCtrl.setSaveButton(true);
  1077. this.eFormViewerCtrl.ConfirmSave(true, "");
  1078. }
  1079. }
  1080. if (eventCode.Equals("TEMP_SAVE_PATH"))
  1081. {
  1082. // 임시저장 버튼이 활성화 되어 있을 경우에만 임시저장 로직을 진행한다.
  1083. if (this.consentCommandCtrl.getTempSaveButton())
  1084. {
  1085. this.consentCommandCtrl.setTempSaveButton(false);
  1086. this.OnWrittenTempSaveFile(value);
  1087. this.consentCommandCtrl.setTempSaveButton(true);
  1088. this.eFormViewerCtrl.ConfirmSave(true, "");
  1089. }
  1090. }
  1091. if (eventCode.Equals("PRINT_COMPLETE"))
  1092. {
  1093. this.consentCommandCtrl.OnPrint(value);
  1094. }
  1095. if (eventCode.Equals("REQUIRED_INPUT_VIOLATION"))
  1096. {
  1097. this.consentCommandCtrl.OnRequiredInputViolation(value);
  1098. }
  1099. if (eventCode.Equals("ENABLE_DRAWING"))
  1100. {
  1101. if (value.Equals("TRUE"))
  1102. {
  1103. this.consentCommandCtrl.onEnableDrawing(true);
  1104. }
  1105. else if (value.Equals("FALSE"))
  1106. {
  1107. this.consentCommandCtrl.onEnableDrawing(false);
  1108. }
  1109. }
  1110. if (eventCode.Equals("INITIALIZE_STATE"))
  1111. {
  1112. // 저장 없이 연속출력 다음 서식으로 이동
  1113. if (value.Equals("FormViewInitialized"))
  1114. {
  1115. viewStatus = true;
  1116. }
  1117. }
  1118. }
  1119. private void eFormViewerCtrl_VisibleChanged(object sender, EventArgs e)
  1120. {
  1121. if (this.eFormViewerCtrl.Visible)
  1122. {
  1123. if (this.OnVisibleEFormControl != null)
  1124. {
  1125. this.OnVisibleEFormControl.Invoke(this, new EventArgs());
  1126. }
  1127. }
  1128. else
  1129. {
  1130. if (this.OnInvisibleEFormControl != null)
  1131. {
  1132. this.OnInvisibleEFormControl.Invoke(this, new EventArgs());
  1133. }
  1134. }
  1135. }
  1136. public void preParamClean()
  1137. {
  1138. if (this.ConsentExecuteInfo.ContainsKey("startFormCd") && !string.IsNullOrEmpty(this.ConsentExecuteInfo["startFormCd"]))
  1139. {
  1140. this.ConsentExecuteInfo["startFormCd"] = string.Empty;
  1141. }
  1142. // consentCommandCtrl.fosOpenSequence = null;
  1143. }
  1144. void IConsentMain.ReInitializeViewer()
  1145. {
  1146. this.eFormViewerCtrl.ReInitializeViewer();
  1147. this.viewStatus = false;
  1148. }
  1149. public void OnProcessCmdKey(Keys keyData)
  1150. {
  1151. }
  1152. }
  1153. }