ConsentSelectTabConsentSearch.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  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:ConsentSelectTabConsentSearch.cs
  8. //
  9. #endregion
  10. using System;
  11. using System.ComponentModel;
  12. using System.Drawing;
  13. using System.Windows.Forms;
  14. using CLIP.eForm.Consent.UI.ConsentSvcRef;
  15. using CLIP.eForm.Consent.UI.HospitalSvcRef;
  16. using ConsentVO = CLIP.eForm.Consent.UI.ConsentSvcRef.ConsentVO;
  17. namespace CLIP.eForm.Consent.UI {
  18. /// <summary>
  19. /// 동의서 찾기 탭 클래스
  20. /// </summary>
  21. /// <remarks>
  22. /// <p>[설계자]</p>
  23. /// <p> 클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)</p>
  24. /// <p>[원본 작성자]</p>
  25. /// <p> 클립소프트 기술부 4팀 이창훈 (chlee@clipsoft.co.kr)</p>
  26. /// <p>[수정 작성자]</p>
  27. /// <p> 클립소프트 기술부 이인희</p>
  28. /// <p>----------------------------------------------------------------------------------------</p>
  29. /// <p>[HISTORY]</p>
  30. /// <p> 2015-07-30 : 최초작성</p>
  31. /// <p>----------------------------------------------------------------------------------------</p>
  32. /// </remarks>
  33. public partial class ConsentSelectTabConsentSearch : UserControl {
  34. private ConsentSvcRef.ConsentSvcSoapClient consentWebService = null;
  35. private HospitalSvcRef.HospitalSvcSoapClient hospitalWebService = null;
  36. private IConsentMain consentMain = null;
  37. private ConsentCommandCtrl commandControl = null;
  38. Timer grdClickTimer = new Timer();
  39. public ConsentSelectTabConsentSearch() {
  40. InitializeComponent();
  41. grdClickTimer.Interval = 500;
  42. grdClickTimer.Tag = "stop";
  43. grdClickTimer.Tick += grdTimer_Tick;
  44. }
  45. private void ConsentSelectTabConsentSearch_Load(object sender, EventArgs e) {
  46. if (this.DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime) {
  47. return;
  48. }
  49. consentMain = ConsentMainControl.GetConsentMainInterface(this);
  50. commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  51. consentWebService = WebMethodCommon.GetConsentWebService(consentMain.PluginExecuteInfo["consentSvcUrl"]);
  52. hospitalWebService = WebMethodCommon.GetHospitalWebService(consentMain.PluginExecuteInfo["hospitalSvcUrl"]);
  53. InitComboBoxConsentType();
  54. // 동의서 찾기에서 기본 카테고리를 해당 기관으로 기본적으로 설정되게끔 변경
  55. //comboBoxConsentType.SelectedValue = string.Format("EMA_{0}", consentMain.ConsentExecuteInfo["dutinstcd"]);
  56. InitDataGrid();
  57. }
  58. /// <summary>
  59. /// 초기 DataGrid 항목 설정
  60. /// </summary>
  61. private void InitDataGrid() {
  62. this.dataGridViewConsentSelectResult.AllowUserToAddRows = false;
  63. this.dataGridViewConsentSelectResult.CellDoubleClick += new DataGridViewCellEventHandler(dataGridViewConsentSelectResult_CellDoubleClick);
  64. // 그리드에 표시될 컬럼 목록
  65. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서명", "formName", true, 250);
  66. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서 코드", "formCd", true, 100);
  67. // 그리드에 표시되지 않을 목록
  68. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "서식 ID", "formId", false);
  69. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "서식상태", "consentStateDisp", false);
  70. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "OCRTAG 출력여부", "ocrTagYN", false);
  71. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "출력 매수", "prntCnt", false);
  72. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "울력전용", "prntOnly", false);
  73. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "서식 출력명", "formPrintName", false);
  74. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "의사 전용 서식 여부", "DrOnly", false);
  75. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "기관번호", "instCd", false);
  76. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "진료과코드", "clnDeptCd", false);
  77. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "진료과명", "clnDeptNm", false);
  78. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "내원일", "clnDate", false);
  79. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "주치의", "mainDrId", false);
  80. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "병동코드", "wardCd", false);
  81. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "병실코드", "roomCd", false);
  82. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "수술진단명", "opDiagName", false);
  83. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "수술명", "opName", false);
  84. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "수술예약번호", "opRsrvNo", false);
  85. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서 고유코드", "consentMstRid", false);
  86. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성자 아이디", "createUserId", false);
  87. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성자 이름", "createUserName", false);
  88. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성 일시", "createDatetime", false);
  89. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "수정자 아이디", "modifyUserId", false);
  90. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "생성자 이름", "modifyUserName", false);
  91. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "OCRTAG", "ocrTag", false);
  92. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "환자번호", "pid", false);
  93. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "ordtype", "ordType", false);
  94. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "cretNo", "cretNo", false);
  95. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "patientName", "patientName", false);
  96. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "consentState", "consentState", false);
  97. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "certUseYn", "certUseYn", false);
  98. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "userDrFlag", "userDrFlag", false);
  99. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "linkFormCd", "linkFormCd", false);
  100. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "jinjeongCd", "jinjeongCd", false);
  101. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "jinjeongCd", "jinjeongCd", false);
  102. }
  103. #region 동의서 카테고리 바인딩
  104. /// <summary>
  105. /// 초기 동의서 카테고리 바인딩
  106. /// </summary>
  107. private void InitComboBoxConsentType() {
  108. CategoryForDropdownVO[] arrayData = consentWebService.GetCategoryForDropdown(consentMain.ConsentExecuteInfo["dutinstcd"]);
  109. CategoryForDropdownVO[] mainCategory = new CategoryForDropdownVO[1];
  110. CategoryForDropdownVO mainItem = new CategoryForDropdownVO();
  111. mainItem.CategoryId = "F";
  112. mainItem.CategoryName = "전체";
  113. mainCategory[0] = mainItem;
  114. this.comboBoxConsentType.DisplayMember = "CategoryName";
  115. this.comboBoxConsentType.ValueMember = "CategoryId";
  116. this.comboBoxConsentType.DataSource = mainCategory;
  117. // 서브 카테고리 설정
  118. InitComboBoxConsentSubType(consentMain.ConsentExecuteInfo["dutinstcd"]);
  119. }
  120. class MainCategory {
  121. String CategoryName;
  122. String CategoryId;
  123. public MainCategory(String CategoryName, String CategoryId) {
  124. this.CategoryName = CategoryName;
  125. this.CategoryId = CategoryId;
  126. }
  127. }
  128. /// <summary>
  129. /// comboBoxConsentType 콤보 컨트롤 변경 이벤트
  130. /// </summary>
  131. /// <param name="sender">The source of the event.</param>
  132. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  133. private void comboBoxConsentType_SelectedIndexChanged(object sender, EventArgs e) {
  134. //SetSubConsentTypeDataToComboBox();
  135. }
  136. /// <summary>
  137. /// 동의서 하위 분류 항목 바인딩
  138. /// </summary>
  139. private void SetSubConsentTypeDataToComboBox() {
  140. string comboBoxConsentTypeValue = comboBoxConsentType.SelectedValue.ToString();
  141. // 전체 선택
  142. if (comboBoxConsentTypeValue.Equals("CATE_ALL")) {
  143. this.comboBoxConsentSubType.DataSource = null;
  144. this.comboBoxConsentSubType.Enabled = false;
  145. } else {
  146. this.comboBoxConsentSubType.Enabled = true;
  147. InitComboBoxConsentSubType(comboBoxConsentTypeValue);
  148. }
  149. }
  150. /// <summary>
  151. /// 동의서 하위 분류 조회 및 바인딩
  152. /// </summary>
  153. /// <param name="parentValue">The parent value.</param>
  154. private void InitComboBoxConsentSubType(string parentValue) {
  155. // 주어진 parentValue 로 GetCategoryForDropdown API 호출
  156. CategoryForDropdownVO[] arrayData = consentWebService.GetCategoryForDropdown(parentValue);
  157. this.comboBoxConsentSubType.DisplayMember = "CategoryName";
  158. this.comboBoxConsentSubType.ValueMember = "CategoryId";
  159. this.comboBoxConsentSubType.DataSource = arrayData;
  160. }
  161. #endregion
  162. #region 동의서 조회하고 그리드 바인딩
  163. /// <summary>
  164. /// textBoxConsentSearchKeyWord 키보드 입력 이벤트
  165. /// </summary>
  166. /// <param name="sender">The source of the event.</param>
  167. /// <param name="e">The <see cref="KeyEventArgs"/> instance containing the event data.</param>
  168. private void textBoxConsentSearchKeyWord_KeyDown(object sender, KeyEventArgs e) {
  169. // 엔터키 입력 시 조회 버튼 클릭 이벤트 수행
  170. if (e.KeyCode == Keys.Enter) {
  171. this.buttonConsentSelect.PerformClick();
  172. }
  173. }
  174. /// <summary>
  175. /// 조회 버튼 클릭 이벤트
  176. /// </summary>
  177. /// <param name="sender">The source of the event.</param>
  178. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  179. private void buttonConsentSelect_Click(object sender, EventArgs e) {
  180. buttonConsentSelect.Enabled = false;
  181. Application.DoEvents();
  182. IConsentMain consentMain = ConsentMainControl.GetConsentMainInterface(this);
  183. ConsentCommandCtrl commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  184. consentMain.preParamClean();
  185. GetConsentBySearch();
  186. buttonConsentSelect.Enabled = true;
  187. }
  188. /// <summary>
  189. /// 동의서 검색
  190. /// </summary>
  191. private void GetConsentBySearch() {
  192. Cursor currentCursor = this.Cursor;
  193. try {
  194. this.Cursor = Cursors.WaitCursor;
  195. string consentType = string.Empty;
  196. // 부서명이 선택되어 있지 않으면 근무지기관코드로 검색
  197. if (this.comboBoxConsentSubType.SelectedValue == null) {
  198. consentType = this.comboBoxConsentType.SelectedValue.ToString();
  199. }
  200. // 부서명이 선택되어 있으면 부서명으로 검색
  201. else {
  202. consentType = this.comboBoxConsentSubType.SelectedValue.ToString();
  203. }
  204. string keyWord = string.Empty;
  205. keyWord = "%" + this.textBoxConsentSearchKeyWord.Text + "%";
  206. if ((consentType.Equals("EMA_031") || consentType.Equals("EMA_032")) && keyWord.Trim().Equals("%%")) {
  207. MessageBox.Show("과 또는 검색어를 입력해주세요.");
  208. return;
  209. }
  210. ConsentVO[] arrayData = consentWebService.GetConsentBySearch(consentType, keyWord, consentMain.ConsentExecuteInfo["dutinstcd"]);
  211. if (arrayData == null) {
  212. return;
  213. }
  214. this.dataGridViewConsentSelectResult.DataSource = new SortableBindingList<ConsentSvcRef.ConsentVO>(arrayData);
  215. } catch (Exception ex) {
  216. throw ex;
  217. } finally {
  218. this.Cursor = currentCursor;
  219. }
  220. }
  221. #endregion
  222. #region 그리드 이벤트
  223. /// <summary>
  224. /// dataGridViewConsentSelectResult 그리드 셀 더블클릭 이벤트
  225. /// </summary>
  226. /// <param name="sender">The source of the event.</param>
  227. /// <param name="e">The <see cref="DataGridViewCellEventArgs"/> instance containing the event data.</param>
  228. private void dataGridViewConsentSelectResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e) {
  229. if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  230. if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  231. // dbs227, 셀 클릭 시 더블클릭 인식되어 작동되는 경우 오류
  232. if (e.RowIndex < 0) {
  233. return;
  234. }
  235. ConsentVO vo = GetCurrentConsentSearchVO(e.RowIndex);
  236. //
  237. if (!consentMain.checkOperationDocument(vo.formCd)) {
  238. return;
  239. }
  240. string electrVisble = ConsentMainControl.SETTING_DATA["ELECTR_CMP"];
  241. if (commandControl.CurrentTargetPatient.VisitType.Equals("O")) {
  242. if (electrVisble.Equals("Y")) {
  243. commandControl.setCompleteSaveButton(true);
  244. }
  245. } else {
  246. if (electrVisble.Equals("Y") && commandControl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) {
  247. commandControl.setCompleteSaveButton(true);
  248. } else {
  249. commandControl.setCompleteSaveButton(false);
  250. }
  251. }
  252. //if (commandControl.CurrentTargetPatient.VisitType.Equals("O")) {
  253. // commandControl.setCompleteSaveButton(true);
  254. //} else {
  255. // if (ConsentMainControl.SETTING_DATA["ELECTR_CMP"].Equals("Y") && commandControl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) {
  256. // commandControl.setCompleteSaveButton(true);
  257. // } else {
  258. // commandControl.setCompleteSaveButton(false);
  259. // }
  260. //}
  261. //의사가 아닐경우 확인저장 비활성화
  262. //if (!commandControl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) {
  263. // commandControl.setCompleteSaveButton(false);
  264. //}
  265. if (vo != null) {
  266. // 선택된 동의서가 현재 보여지고 있는 동의서와 다른 경우, 임시 저장 여부 확인
  267. if (!consentMain.ConsentExecuteInfo["readOnly"].Equals("Y") &&
  268. !string.IsNullOrEmpty(commandControl.CurrentTargetPatient.PatientCode) &&
  269. commandControl.CurrentPreviewConsent != null && !commandControl.CurrentPreviewConsent.formId.Equals(vo.formId.ToString()) &&
  270. (commandControl.CurrentPreviewConsent.consentState == string.Empty || commandControl.CurrentPreviewConsent.consentState == "TEMP")) {
  271. // dbs227, 임시저장 팝업 사용 안함
  272. //DialogResult result = MessageBox.Show(string.Format(Properties.Resources.msg_confirm_tempsave)
  273. // , string.Format(Properties.Resources.msg_caption_confirm),
  274. // MessageBoxButtons.YesNo, MessageBoxIcon.Information);
  275. //if (result == DialogResult.Yes) {
  276. // consentMain.TempSave();
  277. //}
  278. }
  279. Cursor currentCursor = this.Cursor;
  280. this.Cursor = Cursors.WaitCursor;
  281. ExecutePreviewWithSelectedConsent(vo);
  282. RunConsentDualView();
  283. commandControl.SetEnableConsentIssueCommands(true);
  284. this.Cursor = currentCursor;
  285. }
  286. }
  287. private void RunConsentDualView() {
  288. if (this.consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  289. if (this.commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  290. commandControl.RunConsentDualView();
  291. }
  292. /// <summary>
  293. /// dataGridViewConsentSelectResult 그리드 셀 마우스 우클릭 이벤트
  294. /// </summary>
  295. /// <param name="sender">The source of the event.</param>
  296. /// <param name="e">The <see cref="DataGridViewCellContextMenuStripNeededEventArgs"/> instance containing the event data.</param>
  297. private void dataGridViewConsentSelectResult_CellContextMenuStripNeeded(object sender, DataGridViewCellContextMenuStripNeededEventArgs e) {
  298. if (e.RowIndex >= 0 && this.dataGridViewConsentSelectResult.Rows[e.RowIndex].Selected == true) {
  299. ContextMenuStrip strip = new ContextMenuStrip();
  300. ToolStripMenuItem setItemAdd = new ToolStripMenuItem();
  301. setItemAdd.Text = "즐겨찾기 추가";
  302. strip.Items.Add(setItemAdd);
  303. setItemAdd.Click += new EventHandler(setItemAdd_Click);
  304. e.ContextMenuStrip = strip;
  305. }
  306. }
  307. /// <summary>
  308. /// 선택된 동의서를 개인SET에 등록
  309. /// </summary>
  310. /// <param name="sender">The source of the event.</param>
  311. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  312. private void setItemAdd_Click(object sender, EventArgs e) {
  313. IConsentMain consentMain = ConsentMainControl.GetConsentMainInterface(this);
  314. ConsentCommandCtrl commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  315. if (this.dataGridViewConsentSelectResult.SelectedRows.Count != 0) {
  316. Cursor currentCursor = this.Cursor;
  317. this.Cursor = Cursors.WaitCursor;
  318. try {
  319. ConsentVO vo = GetCurrentConsentSearchVO(this.dataGridViewConsentSelectResult.SelectedRows[0].Index);
  320. // 동의서 SET에 추가하는 웹서비스 호출
  321. hospitalWebService.SetUserFormSetList(commandControl.CurrentEndUser.UserNo, vo.formCd, consentMain.ConsentExecuteInfo["dutinstcd"]);
  322. } catch {
  323. } finally {
  324. this.Cursor = currentCursor;
  325. }
  326. MessageBox.Show(string.Format(Properties.Resources.msg_consent_set_added)
  327. , string.Format(Properties.Resources.msg_caption_confirm), MessageBoxButtons.OK, MessageBoxIcon.Information);
  328. }
  329. }
  330. #endregion
  331. #region 동의서 미리보기
  332. private ConsentVO GetCurrentConsentSearchVO(int rowIndex) {
  333. ConsentVO vo = null;
  334. if (rowIndex < 0) {
  335. return vo;
  336. }
  337. vo = this.dataGridViewConsentSelectResult.Rows[rowIndex].DataBoundItem as ConsentVO;
  338. return vo;
  339. }
  340. private void ExecutePreviewWithSelectedConsent(ConsentVO vo) {
  341. if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  342. if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  343. Cursor currentCursor = this.Cursor;
  344. try {
  345. this.Cursor = Cursors.WaitCursor;
  346. commandControl.CurrentPreviewConsent = new PreviewConsent {
  347. formId = vo.formId.ToString(),
  348. formCd = vo.formCd.ToString(),
  349. formName = vo.formName,
  350. formPrintName = vo.formPrintName,
  351. prntCnt = vo.prntCnt,
  352. consentMstRid = "-1",
  353. consentState = string.Empty,
  354. consentStateEng = string.Empty,
  355. inputId = commandControl.CurrentEndUser.UserNo,
  356. inputNm = commandControl.CurrentEndUser.UserName,
  357. ReissueConsentMstRid = 0,
  358. RewriteConsentMstRid = 0,
  359. ocrtagPrntyn = vo.ocrTagYN,
  360. userDrFlag = vo.userDrFlag,
  361. printOnly = vo.prntOnly,
  362. opDiagName = vo.opDiagName,
  363. opName = vo.opName,
  364. ocrCode = "",
  365. drOnly = vo.DrOnly,
  366. linkFormCd = vo.linkFormCd
  367. };
  368. consentMain.PatientInfoCtrl.SetConsentDocumentName(vo.formName);
  369. commandControl.PreviewConsent(consentMain);
  370. } catch (Exception e) {
  371. MessageBox.Show(this, e.Message);
  372. consentMain.ClearPreviewConsent(true);
  373. } finally {
  374. this.Cursor = currentCursor;
  375. }
  376. }
  377. #endregion
  378. private void comboBoxConsentType_DrawItem(object sender, DrawItemEventArgs e) {
  379. ComboBox box = sender as ComboBox;
  380. if (box is null)
  381. return;
  382. e.DrawBackground();
  383. if (e.Index >= 0) {
  384. Graphics g = e.Graphics;
  385. using (Brush brush = ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
  386. ? new SolidBrush(SystemColors.Highlight)
  387. : new SolidBrush(e.BackColor)) {
  388. using (Brush textBrush = new SolidBrush(e.ForeColor)) {
  389. g.FillRectangle(brush, e.Bounds);
  390. g.DrawString(((CategoryForDropdownVO[]) box.DataSource)[e.Index].CategoryName,
  391. e.Font,
  392. textBrush,
  393. (float) e.Bounds.X,
  394. (float) (e.Bounds.Y) + 2.34F);
  395. }
  396. }
  397. }
  398. e.DrawFocusRectangle();
  399. }
  400. private void comboBoxConsentType_MeasureItem(object sender, MeasureItemEventArgs e) {
  401. e.ItemHeight = 20;
  402. }
  403. private void comboBoxConsentSubType_DrawItem(object sender, DrawItemEventArgs e) {
  404. ComboBox box = sender as ComboBox;
  405. if (box is null)
  406. return;
  407. e.DrawBackground();
  408. if (e.Index >= 0) {
  409. Graphics g = e.Graphics;
  410. using (Brush brush = ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
  411. ? new SolidBrush(SystemColors.Highlight)
  412. : new SolidBrush(e.BackColor)) {
  413. using (Brush textBrush = new SolidBrush(e.ForeColor)) {
  414. g.FillRectangle(brush, e.Bounds);
  415. g.DrawString(((CategoryForDropdownVO[]) box.DataSource)[e.Index].CategoryName,
  416. e.Font,
  417. textBrush,
  418. (float) e.Bounds.X,
  419. (float) (e.Bounds.Y) + 2.34F);
  420. }
  421. }
  422. }
  423. e.DrawFocusRectangle();
  424. }
  425. private void comboBoxConsentSubType_MeasureItem(object sender, MeasureItemEventArgs e) {
  426. e.ItemHeight = 20;
  427. }
  428. private void dataGridViewConsentSelectResult_Click(object sender, EventArgs e)
  429. {
  430. if (grdClickTimer.Tag.ToString().Equals("run"))
  431. {
  432. grdTimer_Tick(null, null);
  433. dataGridViewConsentSelectResult_DoubleClickProcessor(dataGridViewConsentSelectResult.SelectedRows[0].Index);
  434. }
  435. else
  436. {
  437. grdClickTimer.Start();
  438. grdClickTimer.Tag = "run";
  439. }
  440. }
  441. private void grdTimer_Tick(object sender, EventArgs e)
  442. {
  443. grdClickTimer.Stop();
  444. grdClickTimer.Tag = "stop";
  445. }
  446. /// <summary>
  447. /// dataGridViewConsentSelectResult 그리드 셀 더블클릭 이벤트(더블클릭이 안먹히는 경우에 들어갈 이벤트핸들러)
  448. /// </summary>
  449. /// <param name="sender">The source of the event.</param>
  450. /// <param name="e">The <see cref="DataGridViewCellEventArgs"/> instance containing the event data.</param>
  451. private void dataGridViewConsentSelectResult_DoubleClickProcessor(int row)
  452. {
  453. if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  454. if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  455. // dbs227, 셀 클릭 시 더블클릭 인식되어 작동되는 경우 오류
  456. if (row < 0)
  457. {
  458. return;
  459. }
  460. ConsentVO vo = GetCurrentConsentSearchVO(row);
  461. //
  462. if (!consentMain.checkOperationDocument(vo.formCd))
  463. {
  464. return;
  465. }
  466. string electrVisble = ConsentMainControl.SETTING_DATA["ELECTR_CMP"];
  467. if (commandControl.CurrentTargetPatient.VisitType.Equals("O"))
  468. {
  469. if (electrVisble.Equals("Y"))
  470. {
  471. commandControl.setCompleteSaveButton(true);
  472. }
  473. }
  474. else
  475. {
  476. if (electrVisble.Equals("Y") && commandControl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03"))
  477. {
  478. commandControl.setCompleteSaveButton(true);
  479. }
  480. else
  481. {
  482. commandControl.setCompleteSaveButton(false);
  483. }
  484. }
  485. //if (commandControl.CurrentTargetPatient.VisitType.Equals("O")) {
  486. // commandControl.setCompleteSaveButton(true);
  487. //} else {
  488. // if (ConsentMainControl.SETTING_DATA["ELECTR_CMP"].Equals("Y") && commandControl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) {
  489. // commandControl.setCompleteSaveButton(true);
  490. // } else {
  491. // commandControl.setCompleteSaveButton(false);
  492. // }
  493. //}
  494. //의사가 아닐경우 확인저장 비활성화
  495. //if (!commandControl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) {
  496. // commandControl.setCompleteSaveButton(false);
  497. //}
  498. if (vo != null)
  499. {
  500. // 선택된 동의서가 현재 보여지고 있는 동의서와 다른 경우, 임시 저장 여부 확인
  501. if (!consentMain.ConsentExecuteInfo["readOnly"].Equals("Y") &&
  502. !string.IsNullOrEmpty(commandControl.CurrentTargetPatient.PatientCode) &&
  503. commandControl.CurrentPreviewConsent != null && !commandControl.CurrentPreviewConsent.formId.Equals(vo.formId.ToString()) &&
  504. (commandControl.CurrentPreviewConsent.consentState == string.Empty || commandControl.CurrentPreviewConsent.consentState == "TEMP"))
  505. {
  506. // dbs227, 임시저장 팝업 사용 안함
  507. //DialogResult result = MessageBox.Show(string.Format(Properties.Resources.msg_confirm_tempsave)
  508. // , string.Format(Properties.Resources.msg_caption_confirm),
  509. // MessageBoxButtons.YesNo, MessageBoxIcon.Information);
  510. //if (result == DialogResult.Yes) {
  511. // consentMain.TempSave();
  512. //}
  513. }
  514. Cursor currentCursor = this.Cursor;
  515. this.Cursor = Cursors.WaitCursor;
  516. ExecutePreviewWithSelectedConsent(vo);
  517. RunConsentDualView();
  518. commandControl.SetEnableConsentIssueCommands(true);
  519. this.Cursor = currentCursor;
  520. }
  521. }
  522. }
  523. }