ConsentSelectTabPageAll.cs 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005
  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. // , sDate
  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(ConsentVO vo) {
  502. bool bSame = true;
  503. if (!vo.clnDate.Replace("-", "").Equals(commandControl.CurrentTargetPatient.clnDate.Replace("-", "")))
  504. bSame = false;
  505. if (!vo.cretNo.ToString().Equals(commandControl.CurrentTargetPatient.cretno))
  506. bSame = false;
  507. if (!vo.ClnDeptCd.Equals(commandControl.CurrentTargetPatient.clnDeptCode))
  508. bSame = false;
  509. if (!vo.VisitType.Equals(commandControl.CurrentTargetPatient.VisitType))
  510. bSame = false;
  511. if (bSame == false) {
  512. //동의서 맵핑 정보를 상단의 선택된 진료일과 작성자 정보로 한다.
  513. consentMain.PatientInfoCtrl.SetPatientByConsentInfo(vo.clnDate.Replace("-", ""),
  514. vo.VisitType,
  515. vo.ClnDeptCd,
  516. vo.cretNo.ToString());
  517. }
  518. }
  519. #endregion
  520. #region 그리드 이벤트
  521. /*
  522. private void dataGridViewConsentSelectResult_CellClick(object sender, DataGridViewCellEventArgs e)
  523. {
  524. ConsentFormListVO vo = GetCurrentConsentVO(e.RowIndex);
  525. if (vo != null)
  526. {
  527. IConsentMain consentMain = ConsentMainControl.GetConsentMainInterface(this);
  528. consentMain.preParamClean();
  529. ExecutePreviewWithSelectedConsent(vo);
  530. }
  531. }
  532. */
  533. /// <summary>
  534. /// dataGridViewConsentSelectResult 그리드 컨트롤의 셀 우클릭 메뉴 생성
  535. /// </summary>
  536. /// <param name="sender">The source of the event.</param>
  537. /// <param name="e">The <see cref="DataGridViewCellContextMenuStripNeededEventArgs"/> instance containing the event data.</param>
  538. private void dataGridViewConsentSelectResult_CellContextMenuStripNeeded(object sender, DataGridViewCellContextMenuStripNeededEventArgs e) {
  539. if (consentMain.ConsentExecuteInfo["readOnly"].Equals("Y")) {
  540. return;
  541. }
  542. if (e.RowIndex > -1 && this.dataGridViewConsentSelectResult.Rows[e.RowIndex].Selected == true) {
  543. ConsentFormListVO vo = GetCurrentConsentVO(e.RowIndex);
  544. if (vo.consentStateEng.Equals("TEMP") || vo.consentStateEng.Equals("PAPER_OUT")) {
  545. ContextMenuStrip strip = new ContextMenuStrip();
  546. // 임시, 확인 저장의 경우 삭제메뉴를 보여준다
  547. if (vo.consentStateEng.Equals("TEMP") || vo.consentStateEng.Equals("ELECTR_CMP")) {
  548. // 사용자와 생성자가 동일해야 삭제 가능
  549. if(commandControl.CurrentEndUser.UserNo.Equals(vo.createUserId)) {
  550. ToolStripMenuItem deleteRecord = new ToolStripMenuItem {
  551. Text = "삭제"
  552. };
  553. strip.Items.Add(deleteRecord);
  554. deleteRecord.Click += new EventHandler(deleteRecord_Click);
  555. }
  556. // 출력의 경우 재출력 메뉴를 보여준다
  557. } else if (vo.consentStateEng.Equals("PAPER_OUT")) {
  558. ToolStripMenuItem reprintRecord = new ToolStripMenuItem {
  559. Text = "재출력"
  560. };
  561. strip.Items.Add(reprintRecord);
  562. reprintRecord.Click += new EventHandler(reprintRecord_Click);
  563. }
  564. e.ContextMenuStrip = strip;
  565. }
  566. }
  567. }
  568. /// <summary>
  569. /// dataGridViewConsentSelectResult 그리드 컨트롤의 CellMouseDoubleClick 이벤트 핸들러
  570. /// </summary>
  571. /// <param name="sender">The source of the event.</param>
  572. /// <param name="e">The <see cref="DataGridViewCellEventArgs"/> instance containing the event data.</param>
  573. private void dataGridViewConsentSelectResult_CellMouseDoubleClick(object sender, DataGridViewCellEventArgs e) {
  574. if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  575. if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  576. // dbs227, 셀 클릭 시 더블클릭 인식되어 작동되는 경우 오류
  577. if (e.RowIndex < 0) {
  578. return;
  579. }
  580. // 현재 선택된 동의서를 가져온다
  581. ConsentFormListVO vo = GetCurrentConsentVO(e.RowIndex);
  582. string electrVisble = ConsentMainControl.SETTING_DATA["ELECTR_CMP"];
  583. if (commandControl.CurrentTargetPatient.VisitType.Equals("O")) {
  584. if (electrVisble.Equals("Y")) {
  585. commandControl.setCompleteSaveButton(true);
  586. }
  587. } else {
  588. if (electrVisble.Equals("Y") && commandControl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) {
  589. commandControl.setCompleteSaveButton(true);
  590. } else {
  591. commandControl.setCompleteSaveButton(false);
  592. }
  593. }
  594. //if (commandControl.CurrentTargetPatient.VisitType.Equals("O")) {
  595. // commandControl.setCompleteSaveButton(true);
  596. //} else {
  597. // if (ConsentMainControl.SETTING_DATA["ELECTR_CMP"].Equals("Y") && commandControl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) {
  598. // commandControl.setCompleteSaveButton(true);
  599. // } else {
  600. // commandControl.setCompleteSaveButton(false);
  601. // }
  602. //}
  603. //의사가 아니면 확인저장 비활성화
  604. //if (!commandControl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) {
  605. // commandControl.setCompleteSaveButton(false);
  606. //}
  607. // dbs227, 출력된 동의서는 미리보기를 하지 않는다
  608. if (vo.consentStateEng.Equals("PAPER_OUT")) {
  609. MessageBox.Show(String.Format(Properties.Resources.msg_printed_consent),
  610. String.Format(Properties.Resources.title_printed_consent));
  611. return;
  612. }
  613. if (vo != null) {
  614. if (!consentMain.checkOperationDocument(vo.formCd)) {
  615. return;
  616. }
  617. // 선택된 동의서가 현재 보여지고 있는 동의서와 다른 경우, 임시 저장 여부 확인
  618. if (!consentMain.ConsentExecuteInfo["readOnly"].Equals("Y") &&
  619. !string.IsNullOrEmpty(commandControl.CurrentTargetPatient.PatientCode) &&
  620. commandControl.CurrentPreviewConsent != null && !commandControl.CurrentPreviewConsent.formRid.Equals(vo.formRid.ToString()) &&
  621. (commandControl.CurrentPreviewConsent.consentState == string.Empty || commandControl.CurrentPreviewConsent.consentState == "TEMP")) {
  622. // dbs227, 임시저장 팝업 사용 안함
  623. //DialogResult result = MessageBox.Show(string.Format(Properties.Resources.msg_confirm_tempsave)
  624. // , string.Format(Properties.Resources.msg_caption_confirm),
  625. // MessageBoxButtons.YesNo, MessageBoxIcon.Information);
  626. //if (result == DialogResult.Yes) {
  627. // consentMain.TempSave();
  628. //}
  629. }
  630. // startFormCd 를 초기화 한다
  631. consentMain.preParamClean();
  632. // 동의서 미리보기
  633. ExecutePreviewWithSelectedConsent(vo);
  634. if (!vo.consentStateEng.Equals("PAPER_OUT") && !vo.consentStateEng.Equals("ELECTR_CMP") && !vo.consentStateEng.Equals("CERTIFY_CMP")) {
  635. // 동의서 뷰어에 동의서 로드
  636. RunConsentDualView();
  637. }
  638. }
  639. /*
  640. ConsentFormListVO vo = GetCurrentConsentVO(e.RowIndex);
  641. if (vo != null)
  642. {
  643. if (vo.ConsentState.ToLower().Equals("electr_cmp") || vo.ConsentState.ToLower().Equals("certify_cmp") || vo.ConsentState.ToLower().Equals("paper_out"))
  644. {
  645. }
  646. else
  647. {
  648. //미작성, 임서저장 상태일때 마우스 더블클릭을 하면 양면으로 동의서 보여줌
  649. RunConsentDualView();
  650. }
  651. }
  652. */
  653. }
  654. /// <summary>
  655. /// 동의서 뷰어에 동의서 로드
  656. /// </summary>
  657. private void RunConsentDualView() {
  658. if (this.consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  659. if (this.commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  660. commandControl.RunConsentDualView();
  661. }
  662. /// <summary>
  663. /// 동의서 삭제 이벤트 핸들러
  664. /// </summary>
  665. /// <param name="sender">The source of the event.</param>
  666. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  667. private void deleteRecord_Click(object sender, EventArgs e) {
  668. if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  669. if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  670. bool bDel = true;
  671. ReasonForUseN reasonForUseN = new ReasonForUseN(bDel);
  672. if (reasonForUseN.ShowDialog() == DialogResult.OK) {
  673. string reason = reasonForUseN.GetReasonForUseN();
  674. reasonForUseN.Close();
  675. if (this.dataGridViewConsentSelectResult.SelectedRows.Count != 0) {
  676. Cursor currentCursor = this.Cursor;
  677. try {
  678. this.Cursor = Cursors.WaitCursor;
  679. //동의서 삭제 처리를 위해서 재발행MstID에 값을 넣는다.
  680. ConsentFormListVO vo = GetCurrentConsentVO(this.dataGridViewConsentSelectResult.SelectedRows[0].Index);
  681. // TODO dbs227 삭제 오류
  682. if (commandControl.CurrentPreviewConsent == null) {
  683. commandControl.CurrentPreviewConsent = new PreviewConsent {
  684. formRid = vo.formRid.ToString(),
  685. formGuid = vo.formGuid,
  686. formCd = vo.formCd.ToString(),
  687. FormName = vo.formName,
  688. formPrintName = vo.formPrntNm,
  689. prntCnt = vo.printCnt,
  690. consentMstRid = vo.consentMstRid.ToString(),
  691. consentStateEngnm = vo.consentStateEng,
  692. orderNo = 0,
  693. ocrCode = vo.ocrTag,
  694. inputId = vo.createUserId,
  695. inputNm = vo.createUserName,
  696. ReissueConsentMstRid = IsConsentStatePrintOut(vo) ? vo.consentMstRid : 0,
  697. RewriteConsentMstRid = !IsConsentStateUnfinished(vo) ? vo.consentMstRid : 0,
  698. ordType = vo.ordType,
  699. ocrtagPrntyn = vo.ocrTagPrntYn,
  700. userDrFlag = vo.userDrFlag,
  701. printOnly = vo.printOnly,
  702. opDiagName = vo.opDiagNm,
  703. drOnly = vo.DrOnly,
  704. opName = vo.opNm
  705. };
  706. }
  707. commandControl.CurrentPreviewConsent.ReissueConsentMstRid = vo.consentMstRid;
  708. // 미작성 동의서 삭제
  709. consentMain.ConsentCommandCtrl.DeleteRecordOfDeleteConsent(reason);
  710. // 동의서 목록 재조회 (미작성 동의서 삭제, 임시저장용 재조회, 인쇄출력용 재조회, 저장용(저장후 닫힘이 아닌 경우))
  711. consentMain.ConsentListCtrl.InquiryConsentData(-1);
  712. } catch (Exception ex) {
  713. throw ex;
  714. } finally {
  715. this.Cursor = currentCursor;
  716. }
  717. MessageBox.Show(string.Format(Properties.Resources.msg_consent_record_deleted)
  718. , string.Format(Properties.Resources.msg_caption_confirm),
  719. MessageBoxButtons.OK, MessageBoxIcon.Information);
  720. }
  721. }
  722. }
  723. /// <summary>
  724. /// 재출력 클릭
  725. /// </summary>
  726. /// <param name="sender">The source of the event.</param>
  727. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  728. private void reprintRecord_Click(object sender, EventArgs e) {
  729. ConsentFormListVO vo = GetCurrentConsentVO(this.dataGridViewConsentSelectResult.SelectedRows[0].Index);
  730. if (vo != null) {
  731. if (vo.consentState.Equals("반납확인")) {
  732. MessageBox.Show("반납확인 서식은 재출력이 불가능 합니다.");
  733. return;
  734. }
  735. this.dataGridViewConsentSelectResult.SelectedRows[0].Tag = "reissueTarget"; // 재출력 대상 마킹
  736. ExecutePreviewWithSelectedConsent(vo);
  737. this.dataGridViewConsentSelectResult.SelectedRows[0].Tag = null;
  738. //재출력을 하는 경우, 바로 출력이 되도록 한다.
  739. if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  740. if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  741. // 출력 로그 저장을 위한 버튼 클릭 설정
  742. this.consentMain.setPrintButton(true);
  743. // 재출력 시 OCRTAG 중복확인 제외
  744. commandControl.reprintStatus = true;
  745. commandControl.PrintConsentDocument();
  746. commandControl.reprintStatus = false;
  747. }
  748. }
  749. #endregion
  750. public void clearSearchStartDate() {
  751. searchStartDate = string.Empty;
  752. }
  753. private void dataGridViewConsentSelectResult_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) {
  754. foreach (DataGridViewRow row in dataGridViewConsentSelectResult.Rows) {
  755. if (!string.IsNullOrEmpty(row.Cells["consentStateEng"].Value.ToString())) {
  756. if (row.Cells["consentStateEng"].Value.ToString().ToUpper() == "UNFINISHED") {
  757. row.DefaultCellStyle.ForeColor = System.Drawing.Color.Red;
  758. }
  759. }
  760. }
  761. }
  762. private void dataGridViewConsentSelectResult_CellClick(object sender, DataGridViewCellEventArgs e) {
  763. }
  764. /// <summary>
  765. /// 선택된 동의서를 가져온다
  766. /// </summary>
  767. /// <returns>선택된 동의서 목록</returns>
  768. public List<ConsentFormListVO> getConfirmedCheckedConsentList() {
  769. List<ConsentFormListVO> consents = new List<ConsentFormListVO>();
  770. foreach (DataGridViewRow row in dataGridViewConsentSelectResult.Rows) {
  771. if (Convert.ToBoolean(row.Cells["colCheck"].Value)) {
  772. ConsentFormListVO consent = row.DataBoundItem as ConsentFormListVO;
  773. if (!consent.consentStateEng.Equals("ELECTR_CMP")) {
  774. return null;
  775. }
  776. consents.Add(consent);
  777. }
  778. }
  779. return consents;
  780. }
  781. /// <summary>
  782. /// 선택 초기화
  783. /// </summary>
  784. private void ClearCheckBox() {
  785. bool chkStatus = false;
  786. dataGridViewConsentSelectResult.Columns[0].HeaderText = "□";
  787. foreach (DataGridViewRow r in dataGridViewConsentSelectResult.Rows) {
  788. r.Cells["colCheck"].Value = chkStatus;
  789. }
  790. dataGridViewConsentSelectResult.RefreshEdit();
  791. }
  792. /// <summary>
  793. /// dbs227, 일괄저장
  794. /// 선택된 환자들의 저장 상태를 일괄저장으로 변경한다.
  795. /// </summary>
  796. /// <param name="sender"></param>
  797. /// <param name="e"></param>
  798. private void saveAllCertify_Click(object sender, EventArgs e) {
  799. // 선택된 동의서 목록을 가져온다.
  800. List<ConsentFormListVO> lists = getConfirmedCheckedConsentList();
  801. if (lists == null || lists.Count < 1) {
  802. MessageBox.Show("동의서를 선택하거나 확인 저장 동의서만 선택해 주세요.");
  803. //ClearCheckBox();
  804. return;
  805. }
  806. String mstRids = "";
  807. String ocrTags = "";
  808. int i = 0;
  809. foreach (ConsentFormListVO consent in lists) {
  810. if (i != 0) {
  811. mstRids += ",";
  812. ocrTags += ",";
  813. }
  814. mstRids += "'" + consent.consentMstRid + "'";
  815. ocrTags += "'" + consent.ocrTag + "'";
  816. i++;
  817. }
  818. // 선택된 동의서 상태값을 바꿔 준다.
  819. String result = consentWebService.updateCertifyComplete(mstRids, ocrTags, consentMain.ConsentExecuteInfo["dutinstcd"]);
  820. if (result.Equals("Y")) {
  821. MessageBox.Show("일괄저장 하였습니다.");
  822. ClearCheckBox();
  823. try {
  824. this.checkBoxAll.Checked = true;
  825. InitDataGrid();
  826. BindDataGridRows();
  827. } catch (Exception ex) {
  828. throw ex;
  829. }
  830. }
  831. }
  832. /// <summary>
  833. /// 사용자 라디오 버튼 클릭 시 일괄저장을 보여준다
  834. /// </summary>
  835. /// <param name="sender"></param>
  836. /// <param name="e"></param>
  837. private void rdoUser_CheckedChanged(object sender, EventArgs e) {
  838. if (!rdoUser.Checked) {
  839. //saveAllCertify.Visible = false;
  840. searchName.Visible = false;
  841. }
  842. // 현재 로그인 한 사용자가 의사라면 일괄저장 버튼을 활성화 하여 준다.
  843. else if (rdoUser.Checked/* && commandControl.CurrentEndUser.JobKindCd.Equals("0330")*/) {
  844. // saveAllCertify 버튼 보이도록
  845. //saveAllCertify.Visible = true;
  846. searchName.Visible = true;
  847. }
  848. }
  849. }
  850. }