ConsentSelectTabPageAll.cs 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007
  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:ConsentSelectTabPageAll.cs
  8. //
  9. #endregion
  10. using System;
  11. using System.Drawing;
  12. using System.Collections.Generic;
  13. using System.ComponentModel;
  14. using System.Windows.Forms;
  15. using System.Configuration;
  16. using CLIP.eForm.Consent.UI.ConsentSvcRef;
  17. using ClipSoft.eForm.Base.Dialog;
  18. namespace CLIP.eForm.Consent.UI {
  19. /// <summary>
  20. /// 동의서 전체목록 탭 클래스
  21. /// </summary>
  22. /// <remarks>
  23. /// <p>[설계자]</p>
  24. /// <p> 클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)</p>
  25. /// <p>[원본 작성자]</p>
  26. /// <p> 클립소프트 기술부 4팀 이창훈 (chlee@clipsoft.co.kr)</p>
  27. /// <p>[수정 작성자]</p>
  28. /// <p> 클립소프트 기술부 이인희</p>
  29. /// <p>----------------------------------------------------------------------------------------</p>
  30. /// <p>[HISTORY]</p>
  31. /// <p> 2016-07-01 : 최초작성</p>
  32. /// <p>----------------------------------------------------------------------------------------</p>
  33. /// </remarks>
  34. public partial class ConsentSelectTabPageAll : UserControl {
  35. private ConsentSvcRef.ConsentSvcSoapClient consentWebService = null;
  36. private IConsentMain consentMain = null;
  37. private ConsentCommandCtrl commandControl = null;
  38. private string searchStartDate = string.Empty;
  39. public ConsentSelectTabPageAll() {
  40. InitializeComponent();
  41. }
  42. private void ConsentSelectTabPageAll_Load(object sender, EventArgs e) {
  43. Boolean isInWpfDesignerMode = (LicenseManager.UsageMode == LicenseUsageMode.Designtime);
  44. Boolean isInFormsDesignerMode = (System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv");
  45. if (isInWpfDesignerMode || isInFormsDesignerMode) {
  46. // is in any designer mode
  47. return;
  48. }
  49. if (this.DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime) {
  50. return;
  51. }
  52. consentMain = ConsentMainControl.GetConsentMainInterface(this);
  53. commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  54. consentWebService = WebMethodCommon.GetConsentWebService(consentMain.PluginExecuteInfo["consentSvcUrl"]);
  55. this.dateTimePickerEndDate.Value = DateTime.Now;
  56. // dbs227, 발행리스트 시작일자를 한달전으로 설정
  57. //this.dateTimePickerStartDate.Value = DateTime.Now.AddMonths(-1);
  58. this.dateTimePickerStartDate.Value = DateTime.Now.AddDays(-7);
  59. InitDataGrid();
  60. BindDataGridRows();
  61. }
  62. private void InitDataGrid() {
  63. this.dataGridViewConsentSelectResult.DataSource = null;
  64. this.dataGridViewConsentSelectResult.Columns.Clear();
  65. this.dataGridViewConsentSelectResult.ColumnHeaderMouseClick -= dataGridViewConsentSelectResult_ColumnHeaderMouseClick;
  66. this.dataGridViewConsentSelectResult.CellMouseClick -= dataGridViewConsentSelectResult_CellClick;
  67. // 이벤트 추가
  68. this.dataGridViewConsentSelectResult.ColumnHeaderMouseClick += new DataGridViewCellMouseEventHandler(this.dataGridViewConsentSelectResult_ColumnHeaderMouseClick);
  69. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "등록번호", "pid", true, 60, DataGridViewContentAlignment.MiddleCenter);
  70. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "OCRTAG", "ocrTag", true, 80);
  71. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "성명", "patientName", true, 60, DataGridViewContentAlignment.MiddleCenter);
  72. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "진료/\n입원일", "inDd", true, 80, DataGridViewContentAlignment.MiddleCenter);
  73. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서명", "formName", true, 180);
  74. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "상태", "consentState", true, 60, DataGridViewContentAlignment.MiddleCenter);
  75. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성자", "modifyUserName", true, 70, DataGridViewContentAlignment.MiddleCenter);
  76. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성자", "createUserName", false);
  77. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성일시", "createDatetime", true, 120, DataGridViewContentAlignment.MiddleCenter);
  78. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "", "consentMstRid", false);
  79. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "", "createUserId", false);
  80. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "", "ordType", false);
  81. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "", "ordDeptCd", false);
  82. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "", "cretNo", false);
  83. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "", "opRsrvNo", false);
  84. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "", "consentStateEng", false);
  85. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "", "formCd", false);
  86. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "", "formGuid", false);
  87. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "", "formRid", false);
  88. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "", "printOnly", false);
  89. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "", "printCnt", false);
  90. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "", "ocrTagPrntYn", false);
  91. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "", "formPrntNm", false);
  92. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "", "certUseYn", false);
  93. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "", "opDiagNm", false);
  94. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "", "opNm", false);
  95. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "", "userDrFlag", false);
  96. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "", "linkFormCd", false);
  97. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "", "jinjeongCd", false);
  98. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "", "modifyUserId", false);
  99. // 사용자별
  100. //if(rdoUser.Checked) {
  101. // // dbs227, 일괄저장 기능
  102. // // 이벤트 해재
  103. // this.dataGridViewConsentSelectResult.ColumnHeaderMouseClick -= dataGridViewConsentSelectResult_ColumnHeaderMouseClick;
  104. // this.dataGridViewConsentSelectResult.CellMouseClick -= dataGridViewConsentSelectResult_CellClick;
  105. // // 이벤트 추가
  106. // this.dataGridViewConsentSelectResult.ColumnHeaderMouseClick += new DataGridViewCellMouseEventHandler(this.dataGridViewConsentSelectResult_ColumnHeaderMouseClick);
  107. // //this.dataGridViewConsentSelectResult.RowPostPaint += new DataGridViewRowPostPaintEventHandler(this.dataGridViewConsentSelectResult_RowPostPaint);
  108. // // 체크박스 컬럼을 추가
  109. // CommonUtil.AddNewCheckBoxColumnToDataGridView(this.dataGridViewConsentSelectResult, "□", "colCheck", true, 30, DataGridViewContentAlignment.MiddleCenter);
  110. // CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "등록번호", "PatientCode", true, 60, DataGridViewContentAlignment.MiddleCenter);
  111. // CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "성명", "PatientName", true, 60, DataGridViewContentAlignment.MiddleCenter);
  112. // CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "진료형태", "VisitTypeName", true, 40, DataGridViewContentAlignment.MiddleCenter);
  113. // CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "진료/\n입원일", "ClnDate", true, 80, DataGridViewContentAlignment.MiddleCenter);
  114. // CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서명", "ConsentName", true, 180);
  115. // CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "상태", "ConsentStateDisp", true, 60, DataGridViewContentAlignment.MiddleCenter);
  116. // CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성자", "CreateUserName", true, 70, DataGridViewContentAlignment.MiddleCenter);
  117. // CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성일시", "CreateDateTime", true, 120, DataGridViewContentAlignment.MiddleCenter);
  118. // dataGridViewConsentSelectResult.Columns["colCheck"].Visible = false;
  119. //}
  120. //// 환자별
  121. //else {
  122. // // debug
  123. // // dbs227, 일괄저장 기능
  124. // // 이벤트 해재
  125. // this.dataGridViewConsentSelectResult.ColumnHeaderMouseClick -= dataGridViewConsentSelectResult_ColumnHeaderMouseClick;
  126. // this.dataGridViewConsentSelectResult.CellMouseClick -= dataGridViewConsentSelectResult_CellClick;
  127. // // 이벤트 추가
  128. // this.dataGridViewConsentSelectResult.ColumnHeaderMouseClick += new DataGridViewCellMouseEventHandler(this.dataGridViewConsentSelectResult_ColumnHeaderMouseClick);
  129. // dataGridViewConsentSelectResult.CellMouseClick += new DataGridViewCellMouseEventHandler(this.dataGridViewConsentSelectResult_CellClick);
  130. // // 체크박스 컬럼을 추가
  131. // CommonUtil.AddNewCheckBoxColumnToDataGridView(this.dataGridViewConsentSelectResult, "□", "colCheck", true, 30, DataGridViewContentAlignment.MiddleCenter);
  132. // // 추후 삭제
  133. // CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서명", "ConsentName", true, 180);
  134. // CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "상태", "ConsentStateDisp", true, 60, DataGridViewContentAlignment.MiddleCenter);
  135. // CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성자", "CreateUserName", true, 70, DataGridViewContentAlignment.MiddleCenter);
  136. // CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성일시", "CreateDateTime", true, 120, DataGridViewContentAlignment.MiddleCenter);
  137. // CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "등록번호", "PatientCode", false);
  138. // CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "성명", "PatientName", false);
  139. // CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "진료형태", "VisitTypeName", false);
  140. // CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "진료/\n입원일", "ClnDate", false);
  141. //}
  142. //dataGridViewConsentSelectResult.Columns["colCheck"].Visible = false;
  143. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "기관코드", "HosType", false);
  144. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "생성번호", "Cretno", false);
  145. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "진료형태코드", "VisitType", false);
  146. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "진료과코드", "ClnDeptCd", false);
  147. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "진료과", "ClnDeptNm", false);
  148. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "진료의", "Doctor", false);
  149. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "병동", "Ward", false);
  150. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "병실", "RoomCd", false);
  151. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "처방번호", "OrderNo", false);
  152. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "처방코드", "OrderCd", false);
  153. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "처방", "OrderNm", false);
  154. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "수술진단명", "OpDiagName", false);
  155. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "수술명", "OpName", false);
  156. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "수술예약번호", "OpRsrvNo", false);
  157. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서고유ID", "FormGuid", false);
  158. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서ID", "FormRid", false);
  159. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서코드", "FormCd", false);
  160. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서생성ID", "ConsentMstRid", false);
  161. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "상태코드", "ConsentState", false);
  162. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "OCR태그", "OcrNumber", false);
  163. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성자ID", "CreateUserId", false);
  164. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "코사인의사ID", "CosignDcId", false);
  165. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "코사인의사", "CosignDcName", false);
  166. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "출력매수", "PrntCnt", false);
  167. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "OCR생성여부", "OcrTagYN", false);
  168. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "출력제목", "FormPrintName", false);
  169. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성자변경여부", "UserDrFlag", false);
  170. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "출력전용", "PrntOnly", false);
  171. }
  172. private void dataGridViewConsentSelectResult_CellClick(object sender, DataGridViewCellMouseEventArgs e) {
  173. if (e.RowIndex < 0 || e.ColumnIndex < 0) {
  174. return;
  175. }
  176. if (e.ColumnIndex == 0) {
  177. DataGridViewRow curRow = dataGridViewConsentSelectResult.Rows[e.RowIndex];
  178. var value = curRow.Cells["colCheck"].Value;
  179. Boolean checkValue = false;
  180. if (value == null || !(Boolean) value) {
  181. checkValue = false;
  182. } else {
  183. checkValue = true;
  184. }
  185. curRow.Cells[e.ColumnIndex].Value = !checkValue;
  186. }
  187. }
  188. /// <summary>
  189. /// dbs227, 일괄저장 추가
  190. /// 체크박스 이벤트 처리
  191. /// </summary>
  192. /// <param name="sender"></param>
  193. /// <param name="e"></param>
  194. private void dataGridViewConsentSelectResult_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) {
  195. if (e.ColumnIndex == 0 && e.RowIndex == -1) {
  196. bool chkStatus = false;
  197. if (dataGridViewConsentSelectResult.Columns[0].HeaderText.Equals("□")) {
  198. dataGridViewConsentSelectResult.Columns[0].HeaderText = "☑";
  199. chkStatus = true;
  200. } else {
  201. dataGridViewConsentSelectResult.Columns[0].HeaderText = "□";
  202. }
  203. foreach (DataGridViewRow r in dataGridViewConsentSelectResult.Rows) {
  204. r.Cells["colCheck"].Value = chkStatus;
  205. }
  206. dataGridViewConsentSelectResult.RefreshEdit();
  207. }
  208. }
  209. #region 검색 조건에 따른 환자의 동의서 조회
  210. /// <summary>
  211. /// 동의서 목록 조회
  212. /// </summary>
  213. public void BindDataGridRows() {
  214. try {
  215. if (this.consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  216. if (this.commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  217. if (this.consentWebService == null) this.consentWebService = WebMethodCommon.GetConsentWebService(consentMain.PluginExecuteInfo["consentSvcUrl"]);
  218. string patientCode = string.Empty;
  219. if (commandControl.CurrentTargetPatient != null && !string.IsNullOrEmpty(commandControl.CurrentTargetPatient.PatientCode)) {
  220. patientCode = commandControl.CurrentTargetPatient.PatientCode;
  221. }
  222. string userId = string.Empty;
  223. if (rdoUser.Checked) {
  224. userId = consentMain.ConsentExecuteInfo["loginUserNo"];
  225. }
  226. if (!patientCode.Equals(string.Empty) || !userId.Equals(string.Empty)) {
  227. // 프린터 모드가 아닐 경우
  228. if (!consentMain.ConsentExecuteInfo["printYN"].Equals("Y")) {
  229. if (this.dateTimePickerStartDate.Value > this.dateTimePickerEndDate.Value) {
  230. this.dateTimePickerStartDate.Value = DateTime.Today - TimeSpan.FromDays(30);
  231. // this.dateTimePickerStartDate.Value = DateTime.Today - TimeSpan.FromDays(1);
  232. this.dateTimePickerEndDate.Value = DateTime.Today;
  233. }
  234. // 이전 진료일로 검색일자 설정
  235. if (string.IsNullOrEmpty(searchStartDate)) {
  236. if (commandControl.CurrentTargetPatient != null && !string.IsNullOrEmpty(commandControl.CurrentTargetPatient.clnDate)) {
  237. //searchStartDate = string.Format("{0}-{1}-{2}", commandControl.CurrentTargetPatient.clnDate.Substring(0, 4), commandControl.CurrentTargetPatient.clnDate.Substring(4, 2), commandControl.CurrentTargetPatient.clnDate.Substring(6, 2));
  238. } else {
  239. //searchStartDate = consentMain.PluginExecuteInfo["ConsentSearchStartDate"];
  240. }
  241. }
  242. //this.dateTimePickerStartDate.Value = Convert.ToDateTime(searchStartDate);
  243. // dbs227, 발행리스트 시작일자를 한달전으로 설정
  244. //this.dateTimePickerStartDate.Value = DateTime.Now.AddMonths(-1);
  245. string sDate = this.dateTimePickerStartDate.Value.ToShortDateString().Replace("-", "");
  246. string eDate = this.dateTimePickerEndDate.Value.ToShortDateString().Replace("-", "");
  247. string consentState = GetCheckConsentState();
  248. ConsentFormListVO[] resultData = null;
  249. // 환자별 검색
  250. if (rdoUser.Checked == false) {
  251. resultData = consentWebService.GetConsentList(patientCode
  252. , sDate
  253. , eDate
  254. , consentState
  255. , consentMain.ConsentExecuteInfo["dutinstcd"]
  256. , userId);
  257. }
  258. // 사용자 별 검색
  259. else {
  260. var searchString = searchName.Text?.Trim();
  261. // 검색할 사용자 이름이 없다면 메시지박스를 보여준다
  262. if (searchString == null || searchString.Equals(String.Empty)) {
  263. MessageBox.Show("검색할 사용자 이름을 입력하세요", "경고", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  264. return;
  265. }
  266. resultData = consentWebService.GetConsentList(patientCode
  267. , sDate
  268. , eDate
  269. , consentState
  270. , consentMain.ConsentExecuteInfo["dutinstcd"]
  271. , searchString); // 검색할 사용자 ID 를 넣는다
  272. }
  273. //ConsentVO[] resultData = consentWebService.GetConsentList(patientCode
  274. // , sDateF
  275. // , eDate
  276. // , consentState
  277. // , string.Empty
  278. // , consentMain.ConsentExecuteInfo["dutinstcd"]
  279. // , userId);
  280. if (resultData == null) {
  281. return;
  282. }
  283. // 진료일 표시 형식 변경
  284. foreach (ConsentFormListVO v in resultData) {
  285. if (v.inDd.Length == 8) {
  286. v.inDd = v.inDd.Substring(0, 4) + "-" + v.inDd.Substring(4, 2) + "-" + v.inDd.Substring(6, 2);
  287. }
  288. }
  289. this.dataGridViewConsentSelectResult.DataSource = new SortableBindingList<ConsentFormListVO>(resultData);
  290. // 목록 조회 후 자동 선택 기능 제외
  291. consentMain.ClearPreviewConsent(true);
  292. /*
  293. ConsentFormListVO vo = GetCurrentConsentVO(0);
  294. if (vo != null) {
  295. ExecutePreviewWithSelectedConsent(vo);
  296. } else {
  297. consentMain.ClearPreviewConsent(true);
  298. }
  299. */
  300. }
  301. } else {
  302. //// dbs227, 발행리스트 시작일자를 한달전으로 설정
  303. //this.dateTimePickerStartDate.Value = DateTime.Now.AddMonths(-1);
  304. }
  305. } catch (Exception ex) {
  306. MessageBox.Show(this, ex.Message);
  307. }
  308. }
  309. /// <summary>
  310. /// 검색할 동의서 상태의 값을 반환한다
  311. /// </summary>
  312. /// <returns>현재 체크박스에 선택된 값을 String 타입으로 반환, ex) "ALL" or "'UNFINISHED','TEMP'"</returns>
  313. private string GetCheckConsentState() {
  314. string consentState = "";
  315. if (this.checkBoxAll.Checked) {
  316. consentState = "ALL";
  317. } else {
  318. if (this.checkBoxUnfinished.Checked)
  319. consentState += ((consentState.Length > 0) ? "," : "") + "'" + this.checkBoxUnfinished.Tag + "'";
  320. if (this.checkBoxTemp.Checked)
  321. //consentState += ((consentState.Length > 0) ? "," : "") + "'" + this.checkBoxTemp.Tag + "'";
  322. consentState += ((consentState.Length > 0) ? "," : "") + "'TEMP', 'UNFINISHED', 'ELECTR_CMP'";
  323. if (this.checkBoxElectronicCmp.Checked)
  324. consentState += ((consentState.Length > 0) ? "," : "") + "'" + this.checkBoxElectronicCmp.Tag + "'";
  325. if (this.checkBoxCertifyCmp.Checked)
  326. consentState += ((consentState.Length > 0) ? "," : "") + "'" + this.checkBoxCertifyCmp.Tag + "'";
  327. if (this.checkBoxPaperOut.Checked)
  328. consentState += ((consentState.Length > 0) ? "," : "") + "'" + this.checkBoxPaperOut.Tag + "'";
  329. if (this.checkBoxVerbal.Checked)
  330. consentState += ((consentState.Length > 0) ? "," : "") + "'" + this.checkBoxVerbal.Tag + "'";
  331. }
  332. return consentState;
  333. }
  334. #endregion
  335. #region ConsentState 확인
  336. private static bool IsConsentStateTempSave(ConsentFormListVO vo) {
  337. if (vo.consentStateEng.ToUpper().Equals("TEMP") || vo.consentStateEng.ToUpper().Equals("VERBAL")) {
  338. return true;
  339. }
  340. return false;
  341. }
  342. private static bool IsConsentStatePrintOut(ConsentFormListVO vo) {
  343. return vo.consentStateEng.ToUpper().Equals("PAPER_OUT");
  344. }
  345. private static bool IsConsentStateElectronicComplete(ConsentFormListVO vo) {
  346. return vo.consentStateEng.ToUpper().Equals("ELECTR_CMP");
  347. }
  348. private static bool IsConsentStateCertifyComplete(ConsentFormListVO vo) {
  349. return vo.consentStateEng.ToUpper().Equals("CERTIFY_CMP");
  350. }
  351. private static bool IsConsentStateUnfinished(ConsentFormListVO vo) {
  352. return vo.consentStateEng.ToUpper().Equals("UNFINISHED");
  353. }
  354. #endregion
  355. #region 체크박스 이벤트
  356. private void checkBoxAll_CheckedChanged(object sender, EventArgs e) {
  357. if (this.checkBoxAll.Checked == true) {
  358. this.checkBoxUnfinished.Checked = false;
  359. this.checkBoxTemp.Checked = false;
  360. this.checkBoxElectronicCmp.Checked = false;
  361. this.checkBoxCertifyCmp.Checked = false;
  362. this.checkBoxPaperOut.Checked = false;
  363. }
  364. }
  365. private void checkBoxUnfinished_CheckedChanged(object sender, EventArgs e) {
  366. if (this.checkBoxUnfinished.Checked == true && this.checkBoxAll.Checked == true) {
  367. this.checkBoxAll.Checked = false;
  368. }
  369. }
  370. private void checkBoxTemp_CheckedChanged(object sender, EventArgs e) {
  371. if (this.checkBoxTemp.Checked == true && this.checkBoxAll.Checked == true) {
  372. this.checkBoxAll.Checked = false;
  373. }
  374. }
  375. private void checkBoxElectronicCmp_CheckedChanged(object sender, EventArgs e) {
  376. if (this.checkBoxElectronicCmp.Checked == true && this.checkBoxAll.Checked == true) {
  377. this.checkBoxAll.Checked = false;
  378. }
  379. }
  380. private void checkBoxCertifyCmp_CheckedChanged(object sender, EventArgs e) {
  381. if (this.checkBoxCertifyCmp.Checked == true && this.checkBoxAll.Checked == true) {
  382. this.checkBoxAll.Checked = false;
  383. }
  384. }
  385. private void checkBoxPaperOut_CheckedChanged(object sender, EventArgs e) {
  386. if (this.checkBoxPaperOut.Checked == true && this.checkBoxAll.Checked == true) {
  387. this.checkBoxAll.Checked = false;
  388. }
  389. }
  390. #endregion
  391. #region 조회버튼 클릭 이벤트
  392. /// <summary>
  393. /// 동의서 목록 조회
  394. /// </summary>
  395. /// <param name="sender">The source of the event.</param>
  396. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  397. private void buttonConsentSelect_Click(object sender, EventArgs e) {
  398. buttonConsentSelect.Enabled = false;
  399. Application.DoEvents();
  400. string checkState = GetCheckConsentState();
  401. if (checkState.Length > 0) {
  402. if (!string.IsNullOrEmpty(searchStartDate)) {
  403. searchStartDate = this.dateTimePickerStartDate.Value.ToShortDateString();
  404. }
  405. try {
  406. InitDataGrid();
  407. BindDataGridRows();
  408. } catch (Exception ex) {
  409. throw ex;
  410. }
  411. } else {
  412. MessageBox.Show(string.Format(Properties.Resources.msg_unfinished_check)
  413. , string.Format(Properties.Resources.msg_caption_confirm),
  414. MessageBoxButtons.OK, MessageBoxIcon.Information);
  415. }
  416. buttonConsentSelect.Enabled = true;
  417. }
  418. #endregion
  419. #region 동의서 미리보기
  420. //선택된 Row의 ConsentFormListVO 객체를 반환한다.
  421. private ConsentFormListVO GetCurrentConsentVO(int rowIndex) {
  422. ConsentFormListVO vo = null;
  423. if (rowIndex < 0) {
  424. return vo;
  425. }
  426. if (dataGridViewConsentSelectResult != null && dataGridViewConsentSelectResult.Rows.Count > 0) {
  427. this.dataGridViewConsentSelectResult.Rows[rowIndex].Selected = true;
  428. //this.dataGridViewConsentSelectResult.CurrentCell = this.dataGridViewConsentSelectResult.Rows[rowIndex].Cells[0];
  429. vo = this.dataGridViewConsentSelectResult.Rows[rowIndex].DataBoundItem as ConsentFormListVO;
  430. }
  431. return vo;
  432. }
  433. //선택된 ConsentVO 객체를 미리보기 실행한다.
  434. private void ExecutePreviewWithSelectedConsent(ConsentFormListVO vo) {
  435. if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  436. if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  437. Cursor currentCursor = this.Cursor;
  438. this.Cursor = Cursors.WaitCursor;
  439. if (rdoUser.Checked) {
  440. consentMain.ConsentExecuteInfo["patientNo"] = vo.pid;
  441. consentMain.ConsentExecuteInfo["clnDate"] = vo.inDd.Replace("-", "");
  442. consentMain.ConsentExecuteInfo["visitType"] = vo.ordType;
  443. consentMain.ConsentExecuteInfo["clnDept"] = vo.ordDeptCd;
  444. consentMain.ConsentExecuteInfo["cretno"] = vo.cretNo.ToString();
  445. consentMain.ConsentExecuteInfo["opRsrvNo"] = vo.opRsrvNo;
  446. consentMain.SetPatientInfo();
  447. }
  448. commandControl.CurrentPreviewConsent = new PreviewConsent {
  449. formRid = vo.formRid.ToString(),
  450. formGuid = vo.formGuid,
  451. formCd = vo.formCd.ToString(),
  452. FormName = vo.formName,
  453. formPrintName = vo.formPrntNm,
  454. prntCnt = vo.printCnt,
  455. consentMstRid = vo.consentMstRid.ToString(),
  456. consentState = vo.consentStateEng,
  457. consentStateEngnm = vo.consentStateEng,
  458. orderNo = 0,
  459. ocrCode = vo.ocrTag,
  460. inputId = vo.createUserId,
  461. inputNm = vo.createUserName,
  462. ReissueConsentMstRid = IsConsentStatePrintOut(vo) ? vo.consentMstRid : 0,
  463. RewriteConsentMstRid = !IsConsentStateUnfinished(vo) ? vo.consentMstRid : 0,
  464. ordType = vo.ordType,
  465. ocrtagPrntyn = vo.ocrTagPrntYn,
  466. userDrFlag = vo.userDrFlag,
  467. printOnly = vo.printOnly,
  468. opDiagName = vo.opDiagNm,
  469. drOnly = vo.DrOnly,
  470. opName = vo.opNm
  471. };
  472. try {
  473. consentMain.PatientInfoCtrl.SetConsentDocumentName(vo.formName);
  474. if (IsConsentStateTempSave(vo) || IsConsentStateElectronicComplete(vo)) { // 임시저장 or 작성완료
  475. commandControl.ShowTempSaveConsent(consentMain);
  476. } else if (IsConsentStatePrintOut(vo)) { // 출력
  477. if (this.dataGridViewConsentSelectResult.SelectedRows.Count > 0 &&
  478. this.dataGridViewConsentSelectResult.SelectedRows[0].Tag != null &&
  479. this.dataGridViewConsentSelectResult.SelectedRows[0].Tag.Equals("reissueTarget")) {
  480. //재출력 하는 경우
  481. commandControl.CurrentPreviewConsent.ReissueConsentMstRid = vo.consentMstRid;
  482. commandControl.CurrentPreviewConsent.RewriteConsentMstRid = 0;
  483. //CheckClnDateInfo(vo);
  484. commandControl.PreviewConsent(consentMain);
  485. } else {
  486. //CheckClnDateInfo(vo);
  487. commandControl.PreviewConsent(consentMain);
  488. }
  489. } else if (IsConsentStateCertifyComplete(vo)) { // 인증저장
  490. commandControl.ShowCompleteConsent(consentMain);//이미지 호출하는 함수
  491. } else if (IsConsentStateUnfinished(vo)) { //미작성
  492. //CheckClnDateInfo(vo);
  493. commandControl.PreviewConsent(consentMain); // consent_data에 데이터가 없을때 사용하는 함수
  494. }
  495. } catch {
  496. } finally {
  497. this.Cursor = currentCursor;
  498. }
  499. }
  500. //동의서의 처방일자와 생성번호 등의 정보가 현재 정보와 일치하지 않은 경우, 미리보기를 위해서 데이터를 재조회한다.
  501. private void CheckClnDateInfo(ConsentFormListVO vo) {
  502. /*
  503. bool bSame = true;
  504. if (!vo.ClnDate.Replace("-", "").Equals(commandControl.CurrentTargetPatient.clnDate.Replace("-", "")))
  505. bSame = false;
  506. if (!vo.Cretno.ToString().Equals(commandControl.CurrentTargetPatient.cretno))
  507. bSame = false;
  508. if (!vo.ClnDeptCd.Equals(commandControl.CurrentTargetPatient.clnDeptCode))
  509. bSame = false;
  510. if (!vo.VisitType.Equals(commandControl.CurrentTargetPatient.VisitType))
  511. bSame = false;
  512. if (bSame == false) {
  513. //동의서 맵핑 정보를 상단의 선택된 진료일과 작성자 정보로 한다.
  514. consentMain.PatientInfoCtrl.SetPatientByConsentInfo(vo.ClnDate.Replace("-", ""),
  515. vo.VisitType,
  516. vo.ClnDeptCd,
  517. vo.Cretno.ToString());
  518. }
  519. */
  520. }
  521. #endregion
  522. #region 그리드 이벤트
  523. /*
  524. private void dataGridViewConsentSelectResult_CellClick(object sender, DataGridViewCellEventArgs e)
  525. {
  526. ConsentFormListVO vo = GetCurrentConsentVO(e.RowIndex);
  527. if (vo != null)
  528. {
  529. IConsentMain consentMain = ConsentMainControl.GetConsentMainInterface(this);
  530. consentMain.preParamClean();
  531. ExecutePreviewWithSelectedConsent(vo);
  532. }
  533. }
  534. */
  535. /// <summary>
  536. /// dataGridViewConsentSelectResult 그리드 컨트롤의 셀 우클릭 메뉴 생성
  537. /// </summary>
  538. /// <param name="sender">The source of the event.</param>
  539. /// <param name="e">The <see cref="DataGridViewCellContextMenuStripNeededEventArgs"/> instance containing the event data.</param>
  540. private void dataGridViewConsentSelectResult_CellContextMenuStripNeeded(object sender, DataGridViewCellContextMenuStripNeededEventArgs e) {
  541. if (consentMain.ConsentExecuteInfo["readOnly"].Equals("Y")) {
  542. return;
  543. }
  544. if (e.RowIndex > -1 && this.dataGridViewConsentSelectResult.Rows[e.RowIndex].Selected == true) {
  545. ConsentFormListVO vo = GetCurrentConsentVO(e.RowIndex);
  546. if (vo.consentStateEng.Equals("TEMP") || vo.consentStateEng.Equals("PAPER_OUT")) {
  547. ContextMenuStrip strip = new ContextMenuStrip();
  548. // 임시, 확인 저장의 경우 삭제메뉴를 보여준다
  549. if (vo.consentStateEng.Equals("TEMP") || vo.consentStateEng.Equals("ELECTR_CMP")) {
  550. // 사용자와 생성자가 동일해야 삭제 가능
  551. if(commandControl.CurrentEndUser.UserNo.Equals(vo.createUserId)) {
  552. ToolStripMenuItem deleteRecord = new ToolStripMenuItem {
  553. Text = "삭제"
  554. };
  555. strip.Items.Add(deleteRecord);
  556. deleteRecord.Click += new EventHandler(deleteRecord_Click);
  557. }
  558. // 출력의 경우 재출력 메뉴를 보여준다
  559. } else if (vo.consentStateEng.Equals("PAPER_OUT")) {
  560. ToolStripMenuItem reprintRecord = new ToolStripMenuItem {
  561. Text = "재출력"
  562. };
  563. strip.Items.Add(reprintRecord);
  564. reprintRecord.Click += new EventHandler(reprintRecord_Click);
  565. }
  566. e.ContextMenuStrip = strip;
  567. }
  568. }
  569. }
  570. /// <summary>
  571. /// dataGridViewConsentSelectResult 그리드 컨트롤의 CellMouseDoubleClick 이벤트 핸들러
  572. /// </summary>
  573. /// <param name="sender">The source of the event.</param>
  574. /// <param name="e">The <see cref="DataGridViewCellEventArgs"/> instance containing the event data.</param>
  575. private void dataGridViewConsentSelectResult_CellMouseDoubleClick(object sender, DataGridViewCellEventArgs e) {
  576. if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  577. if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  578. // dbs227, 셀 클릭 시 더블클릭 인식되어 작동되는 경우 오류
  579. if (e.RowIndex < 0) {
  580. return;
  581. }
  582. // 현재 선택된 동의서를 가져온다
  583. ConsentFormListVO vo = GetCurrentConsentVO(e.RowIndex);
  584. string electrVisble = ConsentMainControl.SETTING_DATA["ELECTR_CMP"];
  585. if (commandControl.CurrentTargetPatient.VisitType.Equals("O")) {
  586. if (electrVisble.Equals("Y")) {
  587. commandControl.setCompleteSaveButton(true);
  588. }
  589. } else {
  590. if (electrVisble.Equals("Y") && commandControl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) {
  591. commandControl.setCompleteSaveButton(true);
  592. } else {
  593. commandControl.setCompleteSaveButton(false);
  594. }
  595. }
  596. //if (commandControl.CurrentTargetPatient.VisitType.Equals("O")) {
  597. // commandControl.setCompleteSaveButton(true);
  598. //} else {
  599. // if (ConsentMainControl.SETTING_DATA["ELECTR_CMP"].Equals("Y") && commandControl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) {
  600. // commandControl.setCompleteSaveButton(true);
  601. // } else {
  602. // commandControl.setCompleteSaveButton(false);
  603. // }
  604. //}
  605. //의사가 아니면 확인저장 비활성화
  606. //if (!commandControl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) {
  607. // commandControl.setCompleteSaveButton(false);
  608. //}
  609. // dbs227, 출력된 동의서는 미리보기를 하지 않는다
  610. if (vo.consentStateEng.Equals("PAPER_OUT")) {
  611. MessageBox.Show(String.Format(Properties.Resources.msg_printed_consent),
  612. String.Format(Properties.Resources.title_printed_consent));
  613. return;
  614. }
  615. if (vo != null) {
  616. if (!consentMain.checkOperationDocument(vo.formCd)) {
  617. return;
  618. }
  619. // 선택된 동의서가 현재 보여지고 있는 동의서와 다른 경우, 임시 저장 여부 확인
  620. if (!consentMain.ConsentExecuteInfo["readOnly"].Equals("Y") &&
  621. !string.IsNullOrEmpty(commandControl.CurrentTargetPatient.PatientCode) &&
  622. commandControl.CurrentPreviewConsent != null && !commandControl.CurrentPreviewConsent.formRid.Equals(vo.formRid.ToString()) &&
  623. (commandControl.CurrentPreviewConsent.consentState == string.Empty || commandControl.CurrentPreviewConsent.consentState == "TEMP")) {
  624. // dbs227, 임시저장 팝업 사용 안함
  625. //DialogResult result = MessageBox.Show(string.Format(Properties.Resources.msg_confirm_tempsave)
  626. // , string.Format(Properties.Resources.msg_caption_confirm),
  627. // MessageBoxButtons.YesNo, MessageBoxIcon.Information);
  628. //if (result == DialogResult.Yes) {
  629. // consentMain.TempSave();
  630. //}
  631. }
  632. // startFormCd 를 초기화 한다
  633. consentMain.preParamClean();
  634. // 동의서 미리보기
  635. ExecutePreviewWithSelectedConsent(vo);
  636. if (!vo.consentStateEng.Equals("PAPER_OUT") && !vo.consentStateEng.Equals("ELECTR_CMP") && !vo.consentStateEng.Equals("CERTIFY_CMP")) {
  637. // 동의서 뷰어에 동의서 로드
  638. RunConsentDualView();
  639. }
  640. }
  641. /*
  642. ConsentFormListVO vo = GetCurrentConsentVO(e.RowIndex);
  643. if (vo != null)
  644. {
  645. if (vo.ConsentState.ToLower().Equals("electr_cmp") || vo.ConsentState.ToLower().Equals("certify_cmp") || vo.ConsentState.ToLower().Equals("paper_out"))
  646. {
  647. }
  648. else
  649. {
  650. //미작성, 임서저장 상태일때 마우스 더블클릭을 하면 양면으로 동의서 보여줌
  651. RunConsentDualView();
  652. }
  653. }
  654. */
  655. }
  656. /// <summary>
  657. /// 동의서 뷰어에 동의서 로드
  658. /// </summary>
  659. private void RunConsentDualView() {
  660. if (this.consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  661. if (this.commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  662. commandControl.RunConsentDualView();
  663. }
  664. /// <summary>
  665. /// 동의서 삭제 이벤트 핸들러
  666. /// </summary>
  667. /// <param name="sender">The source of the event.</param>
  668. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  669. private void deleteRecord_Click(object sender, EventArgs e) {
  670. if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  671. if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  672. bool bDel = true;
  673. ReasonForUseN reasonForUseN = new ReasonForUseN(bDel);
  674. if (reasonForUseN.ShowDialog() == DialogResult.OK) {
  675. string reason = reasonForUseN.GetReasonForUseN();
  676. reasonForUseN.Close();
  677. if (this.dataGridViewConsentSelectResult.SelectedRows.Count != 0) {
  678. Cursor currentCursor = this.Cursor;
  679. try {
  680. this.Cursor = Cursors.WaitCursor;
  681. //동의서 삭제 처리를 위해서 재발행MstID에 값을 넣는다.
  682. ConsentFormListVO vo = GetCurrentConsentVO(this.dataGridViewConsentSelectResult.SelectedRows[0].Index);
  683. // TODO dbs227 삭제 오류
  684. if (commandControl.CurrentPreviewConsent == null) {
  685. commandControl.CurrentPreviewConsent = new PreviewConsent {
  686. formRid = vo.formRid.ToString(),
  687. formGuid = vo.formGuid,
  688. formCd = vo.formCd.ToString(),
  689. FormName = vo.formName,
  690. formPrintName = vo.formPrntNm,
  691. prntCnt = vo.printCnt,
  692. consentMstRid = vo.consentMstRid.ToString(),
  693. consentStateEngnm = vo.consentStateEng,
  694. orderNo = 0,
  695. ocrCode = vo.ocrTag,
  696. inputId = vo.createUserId,
  697. inputNm = vo.createUserName,
  698. ReissueConsentMstRid = IsConsentStatePrintOut(vo) ? vo.consentMstRid : 0,
  699. RewriteConsentMstRid = !IsConsentStateUnfinished(vo) ? vo.consentMstRid : 0,
  700. ordType = vo.ordType,
  701. ocrtagPrntyn = vo.ocrTagPrntYn,
  702. userDrFlag = vo.userDrFlag,
  703. printOnly = vo.printOnly,
  704. opDiagName = vo.opDiagNm,
  705. drOnly = vo.DrOnly,
  706. opName = vo.opNm
  707. };
  708. }
  709. commandControl.CurrentPreviewConsent.ReissueConsentMstRid = vo.consentMstRid;
  710. // 미작성 동의서 삭제
  711. consentMain.ConsentCommandCtrl.DeleteRecordOfDeleteConsent(reason);
  712. // 동의서 목록 재조회 (미작성 동의서 삭제, 임시저장용 재조회, 인쇄출력용 재조회, 저장용(저장후 닫힘이 아닌 경우))
  713. consentMain.ConsentListCtrl.InquiryConsentData(-1);
  714. } catch (Exception ex) {
  715. throw ex;
  716. } finally {
  717. this.Cursor = currentCursor;
  718. }
  719. MessageBox.Show(string.Format(Properties.Resources.msg_consent_record_deleted)
  720. , string.Format(Properties.Resources.msg_caption_confirm),
  721. MessageBoxButtons.OK, MessageBoxIcon.Information);
  722. }
  723. }
  724. }
  725. /// <summary>
  726. /// 재출력 클릭
  727. /// </summary>
  728. /// <param name="sender">The source of the event.</param>
  729. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  730. private void reprintRecord_Click(object sender, EventArgs e) {
  731. ConsentFormListVO vo = GetCurrentConsentVO(this.dataGridViewConsentSelectResult.SelectedRows[0].Index);
  732. if (vo != null) {
  733. if (vo.consentState.Equals("반납확인")) {
  734. MessageBox.Show("반납확인 서식은 재출력이 불가능 합니다.");
  735. return;
  736. }
  737. this.dataGridViewConsentSelectResult.SelectedRows[0].Tag = "reissueTarget"; // 재출력 대상 마킹
  738. ExecutePreviewWithSelectedConsent(vo);
  739. this.dataGridViewConsentSelectResult.SelectedRows[0].Tag = null;
  740. //재출력을 하는 경우, 바로 출력이 되도록 한다.
  741. if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  742. if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  743. // 출력 로그 저장을 위한 버튼 클릭 설정
  744. this.consentMain.setPrintButton(true);
  745. // 재출력 시 OCRTAG 중복확인 제외
  746. commandControl.reprintStatus = true;
  747. commandControl.PrintConsentDocument();
  748. commandControl.reprintStatus = false;
  749. }
  750. }
  751. #endregion
  752. public void clearSearchStartDate() {
  753. searchStartDate = string.Empty;
  754. }
  755. private void dataGridViewConsentSelectResult_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) {
  756. foreach (DataGridViewRow row in dataGridViewConsentSelectResult.Rows) {
  757. if (!string.IsNullOrEmpty(row.Cells["consentStateEng"].Value.ToString())) {
  758. if (row.Cells["consentStateEng"].Value.ToString().ToUpper() == "UNFINISHED") {
  759. row.DefaultCellStyle.ForeColor = System.Drawing.Color.Red;
  760. }
  761. }
  762. }
  763. }
  764. private void dataGridViewConsentSelectResult_CellClick(object sender, DataGridViewCellEventArgs e) {
  765. }
  766. /// <summary>
  767. /// 선택된 동의서를 가져온다
  768. /// </summary>
  769. /// <returns>선택된 동의서 목록</returns>
  770. public List<ConsentFormListVO> getConfirmedCheckedConsentList() {
  771. List<ConsentFormListVO> consents = new List<ConsentFormListVO>();
  772. foreach (DataGridViewRow row in dataGridViewConsentSelectResult.Rows) {
  773. if (Convert.ToBoolean(row.Cells["colCheck"].Value)) {
  774. ConsentFormListVO consent = row.DataBoundItem as ConsentFormListVO;
  775. if (!consent.consentStateEng.Equals("ELECTR_CMP")) {
  776. return null;
  777. }
  778. consents.Add(consent);
  779. }
  780. }
  781. return consents;
  782. }
  783. /// <summary>
  784. /// 선택 초기화
  785. /// </summary>
  786. private void ClearCheckBox() {
  787. bool chkStatus = false;
  788. dataGridViewConsentSelectResult.Columns[0].HeaderText = "□";
  789. foreach (DataGridViewRow r in dataGridViewConsentSelectResult.Rows) {
  790. r.Cells["colCheck"].Value = chkStatus;
  791. }
  792. dataGridViewConsentSelectResult.RefreshEdit();
  793. }
  794. /// <summary>
  795. /// dbs227, 일괄저장
  796. /// 선택된 환자들의 저장 상태를 일괄저장으로 변경한다.
  797. /// </summary>
  798. /// <param name="sender"></param>
  799. /// <param name="e"></param>
  800. private void saveAllCertify_Click(object sender, EventArgs e) {
  801. // 선택된 동의서 목록을 가져온다.
  802. List<ConsentFormListVO> lists = getConfirmedCheckedConsentList();
  803. if (lists == null || lists.Count < 1) {
  804. MessageBox.Show("동의서를 선택하거나 확인 저장 동의서만 선택해 주세요.");
  805. //ClearCheckBox();
  806. return;
  807. }
  808. String mstRids = "";
  809. String ocrTags = "";
  810. int i = 0;
  811. foreach (ConsentFormListVO consent in lists) {
  812. if (i != 0) {
  813. mstRids += ",";
  814. ocrTags += ",";
  815. }
  816. mstRids += "'" + consent.consentMstRid + "'";
  817. ocrTags += "'" + consent.ocrTag + "'";
  818. i++;
  819. }
  820. // 선택된 동의서 상태값을 바꿔 준다.
  821. String result = consentWebService.updateCertifyComplete(mstRids, ocrTags, consentMain.ConsentExecuteInfo["dutinstcd"]);
  822. if (result.Equals("Y")) {
  823. MessageBox.Show("일괄저장 하였습니다.");
  824. ClearCheckBox();
  825. try {
  826. this.checkBoxAll.Checked = true;
  827. InitDataGrid();
  828. BindDataGridRows();
  829. } catch (Exception ex) {
  830. throw ex;
  831. }
  832. }
  833. }
  834. /// <summary>
  835. /// 사용자 라디오 버튼 클릭 시 일괄저장을 보여준다
  836. /// </summary>
  837. /// <param name="sender"></param>
  838. /// <param name="e"></param>
  839. private void rdoUser_CheckedChanged(object sender, EventArgs e) {
  840. if (!rdoUser.Checked) {
  841. //saveAllCertify.Visible = false;
  842. searchName.Visible = false;
  843. }
  844. // 현재 로그인 한 사용자가 의사라면 일괄저장 버튼을 활성화 하여 준다.
  845. else if (rdoUser.Checked/* && commandControl.CurrentEndUser.JobKindCd.Equals("0330")*/) {
  846. // saveAllCertify 버튼 보이도록
  847. //saveAllCertify.Visible = true;
  848. searchName.Visible = true;
  849. }
  850. }
  851. }
  852. }