ConsentMainControl.cs 110 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Windows.Forms;
  4. using CLIP.eForm.Consent.Common;
  5. using System.Reflection;
  6. using System.Threading;
  7. using System.Xml;
  8. using System.IO;
  9. using System.ComponentModel;
  10. using System.Configuration;
  11. using System.Drawing;
  12. using CLIP.eForm.Consent.UI.ConsentSvcRef;
  13. using ClipSoft.eForm.Base.Dialog;
  14. namespace CLIP.eForm.Consent.UI {
  15. /// <summary>
  16. /// 동의서 관리 메인 컨트롤 클래스
  17. /// </summary>
  18. /// <remarks>
  19. /// <p>[설계자]</p>
  20. /// <p> 클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)</p>
  21. /// <p>[원본 작성자]</p>
  22. /// <p> 클립소프트 기술부 이창훈 (chlee@clipsoft.co.kr)</p>
  23. /// <p>[수정 작성자]</p>
  24. /// <p> 클립소프트 기술부 이인희</p>
  25. /// <p>----------------------------------------------------------------------------------------</p>
  26. /// <p>[HISTORY]</p>
  27. /// <p> 2015-07-30 : 최초작성</p>
  28. /// <p>----------------------------------------------------------------------------------------</p>
  29. /// </remarks>
  30. public partial class ConsentMainControl : UserControl, IConsentMainCtrl, IConsentMain {
  31. private string currentFormGuid = string.Empty;
  32. private ConsentSvcRef.ConsentSvcSoapClient consentWebService;
  33. private HospitalSvcRef.HospitalSvcSoapClient hospitalWebService;
  34. //private IConsentMainForm _consentMainForm = null; // AgentForm(리턴시 사용)
  35. [Browsable(false)]
  36. public ConsentSvcRef.ConsentSvcSoapClient ConsentWebService { get { return consentWebService; } }
  37. [Browsable(false)]
  38. public HospitalSvcRef.HospitalSvcSoapClient HospitalWebService { get { return hospitalWebService; } }
  39. public string PluginModuleName { get; set; }
  40. private Dictionary<string, string> outputDataDic = null;
  41. private Dictionary<string, object> processResultValues = new Dictionary<string, object>();
  42. public Dictionary<string, string> ConsentExecuteInfo { get; set; }
  43. public Dictionary<string, string> PluginExecuteInfo { get; set; }
  44. public Dictionary<string, object> ProcessResultValues { get { return processResultValues; } }
  45. public List<ConsentVO> PrintInfoList { get; set; }
  46. public event EventHandler OnLoadPartControls;
  47. public event EventHandler OnResizeReviewConsent;
  48. public event EventHandler OnVisibleEFormControl;
  49. public event EventHandler OnInvisibleEFormControl;
  50. public event ProcessResultHandler ProcessResult;
  51. public delegate void ProcessResultHandler(string result);
  52. public object mCallParm = null;
  53. public bool printSaveStatus { get; set; }
  54. public int multiPrintPlanCnt { get; set; }
  55. public int multiPrintExecCnt { get; set; }
  56. public bool saveClickPoint { get; set; } // true : 메인창, false : 듀얼뷰어창
  57. public bool checkAutoPrint { get; set; } // true : 입실저장 자동출력, false : 수동출력
  58. private static bool startform = true;
  59. public int agentCallPrintCnt { get; set; }
  60. public int printConsentCount = 1;
  61. // 원무 서식 인증서 pass 여부
  62. // 경북대병원 dependency
  63. public bool shouldPassCertify = false;
  64. public static Dictionary<String, String> SETTING_DATA = new Dictionary<String, String>();
  65. /// <summary>
  66. /// Gets or sets the call parameter.
  67. /// </summary>
  68. /// <value>
  69. /// The call parameter.
  70. /// </value>
  71. object IConsentMainCtrl.CallParam {
  72. get {
  73. return mCallParm;
  74. }
  75. set {
  76. mCallParm = value;
  77. }
  78. }
  79. public List<Dictionary<string, object>> multiParams { get; set; }
  80. /// <summary>
  81. /// Initializes a new instance of the <see cref="ConsentMainControl"/> class.
  82. /// </summary>
  83. /// <param name="callParam">The call parameter.</param>
  84. public ConsentMainControl(object callParam) {
  85. //MessageBox.Show("Waiting");
  86. InitializeComponent();
  87. bool isMultiParams = false;
  88. ToolTip _toolTip = new ToolTip();
  89. _toolTip.AutoPopDelay = 5000;
  90. _toolTip.InitialDelay = 0;
  91. _toolTip.ReshowDelay = 0;
  92. _toolTip.ShowAlways = true;
  93. _toolTip.SetToolTip(this.btnHelp, "도움말");
  94. // 실행 정보 데이터셋 초기화
  95. ConsentExecuteInfo = new Dictionary<string, string> {
  96. { "dutinstcd", string.Empty },
  97. { "userNo", string.Empty },
  98. { "loginUserNo", string.Empty },
  99. { "userName", string.Empty },
  100. { "loginUserName", string.Empty },
  101. { "userDeptCd", string.Empty },
  102. { "userDeptName", string.Empty },
  103. { "patientNo", string.Empty },
  104. { "visitType", string.Empty },
  105. { "clnDept", string.Empty },
  106. { "clnDate", string.Empty },
  107. { "cretno", string.Empty },
  108. { "clnDxNm", string.Empty },
  109. { "opRsrvNo", string.Empty },
  110. { "useListView", string.Empty },
  111. { "patientListView", string.Empty },
  112. { "startFormCd", string.Empty },
  113. { "printAct", string.Empty },
  114. { "printList", string.Empty },
  115. { "formCd", string.Empty },
  116. { "ocrTag", string.Empty },
  117. { "tempSave", string.Empty },
  118. { "printYN", string.Empty },
  119. { "printCount", string.Empty },
  120. { "printIP", string.Empty },
  121. { "prntCnt", string.Empty },
  122. { "userIOFlag", "O" },
  123. { "sysInstNm", string.Empty },
  124. { "readOnly", string.Empty },
  125. { "SpecDoctorYN", string.Empty },
  126. { "ContStartDate", string.Empty },
  127. { "ContEndDate", string.Empty },
  128. { "RoomCapa", string.Empty },
  129. { "ContTelNo", string.Empty },
  130. { "ContStaff1Name", string.Empty },
  131. { "ContStaff2Name", string.Empty },
  132. { "ContStaff3Name", string.Empty },
  133. { "DeviceType", string.Empty },
  134. // 경대병원 태그 추가
  135. { "tag1", string.Empty },
  136. { "tag2", string.Empty },
  137. { "tag3", string.Empty },
  138. { "tag4", string.Empty },
  139. { "tag5", string.Empty },
  140. { "tag6", string.Empty },
  141. { "tag7", string.Empty },
  142. { "tag8", string.Empty },
  143. { "tag9", string.Empty },
  144. { "tag10", string.Empty },
  145. { "CardNo", string.Empty }
  146. };
  147. PluginExecuteInfo = new Dictionary<string, string>();
  148. //연속서식인지 구분하는 부분
  149. if ((callParam != null) && (callParam is Dictionary<string, object> result)) {
  150. if (result.ContainsKey("VERSION") && result["VERSION"].ToString().Equals("2.0")) {
  151. isMultiParams = true;
  152. }
  153. }
  154. if (isMultiParams) {
  155. //연속서식일 때
  156. //화면설정 정보는 전역변수에 할당하고 나머지 배열로 들어오는 정보들은 multiParams에 할당하여
  157. //동의서를 부를 때 하나씩 전역변수에 넣고 동의서를 부른다
  158. InitMultiParamSetting(callParam);
  159. SetWebServiceUrlAndTimeout();
  160. this.PluginModuleName = ConfigurationManager.AppSettings["UIPluginAssembly"];
  161. if (multiParams.Count > 0) {
  162. //연속서식의 첫번째 서식을 불러오기 위해 파라미터 배열의 가장 첫번째 데이터를 전역변수에 할당한다
  163. Dictionary<string, object> pageCountParam = ((Dictionary<string, object>)multiParams[multiParams.Count - 1]);
  164. if (pageCountParam.ContainsKey("PAGE_COUNT") && Int32.TryParse(pageCountParam["PAGE_COUNT"].ToString(), out int page)) {
  165. setConsentViewMultiParams(page);
  166. }
  167. }
  168. }
  169. else {
  170. //연속서식이 아닐 때
  171. // 넘겨받은 callParam 를 디코딩 한다
  172. InitParamSetting(callParam);
  173. SetWebServiceUrlAndTimeout();
  174. this.PluginModuleName = ConfigurationManager.AppSettings["UIPluginAssembly"];
  175. }
  176. }
  177. //private void SendKeyValueMessageToAdapter(int key, string message)
  178. //{
  179. // _consentMainForm.SendKeyValueMessageToAdapter(key, message);
  180. //}
  181. /// <summary>
  182. /// Gets a value indicating whether this instance has vertical monitor.
  183. /// </summary>
  184. /// <value>
  185. /// <c>true</c> if this instance has vertical monitor; otherwise, <c>false</c>.
  186. /// </value>
  187. public static bool HasVerticalMonitor {
  188. get {
  189. if (Screen.AllScreens.Length > 1) {
  190. foreach (Screen screen in Screen.AllScreens) {
  191. if (screen.Bounds.Width < screen.Bounds.Height) {
  192. return true;
  193. }
  194. }
  195. }
  196. return false;
  197. }
  198. }
  199. /// <summary>
  200. /// 수술 관련 동의서 호출 시 수술탭 확인 후 팝업 호출
  201. /// </summary>
  202. /// <param name="formCd"></param>
  203. public bool checkOperationDocument(string formCd) {
  204. var hardcd = consentWebService.checkOperationDocument(ConsentExecuteInfo["dutinstcd"], formCd);
  205. var retValue = true;
  206. if (!opPatientSelected && hardcd.Equals("Y")) {
  207. DialogResult result = MessageBox.Show("수술정보가 없습니다. 수술 동의서는 수술 Tab에서 서식 출력 바랍니다.\n수술 정보 없이 계속 진행하시겠습니까?", "확인", MessageBoxButtons.OKCancel);
  208. if (result != DialogResult.OK) {
  209. retValue = false;
  210. }
  211. }
  212. return retValue;
  213. }
  214. private bool opPatientSelected = false;
  215. public void setOpPatientSelected(bool value) {
  216. this.opPatientSelected = value;
  217. }
  218. /// <summary>
  219. /// 주어진 서버 이름으로 설정파일을 로딩 한다
  220. /// </summary>
  221. /// <param name="pServerName">로드 할 서버 설정 파일</param>
  222. /// <returns></returns>
  223. public static Dictionary<string, string> GetConfigDictionary(string pServerName) {
  224. Dictionary<string, string> result = new Dictionary<string, string>();
  225. /*
  226. XmlDocument configXml = new XmlDocument();
  227. configXml.Load(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + string.Format("/CLIP.Consent.xml"));
  228. XmlNodeList addNodes = configXml.SelectNodes("configuration/settings/add");
  229. foreach (XmlNode xmlNode in addNodes) {
  230. if (xmlNode.Attributes["key"].InnerText == "serviceTarget") {
  231. serviceTarget = ((XmlCDataSection)xmlNode.ChildNodes[0]).InnerText;
  232. }
  233. }
  234. */
  235. XmlDocument configXml = new XmlDocument();
  236. configXml.Load(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + string.Format("/CLIP.Consent-{0}.xml", pServerName));
  237. XmlNodeList addNodes = configXml.SelectNodes("configuration/settings/add");
  238. foreach (XmlNode xmlNode in addNodes) {
  239. result.Add(xmlNode.Attributes["key"].InnerText, ((XmlCDataSection)xmlNode.ChildNodes[0]).InnerText);
  240. }
  241. return result;
  242. }
  243. /// <summary>
  244. /// childControl의 부모와 그의 부모들에서 IConsentMain 인터페이스를 구현하는 클래스를 찾는다.
  245. /// </summary>
  246. /// <param name="childControl"></param>
  247. /// <returns></returns>
  248. public static IConsentMain GetConsentMainInterface(Control childControl) {
  249. if (childControl.Parent == null) {
  250. return null;
  251. }
  252. else {
  253. if (childControl.Parent is IConsentMain) {
  254. return childControl.Parent as IConsentMain;
  255. }
  256. else {
  257. return GetConsentMainInterface(childControl.Parent);
  258. }
  259. }
  260. }
  261. /// <summary>
  262. /// Sets the web service URL and timeout.
  263. /// </summary>
  264. private void SetWebServiceUrlAndTimeout() {
  265. try {
  266. Dictionary<string, string> configDic = GetConfigDictionary(ConsentExecuteInfo["sysInstNm"]);
  267. this.PluginExecuteInfo.Add("consentSvcUrl", configDic["consentSvcUrl"]);
  268. this.PluginExecuteInfo.Add("hospitalSvcUrl", configDic["hospitalSvcUrl"]);
  269. this.PluginExecuteInfo.Add("formServiceUrl", configDic["formServiceUrl"]);
  270. this.PluginExecuteInfo.Add("baseConsentSvcURL", configDic["baseConsentSvcURL"]);
  271. this.PluginExecuteInfo.Add("imageUploadServerUrl", configDic["imageUploadServerUrl"]);
  272. this.PluginExecuteInfo.Add("signatureServerUrl", configDic["signatureServerUrl"]);
  273. this.PluginExecuteInfo.Add("signatureServerPort", configDic["signatureServerPort"]);
  274. this.PluginExecuteInfo.Add("imageUploadPath", configDic["imageUploadPath"]);
  275. this.PluginExecuteInfo.Add("ConsentSearchStartDate", configDic["ConsentSearchStartDate"]);
  276. this.PluginExecuteInfo.Add("timeOut", "10");
  277. this.consentWebService = WebMethodCommon.GetConsentWebService(configDic["consentSvcUrl"]);
  278. this.hospitalWebService = WebMethodCommon.GetHospitalWebService(configDic["hospitalSvcUrl"]);
  279. }
  280. catch (Exception ex) {
  281. throw ex;
  282. }
  283. }
  284. public ConsentSvcRef.ConsentSvcSoapClient getConsentWebService() {
  285. return this.consentWebService;
  286. }
  287. public HospitalSvcRef.HospitalSvcSoapClient getHospitalWebService() {
  288. return this.hospitalWebService;
  289. }
  290. /// <summary>
  291. /// Initializes the parameters.
  292. /// </summary>
  293. public void initParams() {
  294. InitParamSetting(mCallParm);
  295. }
  296. /// <summary>
  297. /// 화면 초기화 시 수행해야 할 이벤트 처리
  298. /// </summary>
  299. /// <param name="e"></param>
  300. protected override void OnLoad(EventArgs e) {
  301. try {
  302. // 출력을 사용하면 프로그램 종료 이벤트 추가
  303. if (ConsentExecuteInfo["printAct"].Equals("Y")) {
  304. this.Parent.Disposed += Parent_Disposed;
  305. }
  306. if (string.IsNullOrEmpty(this.PluginModuleName)) {
  307. return;
  308. }
  309. // 고정 모니터 설정
  310. MoniterViewSetting(ConsentExecuteInfo["printYN"].Equals("Y") ? true : false);
  311. if (ConsentExecuteInfo["printYN"].Equals("Y")) {
  312. this.Parent.Visible = false;
  313. }
  314. // 기존 인증서 삭제
  315. SignatureConfig sign = new SignatureConfig();
  316. if (!startform) {
  317. startform = false;
  318. sign.SignAllClear();
  319. }
  320. // eFormViewer 컨트롤 초기화
  321. InitEFormControl();
  322. HospitalSvcRef.SingleReturnData baseData = this.hospitalWebService.GetBaseData(ConsentExecuteInfo["dutinstcd"]);
  323. String[] strAr = baseData.responseData.Split(',');
  324. for (int i = 0; i < strAr.Length; i++) {
  325. String[] dataAr = strAr[i].Split('|');
  326. String key = "";
  327. String value = "";
  328. for (int j = 0; j < dataAr.Length; j++) {
  329. if (j == 0) {
  330. key = dataAr[j];
  331. }
  332. else {
  333. value = dataAr[j];
  334. }
  335. }
  336. SETTING_DATA.Add(key, value);
  337. }
  338. // TODO 201909
  339. // 경북대학교병원 특정 옵션 호출 시 조회 화면 제거 루틴 추가 필요
  340. //ConsentExecuteInfo["useListView"] = "N";
  341. //ConsentExecuteInfo["patientListView"] = "N";
  342. InvokeDelayedLoadEvent();
  343. this.eFormViewerCtrl.GetCurrentViewer().UIUpdateOnDrawing
  344. += new Viewer.UIUpdateOnDrawingHandler(ConsentMainControl_UIUpdateOnDrawing);
  345. base.OnLoad(e);
  346. // dbs227
  347. // TODO 디버그 용 메시지 박스
  348. //Boolean openDualView = (this.consentWebService.getDualViewMode(ConsentExecuteInfo["dutinstcd"],
  349. // ConsentExecuteInfo["ipaddr"]) == "Y") ? true : false;
  350. //MessageBox.Show("Waiting for debugging at " + ConsentExecuteInfo["ipaddr"]);
  351. // Ku2.0 연동
  352. GetConsentListByFormcd();
  353. // 폰트 설치여부 체크
  354. string familyName;
  355. string familyList = "";
  356. FontFamily[] fontFamilies;
  357. System.Drawing.Text.InstalledFontCollection installedFontCollection = new System.Drawing.Text.InstalledFontCollection();
  358. fontFamilies = installedFontCollection.Families;
  359. int count = fontFamilies.Length;
  360. int fontCheck = 0;
  361. for (int j = 0; j < count; ++j) {
  362. familyName = fontFamilies[j].Name;
  363. familyList = familyList + familyName;
  364. familyList = familyList + ", ";
  365. if (fontCheck != 1 && (familyName == "나눔고딕" || familyName == "NanumGothic")) {
  366. fontCheck = fontCheck + 1;
  367. }
  368. if (fontCheck < 100 && (familyName == "나눔고딕 ExtraBold" || familyName == "NanumGothicExtraBold" || familyName == "나눔고딕 아주 굵게")) {
  369. fontCheck = fontCheck + 10;
  370. }
  371. }
  372. // 폰트 설치 실행
  373. if (fontCheck < 11) {
  374. System.Diagnostics.Process UserProcess = new System.Diagnostics.Process();
  375. UserProcess.StartInfo.UseShellExecute = true;
  376. //UserProcess.StartInfo.FileName = "NanumFontSetup.exe";
  377. //UserProcess.StartInfo.WorkingDirectory = Path.GetDirectoryName(Application.StartupPath + "/Font/");
  378. // 폰트가 없어 최초 실행 시 에러 발생 부분 수정
  379. UserProcess.StartInfo.FileName = "FontInstall.exe";
  380. UserProcess.StartInfo.WorkingDirectory = Path.GetDirectoryName(Application.StartupPath + "\\");
  381. UserProcess.StartInfo.CreateNoWindow = true;
  382. UserProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
  383. UserProcess.Start();
  384. }
  385. string sTempPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Clipsoft\ClipSoft.eForm.Viewer\DataTemp\";
  386. if (Directory.Exists(sTempPath)) {
  387. string[] filePaths = Directory.GetFiles(sTempPath);
  388. foreach (string fileName in filePaths) {
  389. FileInfo fileInfo = new FileInfo(fileName);
  390. if (fileInfo.Extension.Equals(".ept") || fileInfo.Extension.Equals(".jpg") || fileInfo.Extension.Equals(".xml")) {
  391. fileInfo.Delete();
  392. }
  393. }
  394. }
  395. if (multiParams != null && multiParams.Count > 0) {
  396. int pageCount = Int32.TryParse(((Dictionary<string, object>)multiParams[multiParams.Count - 1])["PAGE_COUNT"].ToString(), out int page) ? page : 0;
  397. showConsentView(pageCount);
  398. Boolean openDualView = (this.consentWebService.getDualViewMode(ConsentExecuteInfo["dutinstcd"], ConsentExecuteInfo["ipaddr"]) == "Y") ? true : false;
  399. if (openDualView) {
  400. consentCommandCtrl.RunConsentDualView();
  401. }
  402. }
  403. }
  404. catch (Exception ex) {
  405. // 데이터베이스 저장 기능 추가로 해당 기능 삭제
  406. //File.WriteAllText(string.Format(@"{0}\eConsentLog\{1}_Agent.txt", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
  407. // , DateTime.Now.ToString("yyyyMMdd_HHmmss"))
  408. // , ex.ToString());
  409. Console.WriteLine(ex.ToString());
  410. if (this.Parent is System.Windows.Forms.Form) {
  411. ((Form)this.Parent).DialogResult = DialogResult.Cancel;
  412. ((Form)this.Parent).Close();
  413. }
  414. }
  415. }
  416. // 화면이 종료될때 Agent도 종료되도록 수정
  417. /// <summary>
  418. /// Handles the Disposed event of the Parent control.
  419. /// </summary>
  420. /// <param name="sender">The source of the event.</param>
  421. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  422. private void Parent_Disposed(object sender, EventArgs e) {
  423. foreach (Form form in Application.OpenForms) {
  424. if (form.Name.Equals("ConsentAgentForm")) {
  425. form.Dispose();
  426. break;
  427. }
  428. }
  429. }
  430. // 화면이 종료될때 Agent도 종료되도록 수정
  431. /// <summary>
  432. /// Parents the disposed.
  433. /// </summary>
  434. public void Parent_Disposed() {
  435. foreach (Form form in Application.OpenForms) {
  436. if (form.Name.Equals("ConsentAgentForm")) {
  437. form.Dispose();
  438. break;
  439. }
  440. }
  441. }
  442. /// <summary>
  443. /// OCX 로 부터 넘겨 받은 파라미터를 decode
  444. /// </summary>
  445. /// <param name="pCallParm">EXEC_OPT 로 넘어온 파라미터 목록</param>
  446. /// <exception cref="Exception">CallParam 미전달</exception>
  447. private void InitParamSetting(object pCallParm) {
  448. try {
  449. if (pCallParm != null) {
  450. Dictionary<string, object> callParam = pCallParm as Dictionary<string, object>;
  451. if (callParam != null && callParam.Count < 2) {
  452. if (callParam["CALL_PARAMS"] != null) {
  453. pCallParm = callParam["CALL_PARAMS"] as object;
  454. }
  455. }
  456. foreach (KeyValuePair<string, object> callKV in pCallParm as Dictionary<string, object>) {
  457. // 사용자 정보
  458. if (callKV.Key != null && !string.IsNullOrEmpty(callKV.Key.ToString()) && callKV.Key.ToString() == "USER_INFO") {
  459. foreach (KeyValuePair<string, object> userKV in callKV.Value as Dictionary<string, object>) {
  460. if (userKV.Key != null && !string.IsNullOrEmpty(userKV.Key.ToString()) && userKV.Key.ToString() == "USER_ID") {
  461. if (userKV.Value != null) {
  462. ConsentExecuteInfo["userNo"] = userKV.Value.ToString();
  463. ConsentExecuteInfo["loginUserNo"] = userKV.Value.ToString();
  464. }
  465. }
  466. else if (userKV.Key != null && !string.IsNullOrEmpty(userKV.Key.ToString()) && userKV.Key.ToString() == "DUTINSTCD") {
  467. if (userKV.Value != null) {
  468. ConsentExecuteInfo["dutinstcd"] = userKV.Value.ToString();
  469. }
  470. }
  471. else if (userKV.Key != null && !string.IsNullOrEmpty(userKV.Key.ToString()) && userKV.Key.ToString() == "USER_NAME") {
  472. if (userKV.Value != null) {
  473. ConsentExecuteInfo["userName"] = userKV.Value.ToString();
  474. ConsentExecuteInfo["loginUserName"] = userKV.Value.ToString();
  475. }
  476. }
  477. else if (userKV.Key != null && !string.IsNullOrEmpty(userKV.Key.ToString()) && userKV.Key.ToString() == "USER_DEPTCD") {
  478. if (userKV.Value != null) {
  479. ConsentExecuteInfo["userDeptCd"] = userKV.Value.ToString();
  480. }
  481. }
  482. else if (userKV.Key != null && !string.IsNullOrEmpty(userKV.Key.ToString()) && userKV.Key.ToString() == "USER_DEPTNM") {
  483. if (userKV.Value != null) {
  484. ConsentExecuteInfo["userDeptName"] = userKV.Value.ToString();
  485. }
  486. }
  487. }
  488. }
  489. // 환자 정보
  490. if (callKV.Key != null && !string.IsNullOrEmpty(callKV.Key.ToString()) && callKV.Key.ToString() == "PATIENT_INFO") {
  491. foreach (KeyValuePair<string, object> patientKV in callKV.Value as Dictionary<string, object>) {
  492. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "PTNT_NO") {
  493. if (patientKV.Value != null) ConsentExecuteInfo["patientNo"] = patientKV.Value.ToString();
  494. }
  495. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "VISIT_TYPE") {
  496. if (patientKV.Value != null) ConsentExecuteInfo["visitType"] = patientKV.Value.ToString();
  497. }
  498. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CLN_DEPT") {
  499. if (patientKV.Value != null) ConsentExecuteInfo["clnDept"] = patientKV.Value.ToString();
  500. }
  501. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CLN_DATE") {
  502. if (patientKV.Value != null) ConsentExecuteInfo["clnDate"] = patientKV.Value.ToString();
  503. }
  504. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CRETNO") {
  505. if (patientKV.Value != null) ConsentExecuteInfo["cretno"] = patientKV.Value.ToString();
  506. }
  507. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CLN_DX_NM") {
  508. if (patientKV.Value != null) ConsentExecuteInfo["clnDxNm"] = patientKV.Value.ToString();
  509. }
  510. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "OPRSRVNO") {
  511. if (patientKV.Value != null) ConsentExecuteInfo["opRsrvNo"] = patientKV.Value.ToString();
  512. }
  513. }
  514. }
  515. if (callKV.Key != null && !string.IsNullOrEmpty(callKV.Key.ToString()) && callKV.Key.ToString() == "EXEC_OPT") {
  516. // 화면 설정 정보
  517. foreach (KeyValuePair<string, object> execKV in callKV.Value as Dictionary<string, object>) {
  518. if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "USE_LIST_VIEW") {
  519. if (execKV.Value != null) ConsentExecuteInfo["useListView"] = execKV.Value.ToString(); // 동의서 리스트 사용 유무
  520. }
  521. if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "PTNT_LIST_VIEW") {
  522. if (execKV.Value != null) ConsentExecuteInfo["patientListView"] = execKV.Value.ToString(); // 환자 리스트 사용 유무
  523. }
  524. if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "START_FORM_CD") {
  525. if (execKV.Value != null) ConsentExecuteInfo["startFormCd"] = execKV.Value.ToString(); // 시작 FORM ID
  526. }
  527. if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "PTNT_ACT") {
  528. if (execKV.Value != null) ConsentExecuteInfo["printAct"] = execKV.Value.ToString(); // 초기 프린트
  529. }
  530. if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "PRINT_LIST") {
  531. if (execKV.Value != null) {
  532. if (execKV.Value is List<object> PatientList && PatientList.Count > 0) {
  533. PrintInfoList = new List<ConsentVO>();
  534. ConsentVO consentVO = new ConsentVO();
  535. for (int i = 0; i < PatientList.Count; i++) {
  536. consentVO = new ConsentVO {
  537. prntCnt = -1
  538. };
  539. foreach (KeyValuePair<string, object> callOrderKV in PatientList[i] as Dictionary<string, object>) {
  540. if (callOrderKV.Key != null && !string.IsNullOrEmpty(callOrderKV.Key.ToString()) && callOrderKV.Value != null) {
  541. if (callOrderKV.Key.ToString() == "START_FORM_CD") consentVO.formCd = callOrderKV.Value.ToString(); // 출력 서식코드
  542. if (callOrderKV.Key.ToString() == "PTNT_NO") consentVO.pid = callOrderKV.Value.ToString(); // 환자번호
  543. if (callOrderKV.Key.ToString() == "VISIT_TYPE") consentVO.ordtype = callOrderKV.Value.ToString(); // 내원구분
  544. if (callOrderKV.Key.ToString() == "CLN_DATE") consentVO.clnDate = callOrderKV.Value.ToString(); // 진료일자
  545. if (callOrderKV.Key.ToString() == "CLN_DEPT") consentVO.clnDeptCd = callOrderKV.Value.ToString(); // 진료과
  546. if (callOrderKV.Key.ToString() == "PRINT_CNT") {
  547. int.TryParse(callOrderKV.Value.ToString(), out int PrntCnt);
  548. consentVO.prntCnt = PrntCnt; // 출력 카운트
  549. }
  550. if (callOrderKV.Key.ToString() == "CRETNO") {
  551. int.TryParse(callOrderKV.Value.ToString(), out int cretno);
  552. consentVO.cretno = cretno; // 차트번호
  553. }
  554. }
  555. }
  556. PrintInfoList.Add(consentVO);
  557. }
  558. if (execKV.Value != null) ConsentExecuteInfo["printList"] = PrintInfoList.Count.ToString(); // 출력 데이터
  559. }
  560. }
  561. }
  562. if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "FORMCD") { // 서식 코드
  563. if (execKV.Value != null) ConsentExecuteInfo["formCd"] = execKV.Value.ToString();
  564. }
  565. if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "OCRTAG") { // OCR 태그
  566. if (execKV.Value != null) ConsentExecuteInfo["ocrTag"] = execKV.Value.ToString();
  567. }
  568. if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "TEMP_SAVE") { // 임시 저장 (Ku2.0 연동)
  569. if (execKV.Value != null) ConsentExecuteInfo["tempSave"] = execKV.Value.ToString();
  570. }
  571. if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "PRINT_YN") { // 출력 여부 (Ku2.0 연동)
  572. if (execKV.Value != null) ConsentExecuteInfo["printYN"] = execKV.Value.ToString();
  573. }
  574. if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "PRINT_CNT") { // 출력 매수 (Ku2.0 연동)
  575. if (execKV.Value != null) ConsentExecuteInfo["printCount"] = execKV.Value.ToString();
  576. }
  577. if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "SYSINSTNM") { // 접속 서버 정보
  578. if (execKV.Value != null) {
  579. string instCd = string.Empty;
  580. instCd = execKV.Value.ToString().Contains("본원") ? "031" : execKV.Value.ToString().Contains("칠곡") ? "032" : string.Empty;
  581. instCd += execKV.Value.ToString().Contains("교육") ? "edu" : string.Empty;
  582. //instCd = "Dev";
  583. ConsentExecuteInfo["sysInstNm"] = instCd;
  584. }
  585. }
  586. if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "READONLY") { // 보기 전용 여부
  587. if (execKV.Value != null) ConsentExecuteInfo["readOnly"] = execKV.Value.ToString();
  588. }
  589. }
  590. }
  591. // 원무
  592. if (callKV.Key != null && !string.IsNullOrEmpty(callKV.Key.ToString()) && callKV.Key.ToString() == "PAM_INFO") {
  593. foreach (KeyValuePair<string, object> patientKV in callKV.Value as Dictionary<string, object>) {
  594. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "SPEC_DR_YN") {
  595. if (patientKV.Value != null) ConsentExecuteInfo["SpecDoctorYN"] = patientKV.Value.ToString();
  596. }
  597. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CONT_START_DT") {
  598. if (patientKV.Value != null) ConsentExecuteInfo["ContStartDate"] = patientKV.Value.ToString();
  599. }
  600. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CONT_END_DT") {
  601. if (patientKV.Value != null) ConsentExecuteInfo["ContEndDate"] = patientKV.Value.ToString();
  602. }
  603. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "ROOM_CAPA") {
  604. if (patientKV.Value != null) ConsentExecuteInfo["RoomCapa"] = patientKV.Value.ToString();
  605. }
  606. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CONT_TELNO") {
  607. if (patientKV.Value != null) ConsentExecuteInfo["ContTelNo"] = patientKV.Value.ToString();
  608. }
  609. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CONT_STAFF1") {
  610. if (patientKV.Value != null) ConsentExecuteInfo["ContStaff1Name"] = patientKV.Value.ToString();
  611. }
  612. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CONT_STAFF2") {
  613. if (patientKV.Value != null) ConsentExecuteInfo["ContStaff2Name"] = patientKV.Value.ToString();
  614. }
  615. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CONT_STAFF3") {
  616. if (patientKV.Value != null) ConsentExecuteInfo["ContStaff3Name"] = patientKV.Value.ToString();
  617. }
  618. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CARD_NO") {
  619. if (patientKV.Value != null) ConsentExecuteInfo["CardNo"] = patientKV.Value.ToString();
  620. }
  621. // 경대병원 원무 태그 추가
  622. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "TAG1") {
  623. if (patientKV.Value != null)
  624. ConsentExecuteInfo["tag1"] = patientKV.Value.ToString();
  625. }
  626. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "TAG2") {
  627. if (patientKV.Value != null)
  628. ConsentExecuteInfo["tag2"] = patientKV.Value.ToString();
  629. }
  630. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "TAG3") {
  631. if (patientKV.Value != null)
  632. ConsentExecuteInfo["tag3"] = patientKV.Value.ToString();
  633. }
  634. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "TAG4") {
  635. if (patientKV.Value != null)
  636. ConsentExecuteInfo["tag4"] = patientKV.Value.ToString();
  637. }
  638. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "TAG5") {
  639. if (patientKV.Value != null)
  640. ConsentExecuteInfo["tag5"] = patientKV.Value.ToString();
  641. }
  642. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "TAG6") {
  643. if (patientKV.Value != null)
  644. ConsentExecuteInfo["tag6"] = patientKV.Value.ToString();
  645. }
  646. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "TAG7") {
  647. if (patientKV.Value != null)
  648. ConsentExecuteInfo["tag7"] = patientKV.Value.ToString();
  649. }
  650. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "TAG8") {
  651. if (patientKV.Value != null)
  652. ConsentExecuteInfo["tag8"] = patientKV.Value.ToString();
  653. }
  654. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "TAG9") {
  655. if (patientKV.Value != null)
  656. ConsentExecuteInfo["tag9"] = patientKV.Value.ToString();
  657. }
  658. if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "TAG10") {
  659. if (patientKV.Value != null)
  660. ConsentExecuteInfo["tag10"] = patientKV.Value.ToString();
  661. }
  662. }
  663. }
  664. }
  665. }
  666. else {
  667. throw new Exception("CallParam 미전달");
  668. }
  669. // IP 주소 확인
  670. string printIp = string.Empty;
  671. foreach (System.Net.IPAddress ip in System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName())) {
  672. if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) {
  673. printIp = ip.ToString();
  674. break;
  675. }
  676. }
  677. // dbs227, 경북대학교병원 ip address 기록
  678. ConsentExecuteInfo["ipaddr"] = printIp;
  679. if (!printIp.Equals(string.Empty)) {
  680. string[] ipArr = printIp.Split(new string[] { "." }, StringSplitOptions.RemoveEmptyEntries);
  681. if (ipArr.Length == 4) {
  682. printIp = string.Format("{0}.{1}", ipArr[2], ipArr[3]);
  683. }
  684. else {
  685. printIp = string.Empty;
  686. }
  687. }
  688. ConsentExecuteInfo["printIP"] = printIp;
  689. //버전정보
  690. string[] versionName = Assembly.GetExecutingAssembly().FullName.Split(',')[1].Split('.');
  691. string version = versionName[versionName.Length - 1];
  692. ConsentExecuteInfo["DeviceType"] = "WIN," + version + "," + ConsentExecuteInfo["dutinstcd"];
  693. }
  694. catch (Exception ex) {
  695. throw ex;
  696. }
  697. }
  698. /// <summary>
  699. /// 모니터 뷰 설정
  700. /// </summary>
  701. /// <param name="printMode">출력 여부</param>
  702. private void MoniterViewSetting(bool printMode) {
  703. // 출력 모드라면 화면에 나타내지 않는다
  704. if (printMode) {
  705. return;
  706. }
  707. //현재 프로그램이 실행되고 있는정보 가져오기: 디버깅 모드라면 bin/debug/프로그램명.exe
  708. FileInfo exefileinfo = new FileInfo(Path.GetDirectoryName(Application.StartupPath));
  709. // AppDomain.CurrentDomain.DynamicDirectory
  710. // Server.MapPath("~")
  711. string path = Path.GetDirectoryName(Application.StartupPath);//
  712. string fileName = @"\config.ini"; //파일명
  713. //만약 현재 실행 되는 경로가 아닌 특정한 위치를 원한다면 위에 과정 상관없이 바로 경로셋팅 해 주면 된다. (예: c:\config.ini)
  714. string filePath = path + fileName; //ini 파일 경로
  715. iniUtil ini = new iniUtil(filePath); // 만들어 놓았던 iniUtil 객체 생성(생성자 인자로 파일경로 정보 넘겨줌)
  716. //이제 ini 객체를 이용해 맘것 사용하면 된다.
  717. string sMoniterNumber = ini.GetIniValue("DFH", "MONITER_NUMBER");
  718. int iMoniterNumber = 0;
  719. int.TryParse(sMoniterNumber, out iMoniterNumber);
  720. Point location = Point.Empty;
  721. int j = 1;
  722. FormWindowState windowStateBackup;
  723. foreach (Screen sc in Screen.AllScreens) {
  724. // 출력할 모니터에 Form 을 생성하여 나타낸다
  725. if (j == iMoniterNumber) {
  726. Form parentForm = this.Parent as Form;
  727. if (parentForm != null) {
  728. windowStateBackup = parentForm.WindowState;
  729. Size size = parentForm.Bounds.Size;
  730. parentForm.WindowState = FormWindowState.Normal;
  731. parentForm.StartPosition = FormStartPosition.Manual;
  732. parentForm.ClientSize = new Size(size.Width, size.Height);
  733. parentForm.Location = new Point(sc.Bounds.Left, sc.Bounds.Top);
  734. parentForm.WindowState = windowStateBackup;
  735. }
  736. break;
  737. }
  738. j++;
  739. }
  740. }
  741. /// <summary>
  742. /// eFormViewer 컨트롤에 대한 초기화
  743. /// run option 설정
  744. /// </summary>
  745. private void InitEFormControl() {
  746. Screen screen = Screen.FromControl(this);
  747. var zoomRate = "100"; // 기본값
  748. var tempValue = hospitalWebService.getZoomRate(ConsentExecuteInfo["dutinstcd"]);
  749. if (!string.IsNullOrEmpty(tempValue)) {
  750. zoomRate = tempValue;
  751. }
  752. if (screen.Primary) {
  753. //this.eFormViewerCtrl.SetRunOption("DEFAULT_ZOOM_RATE", "pagewidth");
  754. this.eFormViewerCtrl.SetRunOption("DEFAULT_ZOOM_RATE", zoomRate);
  755. }
  756. else {
  757. this.eFormViewerCtrl.SetRunOption("DEFAULT_ZOOM_RATE", "pagewidth");
  758. }
  759. string apiResult = string.Empty;
  760. string[] penOtps = null;
  761. //string alpathHexValue = "127"; // 기본 투명도
  762. string widthValue = "9"; // 기본 굵기
  763. System.Drawing.Color color = Color.FromArgb(127, 255, 255, 1); // 기본색
  764. if (hospitalWebService != null) {
  765. apiResult = hospitalWebService.getPenOptions(ConsentExecuteInfo["dutinstcd"]);
  766. if (apiResult.Length > 0) {
  767. penOtps = apiResult.Split(',');
  768. int alpha = Convert.ToInt32(penOtps[1]);
  769. int MULTI_CONST = 254;
  770. int MULTI_PEPRC = 100;
  771. string hexValue = penOtps[0].Replace("#", "");
  772. color = Color.FromArgb(Convert.ToInt32(penOtps[1]),
  773. Convert.ToInt32(hexValue.Substring(0, 2), 16),
  774. Convert.ToInt32(hexValue.Substring(2, 2), 16),
  775. Convert.ToInt32(hexValue.Substring(4, 2), 16));
  776. //color = System.Drawing.ColorTranslator.FromHtml(penOtps[0]);
  777. widthValue = penOtps[2];
  778. }
  779. }
  780. //this.eFormViewerCtrl.SetRunOption("ENABLE_DEBUG_VIEW", "true");
  781. //this.eFormViewerCtrl.SetRunOption("DEFAULT_TOOL_BAR_VISIBLE", "true");
  782. this.eFormViewerCtrl.SetRunOption("USE_CREDITCARD_SIGNPAD", "false");
  783. this.eFormViewerCtrl.SetRunOption("DEFAULT_TOOL_BAR_VISIBLE", "false");
  784. this.eFormViewerCtrl.SetRunOption("SET_EXTERNAL_CONTROL_DEFINED_PATH", this.PluginExecuteInfo["formServiceUrl"]);
  785. this.eFormViewerCtrl.SetRunOption("USE_EITHER_SIDE_MOVE_BUTTON", "true");
  786. this.eFormViewerCtrl.SetRunOption("DUALVIEWER_TOOL_BAR_SIZE", "32");
  787. var penStrValue = "{ \"width\":\"" + widthValue
  788. + "\",\"color\":{ \"a\":\""
  789. + color.A.ToString() + "\", \"r\":\""
  790. + color.R.ToString() + "\", \"g\":\""
  791. + color.G.ToString() + "\", \"b\":\""
  792. + color.B.ToString() + "\"} }";
  793. // dbs227, 경북대학교병원 옵션, 형광펜 색으로
  794. this.eFormViewerCtrl.SetRunOption("DRAWING_PEN", "{ \"width\":\"" + widthValue
  795. + "\",\"color\":{ \"a\":\""
  796. + color.A.ToString() + "\", \"r\":\""
  797. + color.R.ToString() + "\", \"g\":\""
  798. + color.G.ToString() + "\", \"b\":\""
  799. + color.B.ToString() + "\"} }");
  800. this.eFormViewerCtrl.SetRunOption("SET_VISIBLE_BUTTONS", "PAGE_ATTACH=true");
  801. this.eFormViewerCtrl.SetRunOption("IMAGE_SAVE_OPTION", "{\"dpi\":\"150\",\"gray\":\"false\",\"encode\":\"jpeg\",\"base-index\":\"1\",\"quality\":\"100\"}");
  802. // dbs227, 경북대학교병원 요청사항
  803. // 마우스 우클릭 그리기 모드 변경
  804. this.eFormViewerCtrl.SetRunOption("SET_MOUSE_RIGHT_CHANGE_MODE", "Drawing");
  805. // true 로 설정 시 TabPoint 프로그램을 통한 듀얼 모니터 제어
  806. // false 로 설정 시 윈도우 드라이버로 듀얼 보니터 제어
  807. //this.eFormViewerCtrl.SetRunOption("USE_DUALVIEWER_ACU", "true");
  808. // V2 버전 런 옵션
  809. this.eFormViewerCtrl.SetRunOption("RUN_AS_REPOSITORY_V2", "true");
  810. if (HasVerticalMonitor) {
  811. this.eFormViewerCtrl.SetRunOption("RUN_AS_DUALVIEWER", "CLIP.eForm.DualViewer.dll");
  812. // this.eFormViewerCtrl.SetRunOption("READ_ONLY", "true");
  813. this.eFormViewerCtrl.SetRunOption("DUALVIEWER_TO_ACTIVATE_CONTROLS", "true");
  814. this.eFormViewerCtrl.SetRunOption("SET_VISIBLE_DUALVIEWER_TOOLSTRIP_MENU", "false");
  815. this.eFormViewerCtrl.SetRunOption("DUALVIEWER_TOOL_BAR_ENABLE", "true");
  816. // 툴바 위치 조절(true : 상단, false : 하단)
  817. this.eFormViewerCtrl.SetRunOption("USE_DUALVIEWER_TOOL_BAR_TOP", "false");
  818. // 가상키보드 사용 여부
  819. this.eFormViewerCtrl.SetRunOption("DUALVIEWER_VIRTUAL_KEYBOARD_VISIBLE", "true");
  820. // 관리자 권한 실행 저장 여부
  821. this.eFormViewerCtrl.SetRunOption("USE_ADMIN_PRIVILEGES_SAVE_EXECUTE", "false");
  822. this.eFormViewerCtrl.SetRunOption("DUALVIEWER_RESOLUTION", "{\"width\":\"768\",\"height\":\"1024\"}");
  823. }
  824. }
  825. /// <summary>
  826. /// Invokes the delayed load event.
  827. /// </summary>
  828. private void InvokeDelayedLoadEvent() // TODO: 리팩터링 대상 comment by jchong 2016.06.11
  829. {
  830. if (this.OnLoadPartControls != null) {
  831. Application.DoEvents();
  832. Thread.Sleep(1);
  833. OnLoadPartControls.Invoke(this, new EventArgs());
  834. }
  835. }
  836. /// <summary>
  837. /// </summary>
  838. /// <param name="msg">A <see cref="T:System.Windows.Forms.Message" />, passed by reference, that represents the window message to process.</param>
  839. /// <param name="keyData">One of the <see cref="T:System.Windows.Forms.Keys" /> values that represents the key to process.</param>
  840. /// <returns>
  841. /// true if the character was processed by the control; otherwise, false.
  842. /// </returns>
  843. protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
  844. if (msg.Msg == 0x100) {
  845. if (keyData == Keys.PageUp) {
  846. this.eFormViewerCtrl.MovePrevPage();
  847. }
  848. if (keyData == Keys.Next) {
  849. this.eFormViewerCtrl.MoveNextPage();
  850. }
  851. }
  852. return base.ProcessCmdKey(ref msg, keyData);
  853. }
  854. /// <summary>
  855. /// Consents the main control UI update on drawing.
  856. /// </summary>
  857. /// <param name="sender">The sender.</param>
  858. /// <param name="undoStackCount">The undo stack count.</param>
  859. /// <param name="redoStackCount">The redo stack count.</param>
  860. /// <param name="totalStrokeCount">The total stroke count.</param>
  861. /// <param name="totalAllPageStrokeCoun">The total all page stroke coun.</param>
  862. void ConsentMainControl_UIUpdateOnDrawing(object sender, int undoStackCount, int redoStackCount, int totalStrokeCount, int totalAllPageStrokeCoun) {
  863. if (undoStackCount > 0) {
  864. this.consentCommandCtrl.EnableUndo = true;
  865. }
  866. else {
  867. this.consentCommandCtrl.EnableUndo = false;
  868. }
  869. if (redoStackCount > 0) {
  870. this.consentCommandCtrl.EnableRedo = true;
  871. }
  872. else {
  873. this.consentCommandCtrl.EnableRedo = false;
  874. }
  875. if (totalStrokeCount > 0) {
  876. this.consentCommandCtrl.EnableRemoveAll = true;
  877. }
  878. else {
  879. this.consentCommandCtrl.EnableRemoveAll = false;
  880. }
  881. }
  882. ConsentListCtrlBase IConsentMain.ConsentListCtrl {
  883. get { return this.consentListCtrl; }
  884. }
  885. PatientInfoCtrlBase IConsentMain.PatientInfoCtrl {
  886. get { return this.patientInfoCtrl; }
  887. }
  888. PatientListCtrlBase IConsentMain.PatientListCtrl {
  889. get { return this.patientListCtrl; }
  890. }
  891. Dictionary<string, string> IConsentMain.ConsentExecuteInfo {
  892. get {
  893. return this.ConsentExecuteInfo;
  894. }
  895. set {
  896. this.ConsentExecuteInfo = value;
  897. }
  898. }
  899. Dictionary<string, string> IConsentMain.PluginExecuteInfo {
  900. get {
  901. return this.PluginExecuteInfo;
  902. }
  903. set {
  904. this.PluginExecuteInfo = value;
  905. }
  906. }
  907. ConsentCommandCtrlBase IConsentMain.ConsentCommandCtrl {
  908. get {
  909. return this.consentCommandCtrl;
  910. }
  911. }
  912. void IConsentMain.changeInDd(string inDd) {
  913. consentListCtrl.changeInDd(inDd);
  914. }
  915. public Dictionary<string, object> ProcessResultValue {
  916. get {
  917. return processResultValues;
  918. }
  919. }
  920. /// <summary>
  921. /// 환자 정보가 바뀌었을때 컨트롤들의 정보를 재조회
  922. /// </summary>
  923. /// <param name="visitType">Type of the visit.</param>
  924. void IConsentMain.UIControlsRefeash(string visitType) {
  925. this.patientInfoCtrl.OnRefeashPartControls(visitType);
  926. this.consentListCtrl.OnRefeashPartControls();
  927. }
  928. /// <summary>
  929. /// 사용자 정보 변경
  930. /// </summary>
  931. /// <param name="pInstCd">근무지기관코드</param>
  932. /// <param name="pUserId">사용자ID</param>
  933. /// <param name="DutPlceCd">근무지부서</param>
  934. void IConsentMain.SetConsentUserInfo(string pInstCd, string pUserId, string DutPlceCd) {
  935. this.patientInfoCtrl.SetConsentUserInfo(pUserId, pInstCd, DutPlceCd);
  936. }
  937. void IConsentMain.SetConsentUserInfo(string pInstCd, string pUserId, string DutPlceCd, string temp) {
  938. this.patientInfoCtrl.SetConsentUserInfo(pUserId, pInstCd, DutPlceCd);
  939. }
  940. void IConsentMain.ClearPreviewConsent(bool pDoInit) {
  941. consentCommandCtrl.CurrentPreviewConsent = null;
  942. patientInfoCtrl.SetConsentDocumentName("");
  943. if (pDoInit) {
  944. eFormViewerCtrl.Visible = false;
  945. eFormViewerCtrl.CloseDualViewer();
  946. //eFormViewerCtrl.ReInitializeViewer();
  947. imageViewCtrl1.Hide();
  948. }
  949. }
  950. void IConsentMain.PreviewConsent(string fos) {
  951. this.pnlCommand.Visible = true;
  952. this.pnlViewer.Visible = false;
  953. this.eFormViewerCtrl.Visible = true;
  954. //this.eFormViewerCtrl.SetRunOption("RUN_AS_REPOSITORY_V2", "true");
  955. this.eFormViewerCtrl.OpenFos(fos);
  956. }
  957. void IConsentMain.ClearConsent() {
  958. this.pnlCommand.Visible = true;
  959. this.pnlViewer.Visible = false;
  960. this.eFormViewerCtrl.Visible = true;
  961. this.eFormViewerCtrl.Open();
  962. }
  963. void IConsentMain.ReviewConsent() {
  964. this.pnlCommand.Visible = false;
  965. this.pnlViewer.Visible = true;
  966. this.eFormViewerCtrl.Visible = false;
  967. eFormViewerCtrl.CloseDualViewer();
  968. }
  969. void IConsentMain.RunConsentDualView() {
  970. this.eFormViewerCtrl.OpenDualViewer();
  971. }
  972. /// <summary>
  973. /// Prints the consent document.
  974. /// 수동으로 찾아서출력
  975. /// 일반 출력의 경우에도 기본프린터로 바로 출력하는 것으로 변경됨
  976. /// </summary>
  977. /// <param name="fos">The fos.</param>
  978. void IConsentMain.PrintConsentDocument(string fos) {
  979. //int rid = -1;
  980. if (!string.IsNullOrEmpty(fos)) {
  981. this.eFormViewerCtrl.OpenFos(fos);
  982. // dbs227 DB 기록 필요
  983. //rid = this.consentCommandCtrl.SaveDataForPrintedConsent(String.Empty);
  984. }
  985. this.printSaveStatus = false;
  986. int iPrntCnt = 0;
  987. //PC 클라이언트에서 출력 버튼 눌럿을때를 구분하여 pageCount넘겨줌
  988. //pageCount를 넘겨주지 않고 consentCommandCtrl.CurrentPreviewConsent.PrntCnt에서 출력 장수를 받았을때 초기화되어 익셉션 발생
  989. if (printButtonClick) {
  990. iPrntCnt = pageCnt;
  991. printButtonClick = false;
  992. }
  993. else {
  994. iPrntCnt = consentCommandCtrl.CurrentPreviewConsent.prntCnt;
  995. }
  996. this.multiPrintPlanCnt = iPrntCnt;
  997. this.multiPrintExecCnt = 0;
  998. this.checkAutoPrint = false; //수동출력
  999. if (iPrntCnt > 0) {
  1000. // 출력매수만큼 동의서 출력
  1001. //for (int i = 0; i < iPrntCnt; i++)
  1002. //{
  1003. // if((i+1) == iPrntCnt) this.printSaveStatus = true;
  1004. this.printSaveStatus = true;
  1005. this.eFormViewerCtrl.PrintByPrinterName("");
  1006. //}
  1007. }
  1008. this.printSaveStatus = false;
  1009. // dbs227,
  1010. // 출력 모드가 아닐때는 초기화 하지 않는다.
  1011. //if (rid > 0)
  1012. //{
  1013. // this.consentListCtrl.InquiryConsentData(rid);
  1014. //}
  1015. }
  1016. /// <summary>
  1017. /// 기본프린터로 출력, Agent에서 직접출력
  1018. /// dbs227, 경북대학교병원 사용하지 않음
  1019. /// </summary>
  1020. /// <param name="fos">출력할 FOS string</param>
  1021. void IConsentMain.PrintDirect(string fos) {
  1022. if (!string.IsNullOrEmpty(fos)) {
  1023. // dbs227 DB 기록 필요
  1024. //this.consentCommandCtrl.SaveDataForPrintedConsent(String.Empty);
  1025. this.eFormViewerCtrl.OpenFos(fos);
  1026. //this.consentCommandCtrl.SaveDataForPrintedConsent(String.Empty);
  1027. }
  1028. int prntCnt = 0;
  1029. prntCnt = consentCommandCtrl.CurrentPreviewConsent.prntCnt;
  1030. this.checkAutoPrint = true;//자동출력
  1031. if (!string.IsNullOrEmpty(this.ConsentExecuteInfo["printList"])) {
  1032. if (!ConsentExecuteInfo["prntCnt"].Equals("-1")) {
  1033. int.TryParse(this.ConsentExecuteInfo["prntCnt"].ToString(), out prntCnt);
  1034. }
  1035. }
  1036. this.multiPrintPlanCnt = prntCnt;
  1037. this.multiPrintExecCnt = 0;
  1038. if (prntCnt > 0) {
  1039. //this.printSaveStatus = false;
  1040. //// 출력매수만큼 동의서 출력
  1041. //for (int i = 0; i < prntCnt; i++)
  1042. //{
  1043. // if ((i + 1) == prntCnt) this.printSaveStatus = true;
  1044. this.printSaveStatus = true;
  1045. //기본프린터로 바로 출력하기로 함
  1046. this.eFormViewerCtrl.PrintByPrinterName("");
  1047. //}
  1048. //this.printSaveStatus = false;
  1049. }
  1050. }
  1051. void IConsentMain.MoveFirstPage() {
  1052. this.eFormViewerCtrl.MoveFirstPage();
  1053. }
  1054. void IConsentMain.MovePrevPage() {
  1055. this.eFormViewerCtrl.MovePrevPage();
  1056. }
  1057. void IConsentMain.MoveNextPage() {
  1058. this.eFormViewerCtrl.MoveNextPage();
  1059. }
  1060. void IConsentMain.MoveLastPage() {
  1061. this.eFormViewerCtrl.MoveLastPage();
  1062. }
  1063. void IConsentMain.Save() {
  1064. this.eFormViewerCtrl.Save();
  1065. }
  1066. /// <summary>
  1067. /// eFormViewerCtrl 컨트롤의 TempSave 이벤트를 호출
  1068. /// </summary>
  1069. void IConsentMain.TempSave() {
  1070. this.eFormViewerCtrl.TempSave();
  1071. }
  1072. int IConsentMain.GetCurrentPageIndex() {
  1073. return this.eFormViewerCtrl.GetCurrentPageIndex();
  1074. }
  1075. int IConsentMain.GetTotalPageCount() {
  1076. return this.eFormViewerCtrl.GetTotalPageCount();
  1077. }
  1078. void IConsentMain.MoveToPageIndex(int pageIndex) {
  1079. this.eFormViewerCtrl.MoveToPageIndex(pageIndex);
  1080. }
  1081. void IConsentMain.SetZoomRate(string zoomRate) {
  1082. this.eFormViewerCtrl.SetZoomRate(zoomRate);
  1083. }
  1084. void IConsentMain.EnableDrawing(bool enable) {
  1085. this.eFormViewerCtrl.EnableDrawing(enable);
  1086. }
  1087. bool IConsentMain.IsDrawMode() {
  1088. return this.eFormViewerCtrl.IsDrawMode();
  1089. }
  1090. void IConsentMain.RemoveAllDrawing() {
  1091. this.eFormViewerCtrl.RemoveAllDrawing();
  1092. }
  1093. void IConsentMain.UndoDrawing() {
  1094. this.eFormViewerCtrl.UndoDrawing();
  1095. }
  1096. void IConsentMain.RedoDrawing() {
  1097. this.eFormViewerCtrl.RedoDrawing();
  1098. }
  1099. void IConsentMain.ConfigDrawingPen() {
  1100. this.eFormViewerCtrl.ConfigDrawingPen();
  1101. }
  1102. void IConsentMain.SetFingerScanValue(string controlId, string base64Image) {
  1103. this.eFormViewerCtrl.SetFingerPrintImage(controlId, base64Image, true);
  1104. }
  1105. void IConsentMain.SetSignatureImage(string controlId, string base64Image) {
  1106. this.eFormViewerCtrl.SetSignatureImage(controlId, base64Image, true);
  1107. }
  1108. public CLIP.eForm.ImageView.ImageViewCtrl GetImageViewerCtrl() {
  1109. return this.imageViewCtrl1;
  1110. }
  1111. void IConsentMain.CloseSignaturePopup(string controlId) {
  1112. this.eFormViewerCtrl.CloseSignaturePopup(controlId);
  1113. }
  1114. void IConsentMain.SetRunOption(string optionKey, string optionValue) {
  1115. this.eFormViewerCtrl.SetRunOption(optionKey, optionValue);
  1116. }
  1117. void IConsentMain.TerminateConsentMain() {
  1118. if (this.Parent is System.Windows.Forms.Form) {
  1119. ((Form)this.Parent).DialogResult = DialogResult.Cancel;
  1120. ((Form)this.Parent).Close();
  1121. }
  1122. }
  1123. /// <summary>
  1124. /// 첨지 삭제
  1125. /// </summary>
  1126. void IConsentMain.DeleteAttach() {
  1127. this.eFormViewerCtrl.DeleteAttach();
  1128. }
  1129. /// <summary>
  1130. /// 첨지 추가
  1131. /// </summary>
  1132. void IConsentMain.InsertAttach() {
  1133. this.eFormViewerCtrl.InsertAttach();
  1134. }
  1135. /// <summary>
  1136. /// 환자정보 설정
  1137. /// </summary>
  1138. void IConsentMain.SetPatientInfo() {
  1139. this.patientInfoCtrl.SetPatientInfo();
  1140. }
  1141. /// <summary>
  1142. /// Closes the dual viewer.
  1143. /// </summary>
  1144. public void CloseDualViewer() {
  1145. this.eFormViewerCtrl.CloseDualViewer();
  1146. this.consentCommandCtrl.SetEnableConsentIssueCommands(true);
  1147. this.consentCommandCtrl.SetEnableButtonsByCurrentConsent();
  1148. }
  1149. /// <summary>
  1150. /// 서명 시 이미지 파일 생성 된 후 호출
  1151. /// </summary>
  1152. /// <param name="value">저장 이미지 파일 설명</param>
  1153. private void OnWrittenImageFile(string value) {
  1154. this.consentCommandCtrl.WorkExtraWithSavedImageFiles(value);
  1155. }
  1156. /// <summary>
  1157. /// Called when [written data XML file].
  1158. /// </summary>
  1159. /// <param name="value">The value.</param>
  1160. private void OnWrittenDataXmlFile(string value) {
  1161. string dataXmlValue = string.Empty;
  1162. if (!string.IsNullOrEmpty(value)) {
  1163. XmlDocument xmlDocument = new XmlDocument();
  1164. xmlDocument.Load(value);
  1165. dataXmlValue = xmlDocument.InnerXml;
  1166. outputDataDic = new Dictionary<string, string>();
  1167. XmlNode rootNode = xmlDocument.SelectSingleNode("form-data");
  1168. foreach (XmlNode childNode in rootNode.ChildNodes) {
  1169. string fieldName = string.Empty;
  1170. string fieldValue = string.Empty;
  1171. XmlElement outFieldElement = childNode as XmlElement;
  1172. if (outFieldElement != null) {
  1173. fieldName = outFieldElement.Name;
  1174. if (outFieldElement.ChildNodes.Count > 0
  1175. && outFieldElement.ChildNodes[0] is XmlCDataSection) {
  1176. fieldValue = ((XmlCDataSection)outFieldElement.ChildNodes[0]).InnerText;
  1177. }
  1178. if (outputDataDic.ContainsKey(fieldName)) {
  1179. outputDataDic[fieldName] = fieldValue;
  1180. }
  1181. else {
  1182. outputDataDic.Add(fieldName, fieldValue);
  1183. }
  1184. }
  1185. }
  1186. if (processResultValues.ContainsKey("OUTPUT_VALUES")) {
  1187. processResultValues["OUTPUT_VALUES"] = outputDataDic;
  1188. }
  1189. else {
  1190. processResultValues.Add("OUTPUT_VALUES", outputDataDic);
  1191. }
  1192. }
  1193. try {
  1194. SingleReturnData returnData = this.consentWebService.CheckConsentState(int.Parse(consentCommandCtrl.CurrentPreviewConsent.consentMstRid), consentCommandCtrl.CurrentPreviewConsent.consentStateEng);
  1195. //int state = this.consentWebService.CheckConsentState(int.Parse(consentCommandCtrl.CurrentPreviewConsent.ConsentMstRid), consentCommandCtrl.CurrentPreviewConsent.ConsentState);
  1196. int state = Int32.Parse(returnData.responseData);
  1197. if (state == 1) {
  1198. MessageBoxDlg.Show(this, "이미 저장된 서식 입니다."
  1199. , string.Format(Properties.Resources.msg_caption_confirm),
  1200. MessageBoxButtons.OK, MessageBoxIcon.Information);
  1201. return;
  1202. }
  1203. string eptXmlValue = this.eFormViewerCtrl.GetTempSaveForm();
  1204. // Gzip -> BASE64 을 통하여 압축하여 인증저장 한다
  1205. eptXmlValue = Convert.ToBase64String(Common.Zip(eptXmlValue));
  1206. bool isSaved = this.consentCommandCtrl.SaveCompleteConsentData(eptXmlValue, dataXmlValue, out object saveResult);
  1207. if (processResultValues.ContainsKey("OTHER_VALUE_1")) {
  1208. processResultValues["OTHER_VALUE_1"] = saveResult;
  1209. }
  1210. else {
  1211. processResultValues.Add("OTHER_VALUE_1", saveResult);
  1212. }
  1213. if (isSaved) {
  1214. if (ProcessResult != null) {
  1215. ProcessResult.Invoke("SUCCESS");
  1216. }
  1217. }
  1218. else {
  1219. ProcessResult.Invoke("FAIL");
  1220. }
  1221. }
  1222. catch (Exception ex) {
  1223. System.Diagnostics.Trace.WriteLine(string.Format("CLIP.eForm error: {0}", ex.Message));
  1224. MessageBoxDlg.Show(true, string.Format(ex.Message)
  1225. , string.Format(Properties.Resources.msg_caption_fail),
  1226. MessageBoxButtons.OK, MessageBoxIcon.Error);
  1227. initConsent();
  1228. ProcessResult.Invoke("FAIL");
  1229. }
  1230. finally {
  1231. if (multiParams == null) {
  1232. this.eFormViewerCtrl.CloseDualViewer();
  1233. }
  1234. }
  1235. }
  1236. private void OnWrittenTempSaveFile(string value) {
  1237. XmlDocument xmlDocument = new XmlDocument();
  1238. xmlDocument.Load(value);
  1239. string eptXmlValue = xmlDocument.InnerXml;
  1240. try {
  1241. string dataXml = this.eFormViewerCtrl.GetDataXml();
  1242. // Gzip -> BASE64 을 통하여 압축하여 임시저장 한다
  1243. string encFormXml = Convert.ToBase64String(Common.Zip(eptXmlValue));
  1244. consentCommandCtrl.SaveTempConsentData(eptXmlValue, dataXml);
  1245. }
  1246. catch (Exception ex) {
  1247. System.Diagnostics.Trace.WriteLine(string.Format("CLIP.eForm error: {0}", ex.Message));
  1248. MessageBoxDlg.Show(true, string.Format(ex.Message)
  1249. , string.Format(Properties.Resources.msg_caption_fail),
  1250. MessageBoxButtons.OK, MessageBoxIcon.Error);
  1251. initConsent();
  1252. return;
  1253. }
  1254. finally {
  1255. if (multiParams == null) {
  1256. this.eFormViewerCtrl.CloseDualViewer();
  1257. }
  1258. }
  1259. }
  1260. public void SetConsentListSplitPanelVisibility(bool visibility) {
  1261. if (!visibility) {
  1262. this.splitConsent.Panel1Collapsed = true;
  1263. }
  1264. }
  1265. public void SetPatientListSplitPanelVisibility(bool visibility) {
  1266. if (!visibility) {
  1267. this.splitPatient.Panel2Collapsed = true;
  1268. }
  1269. }
  1270. public bool UseFingerScan { get; set; }
  1271. public bool viewStatus { get; set; }
  1272. public bool IsComplete() {
  1273. bool _isComplete = false;
  1274. if (consentCommandCtrl != null && consentCommandCtrl.CurrentPreviewConsent != null) {
  1275. string _state = consentCommandCtrl.CurrentPreviewConsent.consentState ?? string.Empty;
  1276. if (_state.Equals("ELECTR_CMP")) {
  1277. _isComplete = true;
  1278. }
  1279. }
  1280. return _isComplete;
  1281. }
  1282. private void panelReview_Resize(object sender, EventArgs e) {
  1283. if (this.pnlViewer.Visible) {
  1284. if (OnResizeReviewConsent != null) {
  1285. OnResizeReviewConsent.Invoke(this, new EventArgs());
  1286. }
  1287. }
  1288. }
  1289. /// <summary>
  1290. /// 동의서 뷰어 컨트롤 OnError 이벤트 핸들러
  1291. /// </summary>
  1292. /// <param name="errorCode">에러코드</param>
  1293. /// <param name="errorMessage">에러 메시지</param>
  1294. private void eFormViewerCtrl_OnError(string errorCode, string errorMessage) {
  1295. }
  1296. /// <summary>
  1297. /// 동의서 뷰어 컨트롤 OnProcess 이벤트 핸들러
  1298. /// </summary>
  1299. /// <param name="eventCode">이벤트 코드</param>
  1300. /// <param name="value">이벤트 값</param>
  1301. private void eFormViewerCtrl_OnProcess(string eventCode, string value) {
  1302. System.Diagnostics.Trace.WriteLine(string.Format("eventCode: {0} - value: {1}", eventCode, value));
  1303. // 동의서의 현제 페이지 번호 설정
  1304. if (eventCode.Equals("PAGING")) {
  1305. this.consentCommandCtrl.OnPaging(this.eFormViewerCtrl.GetCurrentPageIndex());
  1306. }
  1307. // 듀얼 뷰어 버튼 활성화 여부 제어?
  1308. if (eventCode.Equals("DUAL_VIEWER")) {
  1309. if (value.Equals("OPEN")) {
  1310. this.consentListCtrl.Enabled = false;
  1311. this.patientInfoCtrl.Enabled = false;
  1312. this.patientListCtrl.Enabled = false;
  1313. // this.eFormViewerCtrl.SetRunOption("READ_ONLY", "false");
  1314. this.consentCommandCtrl.EnablePenDrawing = true;
  1315. this.consentCommandCtrl.EnablePenConfig = true;
  1316. if (multiParams != null) {
  1317. consentCommandCtrl.setMultiParamsDualViewrStripButton();
  1318. }
  1319. else {
  1320. this.consentCommandCtrl.SetEnablementExecuteWhenDualViewerActive(false);
  1321. }
  1322. }
  1323. if (value.Equals("CLOSE")) {
  1324. this.consentListCtrl.Enabled = true;
  1325. this.patientInfoCtrl.Enabled = true;
  1326. this.patientListCtrl.Enabled = true;
  1327. // this.eFormViewerCtrl.SetRunOption("READ_ONLY", "true");
  1328. this.consentCommandCtrl.EnablePenDrawing = false;
  1329. this.consentCommandCtrl.EnablePenConfig = false;
  1330. this.consentCommandCtrl.onEnableDrawing(false);
  1331. this.eFormViewerCtrl.EnableDrawing(false);
  1332. this.consentCommandCtrl.SetEnablementExecuteWhenDualViewerActive(true);
  1333. }
  1334. }
  1335. // 동의서 작성완료 후 이미지 저장
  1336. if (eventCode.Equals("WRITTEN_IMAGE_FILE")) {
  1337. // 확인 저장 시 이미지는 저장 함
  1338. //if (!consentCommandCtrl.IsComplete)
  1339. {
  1340. this.OnWrittenImageFile(value);
  1341. }
  1342. }
  1343. // 동의서 작성완료 후 Data XML 저장
  1344. if (eventCode.Equals("DATA_XML_PATH")) {
  1345. // [확인] 시에는 임시 저장만 한다.
  1346. //if (consentCommandCtrl.IsComplete) {
  1347. // eFormViewerCtrl.TempSave();
  1348. //}
  1349. // 작성완료 버튼이 활성화 되어 있을 경우에만 작성완료 로직을 진행한다.
  1350. //else if (this.consentCommandCtrl.getSaveButton()) {
  1351. if (this.consentCommandCtrl.getSaveButton()) {
  1352. this.consentCommandCtrl.setSaveButton(false);
  1353. this.OnWrittenDataXmlFile(value);
  1354. this.consentCommandCtrl.setSaveButton(true);
  1355. this.eFormViewerCtrl.ConfirmSave(true, "");
  1356. //정상저장 후 다중서식 작업중일 경우 다음 동의서를 로드한다
  1357. if (processResultValues.ContainsKey("OTHER_VALUE_1") && processResultValues["OTHER_VALUE_1"].ToString().Equals("1")) {
  1358. if (multiParams != null) {
  1359. showNextConsent();
  1360. }
  1361. }
  1362. }
  1363. }
  1364. // 동의서 임시저장
  1365. if (eventCode.Equals("TEMP_SAVE_PATH")) {
  1366. // 임시저장 버튼이 활성화 되어 있을 경우에만 임시저장 로직을 진행한다.
  1367. // Ku2.0 연동 시 임시저장 로직을 진행한다.
  1368. // 작성 완료 시
  1369. if (this.consentCommandCtrl.getTempSaveButton() || ConsentExecuteInfo["printYN"].Equals("Y") || consentCommandCtrl.IsComplete) {
  1370. this.consentCommandCtrl.setTempSaveButton(false);
  1371. this.OnWrittenTempSaveFile(value);
  1372. if (!consentCommandCtrl.IsComplete) {
  1373. this.consentCommandCtrl.setTempSaveButton(true);
  1374. }
  1375. this.eFormViewerCtrl.ConfirmSave(true, "");
  1376. }
  1377. //다중서식 작업중일 경우 다음 동의서를 출력한다
  1378. if (multiParams != null) {
  1379. showNextConsent();
  1380. }
  1381. }
  1382. // 동의서 종이 출력
  1383. if (eventCode.Equals("PRINT_COMPLETE")) {
  1384. //this.consentCommandCtrl.OnPrint(value);
  1385. // dbs227, 출력 로그 업데이트
  1386. // 출력을 위한 호출일 경우 form 을 종료한다
  1387. if (printConsentCount == 0 && ConsentExecuteInfo["printYN"].Equals("Y")) {
  1388. Form parentForm = this.Parent as Form;
  1389. if (parentForm != null) {
  1390. parentForm.Close();
  1391. }
  1392. }
  1393. }
  1394. // dbs227, 동의서 프린트 실패
  1395. if (eventCode.Equals("PRINT_FAIL") || eventCode.Equals("PRINT_CANCEL")) {
  1396. // 추후 업무 협의 후 진행
  1397. //consentCommandCtrl.erasePrintHistory();
  1398. }
  1399. //필수 항목 누락시 메시지 박스 호출
  1400. if (eventCode.Equals("REQUIRED_INPUT_VIOLATION")) {
  1401. this.consentCommandCtrl.OnRequiredInputViolation(value);
  1402. }
  1403. // 펜 그리기 모드 활성화 여부 제어
  1404. if (eventCode.Equals("ENABLE_DRAWING")) {
  1405. if (value.Equals("TRUE")) {
  1406. this.consentCommandCtrl.onEnableDrawing(true);
  1407. }
  1408. else if (value.Equals("FALSE")) {
  1409. this.consentCommandCtrl.onEnableDrawing(false);
  1410. }
  1411. }
  1412. // 초기화 상태
  1413. if (eventCode.Equals("INITIALIZE_STATE")) {
  1414. if (value.Equals("FormViewInitialized")) {
  1415. viewStatus = true;
  1416. }
  1417. }
  1418. // 그외 이벤트
  1419. // 동의서 저장 버튼 활셩화여부 제어
  1420. // 동의서 임시서장 버튼 활성화 여부 반환(get)
  1421. // 동의서 임시저장 버튼 활성화 여부 제어(set)
  1422. }
  1423. private void eFormViewerCtrl_VisibleChanged(object sender, EventArgs e) {
  1424. if (this.eFormViewerCtrl.Visible) {
  1425. if (this.OnVisibleEFormControl != null) {
  1426. this.OnVisibleEFormControl.Invoke(this, new EventArgs());
  1427. }
  1428. }
  1429. else {
  1430. if (this.OnInvisibleEFormControl != null) {
  1431. this.OnInvisibleEFormControl.Invoke(this, new EventArgs());
  1432. }
  1433. }
  1434. }
  1435. /// <summary>
  1436. /// startFormCd 를 초기화 한다
  1437. /// </summary>
  1438. public void preParamClean() {
  1439. this.ConsentExecuteInfo["startFormCd"] = string.Empty;
  1440. }
  1441. void IConsentMain.ReInitializeViewer() {
  1442. if (eFormViewerCtrl.GetTotalPageCount() > 0) {
  1443. eFormViewerCtrl.Visible = false;
  1444. eFormViewerCtrl.CloseDualViewer();
  1445. //this.eFormViewerCtrl.ReInitializeViewer();
  1446. }
  1447. this.viewStatus = false;
  1448. }
  1449. public void OnProcessCmdKey(Keys keyData) {
  1450. }
  1451. /// <summary>
  1452. /// OCX 에서 넘겨 받은 FORMCD 리스트를 서버에서 조회해 온다
  1453. /// </summary>
  1454. private void GetConsentListByFormcd() {
  1455. try {
  1456. string[] formCdArr = ConsentExecuteInfo["formCd"].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
  1457. string[] ocrTagArr = ConsentExecuteInfo["ocrTag"].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
  1458. printConsentCount = formCdArr.Length;
  1459. for (int i = 0; i < formCdArr.Length; i++) {
  1460. // 서버에서 목록 조회
  1461. ConsentVO vo = consentWebService.GetConsentByFormcd(formCdArr[i]
  1462. , ConsentExecuteInfo["dutinstcd"]);
  1463. if (vo == null/* || voArr.Length < 1*/) {
  1464. throw new Exception("지정된 동의서를 찾을 수 없습니다.");
  1465. }
  1466. //ConsentBySearchVO vo = voArr[0];
  1467. // 현재 preview 할동의서 정보 설정
  1468. consentCommandCtrl.CurrentPreviewConsent = new PreviewConsent();
  1469. consentCommandCtrl.CurrentPreviewConsent.formId = vo.formId.ToString();
  1470. consentCommandCtrl.CurrentPreviewConsent.formCd = vo.formCd.ToString();
  1471. consentCommandCtrl.CurrentPreviewConsent.formName = vo.formName;
  1472. consentCommandCtrl.CurrentPreviewConsent.formPrintName = vo.formPrintName;
  1473. consentCommandCtrl.CurrentPreviewConsent.prntCnt = vo.prntCnt;
  1474. consentCommandCtrl.CurrentPreviewConsent.consentMstRid = "-1";
  1475. consentCommandCtrl.CurrentPreviewConsent.consentState = string.Empty;
  1476. consentCommandCtrl.CurrentPreviewConsent.inputId = consentCommandCtrl.CurrentEndUser.UserNo;
  1477. consentCommandCtrl.CurrentPreviewConsent.inputNm = consentCommandCtrl.CurrentEndUser.UserName;
  1478. consentCommandCtrl.CurrentPreviewConsent.ReissueConsentMstRid = 0;
  1479. consentCommandCtrl.CurrentPreviewConsent.RewriteConsentMstRid = 0;
  1480. consentCommandCtrl.CurrentPreviewConsent.ocrtagPrntyn = vo.ocrTagYN;
  1481. consentCommandCtrl.CurrentPreviewConsent.printOnly = vo.prntOnly;
  1482. consentCommandCtrl.CurrentPreviewConsent.opDiagName = vo.opDiagName;
  1483. consentCommandCtrl.CurrentPreviewConsent.opName = vo.opName;
  1484. consentCommandCtrl.CurrentPreviewConsent.drOnly = vo.DrOnly;
  1485. consentCommandCtrl.CurrentPreviewConsent.userDrFlag = vo.userDrFlag;
  1486. // 출력 연동이 아닌 경우
  1487. if (ConsentExecuteInfo["printYN"].Equals("N")) {
  1488. Dictionary<FOSParameter, string> globalParams = Common.CreateGlobalParamsDictionary(ConsentExecuteInfo["dutinstcd"]);
  1489. List<string> formGuids = new List<string> { };
  1490. consentCommandCtrl.SetPatientAndUser(globalParams);
  1491. if (ocrTagArr.Length > 0) {
  1492. globalParams[FOSParameter.OCRCode] = consentCommandCtrl.CurrentPreviewConsent.ocrCode = ocrTagArr[i]; // OCR 코드
  1493. }
  1494. else {
  1495. globalParams[FOSParameter.OCRCode] = consentCommandCtrl.CurrentPreviewConsent.ocrCode = consentCommandCtrl.GetOcrCode(); // OCR 코드
  1496. }
  1497. int cnt = hospitalWebService.checkOcrDup(ConsentExecuteInfo["dutinstcd"], consentCommandCtrl.CurrentPreviewConsent.ocrCode);
  1498. if (cnt > 0) {
  1499. MessageBox.Show("OCRTAG 중복 발생입니다. 환자를 다시 선택하여 주십시요.");
  1500. return;
  1501. }
  1502. // 임시저장의 경우 C 로 설정
  1503. globalParams[FOSParameter.Device] = "C";
  1504. globalParams[FOSParameter.PrintTime] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  1505. globalParams[FOSParameter.SignTime] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  1506. globalParams[FOSParameter.PrintIp] = ConsentExecuteInfo["printIP"];
  1507. //string fos = Common.GetFosString(formGuids
  1508. // , PluginExecuteInfo["formServiceUrl"]
  1509. // , globalParams
  1510. // , null
  1511. // , ConsentExecuteInfo["dutinstcd"]);
  1512. string fos = Common.getNewFosString(PluginExecuteInfo["formServiceUrl"],
  1513. globalParams,
  1514. null,
  1515. new List<String> { consentCommandCtrl.CurrentPreviewConsent.formId });
  1516. // TODO 원무 인증 저장 pass
  1517. // 원무 동의서는 인증저장을 하지 않는다
  1518. shouldPassCertify = (this.consentWebService.getCertUseYn(consentCommandCtrl.CurrentPreviewConsent.formCd,
  1519. ConsentExecuteInfo["dutinstcd"]) == "Y") ? true : false;
  1520. // KU 시스템 연계시 동의서 종류와 상관 없이 인증버튼 활성화
  1521. //if (shouldPassCertify)
  1522. {
  1523. // 인증저장 버튼을 활성화 한다
  1524. consentCommandCtrl.SetEnableButtonsByCurrentConsent();
  1525. //consentCommandCtrl.setSaveButton(true);
  1526. }
  1527. // 동의서 열기
  1528. eFormViewerCtrl.OpenFos(fos);
  1529. // 출력 히스토리 기록
  1530. //this.consentCommandCtrl.OnPrint(vo.FormPrintName);
  1531. //------------------------------
  1532. // TODO 자동 듀얼뷰어 실행
  1533. //Boolean openDualView = false;
  1534. Boolean openDualView = (this.consentWebService.getDualViewMode(ConsentExecuteInfo["dutinstcd"],
  1535. ConsentExecuteInfo["ipaddr"]) == "Y") ? true : false;
  1536. if (openDualView) {
  1537. if (!eFormViewerCtrl.Visible) {
  1538. eFormViewerCtrl.Visible = true;
  1539. }
  1540. consentCommandCtrl.RunConsentDualView();
  1541. }
  1542. //-------------------------------
  1543. // dbs227 원무 인증 저장 pass
  1544. if (shouldPassCertify) {
  1545. //this.eFormViewerCtrl.SetZoomRate("wholepage");
  1546. //consentCommandCtrl.setZoomRate(5);
  1547. }
  1548. if (ConsentExecuteInfo["tempSave"].Equals("N")) { // 지정된 동의서를 열기만 하는 경우
  1549. // 여러 개의 formcd 를 받더라도 첫번째 것만 보여준다
  1550. break;
  1551. }
  1552. else if (ConsentExecuteInfo["tempSave"].Equals("Y")) { // 임시 저장
  1553. // 동의서 임시저장
  1554. eFormViewerCtrl.TempSave();
  1555. }
  1556. }
  1557. // 출력 연동
  1558. if (ConsentExecuteInfo["printYN"].Equals("Y")) {
  1559. int prntCnt = consentCommandCtrl.CurrentPreviewConsent.prntCnt;
  1560. // 실행 파라미터에 PRINT_CNT 가 있고 0보다 클 경우 실행 파라미터를 우선으로 한다.
  1561. if (!string.IsNullOrEmpty(ConsentExecuteInfo["printCount"])) {
  1562. int.TryParse(ConsentExecuteInfo["printCount"], out prntCnt);
  1563. }
  1564. Dictionary<string, Dictionary<FOSParameter, string>> formParamsList = new Dictionary<string, Dictionary<FOSParameter, string>>();
  1565. string[] formGuidList = new string[prntCnt];
  1566. string sOcrCd = string.Empty;
  1567. for (int j = 0; j < prntCnt; j++) {
  1568. Dictionary<FOSParameter, string> formParams = Common.CreateGlobalParamsDictionary(ConsentExecuteInfo["dutinstcd"]);
  1569. consentCommandCtrl.SetPatientAndUser(formParams);
  1570. if (ocrTagArr.Length > 0) {
  1571. formParams[FOSParameter.OCRCode] = consentCommandCtrl.CurrentPreviewConsent.ocrCode = ocrTagArr[i];
  1572. }
  1573. else {
  1574. sOcrCd = formParams[FOSParameter.OCRCode] = consentCommandCtrl.CurrentPreviewConsent.ocrCode = consentCommandCtrl.GetOcrCode();
  1575. }
  1576. int cnt = hospitalWebService.checkOcrDup(ConsentExecuteInfo["dutinstcd"], consentCommandCtrl.CurrentPreviewConsent.ocrCode);
  1577. if (cnt > 0) {
  1578. MessageBox.Show("OCRTAG 중복 발생입니다. 환자를 다시 선택하여 주십시요.");
  1579. return;
  1580. }
  1581. // 동일 서식을 2장 있을 출력할 경우, 2장째부터는 OCR 태그가 아닌 [환자보관용] 텍스트가 출력
  1582. if (j > 0) {
  1583. var ocrStr = this.consentWebService.getOcrString(consentCommandCtrl.CurrentPreviewConsent.formCd,
  1584. ConsentExecuteInfo["dutinstcd"]);
  1585. if (ocrStr == null) {
  1586. ocrStr = "[환자 보관용]";
  1587. }
  1588. //ocrStr = (ocrStr == n) ? "[환자 보관용]" : ocrStr;
  1589. //formParams[FOSParameter.OCRCode] = "[환자 보관용]";
  1590. formParams[FOSParameter.OCRCode] = ocrStr;
  1591. }
  1592. formParams[FOSParameter.Device] = "P";
  1593. formParams[FOSParameter.PrintTime] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  1594. formParams[FOSParameter.PrintIp] = ConsentExecuteInfo["printIP"];
  1595. if (j == 1) formParams[FOSParameter.PrintComment] = Properties.Resources.msg_print_comment_2;
  1596. else if (j == 2) formParams[FOSParameter.PrintComment] = Properties.Resources.msg_print_comment_3;
  1597. //formGuidList[j] = consentCommandCtrl.CurrentPreviewConsent.formGuid;
  1598. formParamsList.Add((j + 1).ToString(), formParams);
  1599. }
  1600. //string fos = Common.GetMultiFosString(formGuidList
  1601. // , PluginExecuteInfo["formServiceUrl"]
  1602. // , null
  1603. // , formParamsList
  1604. // , ConsentExecuteInfo["dutinstcd"]);
  1605. Dictionary<FOSParameter, string> globalParams = Common.CreateGlobalParamsDictionary(ConsentExecuteInfo["dutinstcd"]);
  1606. // TODO.V2 버전 확인 필요
  1607. string fos = Common.getNewFosString(PluginExecuteInfo["formServiceUrl"],
  1608. globalParams, // 연계가 필요하다
  1609. null,
  1610. new List<String> { consentCommandCtrl.CurrentPreviewConsent.formId });
  1611. String formPrintName = formParamsList["1"][FOSParameter.FormName];
  1612. this.eFormViewerCtrl.OpenFos(fos);
  1613. // 출력 히스토리 기록
  1614. this.consentCommandCtrl.OnPrint(formPrintName);
  1615. //int testpagecnt = this.eFormViewerCtrl.GetTotalPageCount();
  1616. // dbs227, 출력 로그 업데이트
  1617. // consent_mst 기록
  1618. // InsertPrintData API 추가 후 기록
  1619. //this.consentCommandCtrl.SaveDataForPrintedConsent(String.Empty);
  1620. printConsentCount--;
  1621. this.eFormViewerCtrl.PrintByPrinterName("");
  1622. }
  1623. }
  1624. }
  1625. catch (Exception ex) {
  1626. MessageBox.Show(ex.ToString());
  1627. initConsent();
  1628. throw ex;
  1629. }
  1630. }
  1631. public void initConsent() {
  1632. consentCommandCtrl.CurrentPreviewConsent = null;
  1633. patientInfoCtrl.SetConsentDocumentName("");
  1634. eFormViewerCtrl.Visible = false;
  1635. //eFormViewerCtrl.ReInitializeViewer();
  1636. imageViewCtrl1.Hide();
  1637. }
  1638. private void btnHelp_Click(object sender, EventArgs e) {
  1639. btnHelp.Enabled = false;
  1640. Application.DoEvents();
  1641. System.Diagnostics.Process.Start(@"https://ema031.knuh.kr:9091/doc/guide.pdf");
  1642. btnHelp.Enabled = true;
  1643. }
  1644. int pageCnt = 0;
  1645. Boolean printButtonClick = false;
  1646. void IConsentMain.setPageCnt(int pageCnt) {
  1647. this.pageCnt = pageCnt;
  1648. //throw new NotImplementedException();
  1649. }
  1650. int IConsentMain.getPageCnt() {
  1651. return this.pageCnt;
  1652. //throw new NotImplementedException();
  1653. }
  1654. void IConsentMain.setPrintButton(bool flag) {
  1655. this.printButtonClick = flag;
  1656. //throw new NotImplementedException();
  1657. }
  1658. bool IConsentMain.getPrintButton() {
  1659. return this.printButtonClick;
  1660. //throw new NotImplementedException();
  1661. }
  1662. public void SendToMainControlMessage(object obj) {
  1663. throw new NotImplementedException();
  1664. }
  1665. public void OnAlreadyExistsConsentForm(ref bool closeForm) {
  1666. throw new NotImplementedException();
  1667. }
  1668. /// <summary>
  1669. /// OCX 로 부터 넘겨 받은 파라미터를 decode(연속서식)
  1670. /// </summary>
  1671. /// <param name="pCallParm">EXEC_OPT 로 넘어온 파라미터 목록</param>
  1672. /// <exception cref="Exception">CallParam 미전달</exception>
  1673. private void InitMultiParamSetting(object pCallParm) {
  1674. try {
  1675. if (pCallParm != null) {
  1676. Dictionary<string, object> callParam = pCallParm as Dictionary<string, object>;
  1677. if (callParam != null && callParam.Count < 2) {
  1678. if (callParam["CALL_PARAMS"] != null) {
  1679. pCallParm = callParam["CALL_PARAMS"] as object;
  1680. }
  1681. }
  1682. multiParams = new List<Dictionary<string, object>>();
  1683. foreach (KeyValuePair<string, object> callKV in pCallParm as Dictionary<string, object>) {
  1684. // 화면 설정 정보
  1685. // 화면 설정 정보는 한번만 받으면 되기 때문에 받자마자 전역변수에 넣어준다
  1686. if (callKV.Key != null && !string.IsNullOrEmpty(callKV.Key.ToString()) && callKV.Key.ToString() == "EXEC_OPT") {
  1687. foreach (KeyValuePair<string, object> execKV in callKV.Value as Dictionary<string, object>) {
  1688. string value = execKV.Value != null ? execKV.Value.ToString() : "";
  1689. switch (execKV.Key) {
  1690. case "USE_LIST_VIEW":
  1691. ConsentExecuteInfo["useListView"] = "N";
  1692. break;
  1693. case "PTNT_LIST_VIEW":
  1694. ConsentExecuteInfo["patientListView"] = "N";
  1695. break;
  1696. case "START_FORM_CD":
  1697. ConsentExecuteInfo["startFormCd"] = value;
  1698. break;
  1699. case "PTNT_ACT":
  1700. ConsentExecuteInfo["printAct"] = value;
  1701. break;
  1702. case "PRINT_LIST":
  1703. if (execKV.Value != null) {
  1704. if (execKV.Value is List<object> PatientList && PatientList.Count > 0) {
  1705. PrintInfoList = new List<ConsentVO>();
  1706. ConsentVO consentVO = new ConsentVO();
  1707. for (int i = 0; i < PatientList.Count; i++) {
  1708. consentVO = new ConsentVO {
  1709. prntCnt = -1
  1710. };
  1711. foreach (KeyValuePair<string, object> callOrderKV in PatientList[i] as Dictionary<string, object>) {
  1712. if (callOrderKV.Key != null && !string.IsNullOrEmpty(callOrderKV.Key.ToString()) && callOrderKV.Value != null) {
  1713. if (callOrderKV.Key.ToString() == "START_FORM_CD") consentVO.formCd = callOrderKV.Value.ToString(); // 출력 서식코드
  1714. if (callOrderKV.Key.ToString() == "PTNT_NO") consentVO.pid = callOrderKV.Value.ToString(); // 환자번호
  1715. if (callOrderKV.Key.ToString() == "VISIT_TYPE") consentVO.ordtype = callOrderKV.Value.ToString(); // 내원구분
  1716. if (callOrderKV.Key.ToString() == "CLN_DATE") consentVO.clnDate = callOrderKV.Value.ToString(); // 진료일자
  1717. if (callOrderKV.Key.ToString() == "CLN_DEPT") consentVO.clnDeptCd = callOrderKV.Value.ToString(); // 진료과
  1718. if (callOrderKV.Key.ToString() == "PRINT_CNT") {
  1719. int.TryParse(callOrderKV.Value.ToString(), out int PrntCnt);
  1720. consentVO.prntCnt = PrntCnt; // 출력 카운트
  1721. }
  1722. if (callOrderKV.Key.ToString() == "CRETNO") {
  1723. int.TryParse(callOrderKV.Value.ToString(), out int cretno);
  1724. consentVO.cretno = cretno; // 차트번호
  1725. }
  1726. }
  1727. }
  1728. PrintInfoList.Add(consentVO);
  1729. }
  1730. if (execKV.Value != null) ConsentExecuteInfo["printList"] = PrintInfoList.Count.ToString(); // 출력 데이터
  1731. }
  1732. }
  1733. break;
  1734. case "FORMCD":
  1735. ConsentExecuteInfo["formCd"] = value;
  1736. break;
  1737. case "OCRTAG":
  1738. ConsentExecuteInfo["ocrTag"] = value;
  1739. break;
  1740. case "TEMP_SAVE":
  1741. ConsentExecuteInfo["tempSave"] = value;
  1742. break;
  1743. case "PRINT_YN":
  1744. ConsentExecuteInfo["printYN"] = value;
  1745. break;
  1746. case "PRINT_CNT":
  1747. ConsentExecuteInfo["printCount"] = value;
  1748. break;
  1749. case "SYSINSTNM":
  1750. if (execKV.Value != null) {
  1751. string instCd = string.Empty;
  1752. instCd = execKV.Value.ToString().Contains("본원") ? "031" : execKV.Value.ToString().Contains("칠곡") ? "032" : string.Empty;
  1753. instCd += execKV.Value.ToString().Contains("교육") ? "edu" : string.Empty;
  1754. //instCd = "Dev";
  1755. ConsentExecuteInfo["sysInstNm"] = instCd;
  1756. }
  1757. break;
  1758. case "READONLY":
  1759. ConsentExecuteInfo["readOnly"] = value;
  1760. break;
  1761. default:
  1762. break;
  1763. }
  1764. }
  1765. }
  1766. //연속 서식 파라미터 디코드
  1767. //연속 서식을 위한 파라미터들은 배열 형태로 들어오기 때문에 dictionary 배열로 디코드 한 후에
  1768. //서식을 로드할 때 하나씩 불러와 전역변수에 넣어준다
  1769. else if (callKV.Key != null && !string.IsNullOrEmpty(callKV.Key.ToString()) && callKV.Key.ToString() == "PARAMS") {
  1770. List<object> paramsList = callKV.Value as List<object>;
  1771. if (paramsList == null) {
  1772. throw new Exception("InitMultiParamSetting 오류");
  1773. }
  1774. int multiParamCount = 0;
  1775. foreach (Dictionary<string, object> item in paramsList) {
  1776. multiParams.Add(new Dictionary<string, object>());
  1777. if (item != null && item.ContainsKey("PATIENT_INFO")) {
  1778. //환자정보
  1779. multiParams[multiParamCount].Add("PATIENT_INFO", new Dictionary<string, object>());
  1780. Dictionary<string, object> multiParamPatient = (multiParams[multiParamCount])["PATIENT_INFO"] as Dictionary<string, object>;
  1781. multiParamPatient.Add("PTNT_NO", "");
  1782. multiParamPatient.Add("VISIT_TYPE", "");
  1783. multiParamPatient.Add("CLN_DEPT", "");
  1784. multiParamPatient.Add("CLN_DATE", "");
  1785. multiParamPatient.Add("CRETNO", "");
  1786. multiParamPatient.Add("CLN_DX_NM", "");
  1787. multiParamPatient.Add("OPRSRVNO", "");
  1788. foreach (KeyValuePair<string, object> patientItem in item["PATIENT_INFO"] as Dictionary<string, object>) {
  1789. string value = patientItem.Value != null ? patientItem.Value.ToString() : "";
  1790. switch (patientItem.Key) {
  1791. case "PTNT_NO":
  1792. multiParamPatient["PTNT_NO"] = value;
  1793. break;
  1794. case "VISIT_TYPE":
  1795. multiParamPatient["VISIT_TYPE"] = value;
  1796. break;
  1797. case "CLN_DEPT":
  1798. multiParamPatient["CLN_DEPT"] = value;
  1799. break;
  1800. case "CLN_DATE":
  1801. multiParamPatient["CLN_DATE"] = value;
  1802. break;
  1803. case "CRETNO":
  1804. multiParamPatient["CRETNO"] = value;
  1805. break;
  1806. case "CLN_DX_NM":
  1807. multiParamPatient["CLN_DX_NM"] = value;
  1808. break;
  1809. case "OPRSRVNO":
  1810. multiParamPatient["OPRSRVNO"] = value;
  1811. break;
  1812. default:
  1813. break;
  1814. }
  1815. }
  1816. }
  1817. if (item.ContainsKey("USER_INFO")) {
  1818. //사용자 정보
  1819. multiParams[multiParamCount].Add("USER_INFO", new Dictionary<string, object>());
  1820. Dictionary<string, object> multiParamUser = (multiParams[multiParamCount])["USER_INFO"] as Dictionary<string, object>;
  1821. multiParamUser.Add("USER_ID", "");
  1822. multiParamUser.Add("DUTINSTCD", "");
  1823. multiParamUser.Add("USER_NAME", "");
  1824. multiParamUser.Add("USER_DEPTCD", "");
  1825. multiParamUser.Add("USER_DEPTNM", "");
  1826. foreach (KeyValuePair<string, object> userItem in item["USER_INFO"] as Dictionary<string, object>) {
  1827. string value = userItem.Value != null ? userItem.Value.ToString() : "";
  1828. switch (userItem.Key) {
  1829. case "USER_ID":
  1830. multiParamUser["USER_ID"] = value;
  1831. break;
  1832. case "DUTINSTCD":
  1833. multiParamUser["DUTINSTCD"] = value;
  1834. break;
  1835. case "USER_NAME":
  1836. multiParamUser["USER_NAME"] = value;
  1837. break;
  1838. case "USER_DEPTCD":
  1839. multiParamUser["USER_DEPTCD"] = value;
  1840. break;
  1841. case "USER_DEPTNM":
  1842. multiParamUser["USER_DEPTNM"] = value;
  1843. break;
  1844. default:
  1845. break;
  1846. }
  1847. }
  1848. }
  1849. if (item.ContainsKey("PAM_INFO")) {
  1850. //원무
  1851. multiParams[multiParamCount].Add("PAM_INFO", new Dictionary<string, object>());
  1852. Dictionary<string, object> multiParamPam = (multiParams[multiParamCount])["PAM_INFO"] as Dictionary<string, object>;
  1853. multiParamPam.Add("SPEC_DR_YN", "");
  1854. multiParamPam.Add("CONT_START_DT", "");
  1855. multiParamPam.Add("CONT_END_DT", "");
  1856. multiParamPam.Add("ROOM_CAPA", "");
  1857. multiParamPam.Add("CONT_TELNO", "");
  1858. multiParamPam.Add("CONT_STAFF1", "");
  1859. multiParamPam.Add("CONT_STAFF2", "");
  1860. multiParamPam.Add("CONT_STAFF3", "");
  1861. multiParamPam.Add("CARD_NO", "");
  1862. multiParamPam.Add("TAG1", "");
  1863. multiParamPam.Add("TAG2", "");
  1864. multiParamPam.Add("TAG3", "");
  1865. multiParamPam.Add("TAG4", "");
  1866. multiParamPam.Add("TAG5", "");
  1867. multiParamPam.Add("TAG6", "");
  1868. multiParamPam.Add("TAG7", "");
  1869. multiParamPam.Add("TAG8", "");
  1870. multiParamPam.Add("TAG9", "");
  1871. multiParamPam.Add("TAG10", "");
  1872. foreach (KeyValuePair<string, object> pamItem in item["PAM_INFO"] as Dictionary<string, object>) {
  1873. string value = pamItem.Value != null ? pamItem.Value.ToString() : "";
  1874. switch (pamItem.Key) {
  1875. case "SPEC_DR_YN":
  1876. multiParamPam["SPEC_DR_YN"] = value;
  1877. break;
  1878. case "CONT_START_DT":
  1879. multiParamPam["CONT_START_DT"] = value;
  1880. break;
  1881. case "CONT_END_DT":
  1882. multiParamPam["CONT_END_DT"] = value;
  1883. break;
  1884. case "ROOM_CAPA":
  1885. multiParamPam["ROOM_CAPA"] = value;
  1886. break;
  1887. case "CONT_TELNO":
  1888. multiParamPam["CONT_TELNO"] = value;
  1889. break;
  1890. case "CONT_STAFF1":
  1891. multiParamPam["CONT_STAFF1"] = value;
  1892. break;
  1893. case "CONT_STAFF2":
  1894. multiParamPam["CONT_STAFF2"] = value;
  1895. break;
  1896. case "CONT_STAFF3":
  1897. multiParamPam["CONT_STAFF3"] = value;
  1898. break;
  1899. case "CARD_NO":
  1900. multiParamPam["CARD_NO"] = value;
  1901. break;
  1902. case "TAG1":
  1903. multiParamPam["TAG1"] = value;
  1904. break;
  1905. case "TAG2":
  1906. multiParamPam["TAG2"] = value;
  1907. break;
  1908. case "TAG3":
  1909. multiParamPam["TAG3"] = value;
  1910. break;
  1911. case "TAG4":
  1912. multiParamPam["TAG4"] = value;
  1913. break;
  1914. case "TAG5":
  1915. multiParamPam["TAG5"] = value;
  1916. break;
  1917. case "TAG6":
  1918. multiParamPam["TAG6"] = value;
  1919. break;
  1920. case "TAG7":
  1921. multiParamPam["TAG7"] = value;
  1922. break;
  1923. case "TAG8":
  1924. multiParamPam["TAG8"] = value;
  1925. break;
  1926. case "TAG9":
  1927. multiParamPam["TAG9"] = value;
  1928. break;
  1929. case "TAG10":
  1930. multiParamPam["TAG10"] = value;
  1931. break;
  1932. default:
  1933. break;
  1934. }
  1935. }
  1936. }
  1937. if (item.ContainsKey("CONSENT_DATA")) {
  1938. //동의서 데이터
  1939. multiParams[multiParamCount].Add("CONSENT_DATA", new Dictionary<string, object>());
  1940. Dictionary<string, object> multiParamConsent = (multiParams[multiParamCount])["CONSENT_DATA"] as Dictionary<string, object>;
  1941. multiParamConsent.Add("ocrTag", "");
  1942. multiParamConsent.Add("formCd", "");
  1943. multiParamConsent.Add("tempsaveYn", "");
  1944. foreach (KeyValuePair<string, object> consentItem in item["CONSENT_DATA"] as Dictionary<string, object>) {
  1945. string value = consentItem.Value != null ? consentItem.Value.ToString() : "";
  1946. switch (consentItem.Key) {
  1947. case "ocrTag":
  1948. multiParamConsent["ocrTag"] = value;
  1949. break;
  1950. case "formCd":
  1951. multiParamConsent["formCd"] = value;
  1952. break;
  1953. case "tempsaveYn":
  1954. multiParamConsent["tempsaveYn"] = value;
  1955. break;
  1956. default:
  1957. break;
  1958. }
  1959. }
  1960. }
  1961. multiParamCount++;
  1962. }
  1963. }
  1964. }
  1965. multiParams.Add(new Dictionary<string, object>() { ["PAGE_COUNT"] = 0 });
  1966. }
  1967. else {
  1968. throw new Exception("CallParam 미전달");
  1969. }
  1970. // IP 주소 확인
  1971. string printIp = string.Empty;
  1972. foreach (System.Net.IPAddress ip in System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName())) {
  1973. if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) {
  1974. printIp = ip.ToString();
  1975. break;
  1976. }
  1977. }
  1978. // dbs227, 경북대학교병원 ip address 기록
  1979. ConsentExecuteInfo["ipaddr"] = printIp;
  1980. if (!printIp.Equals(string.Empty)) {
  1981. string[] ipArr = printIp.Split(new string[] { "." }, StringSplitOptions.RemoveEmptyEntries);
  1982. if (ipArr.Length == 4) {
  1983. printIp = string.Format("{0}.{1}", ipArr[2], ipArr[3]);
  1984. }
  1985. else {
  1986. printIp = string.Empty;
  1987. }
  1988. }
  1989. ConsentExecuteInfo["printIP"] = printIp;
  1990. }
  1991. catch (Exception ex) {
  1992. throw ex;
  1993. }
  1994. }
  1995. /// <summary>
  1996. /// 연속서식을 위한 배열 데이터를 꺼내서 전역변수에 할당한다
  1997. /// </summary>
  1998. /// <param name="page">받아올 배열의 인덱스</param>
  1999. private void setConsentViewMultiParams(int page) {
  2000. Dictionary<string, object> currentParam = multiParams[page];
  2001. setGlobalValueWithMultiParam(currentParam);
  2002. }
  2003. /// <summary>
  2004. /// 파라미터를 받아 전역변수에 할당
  2005. /// </summary>
  2006. /// <param name="pCallParm">EXEC_OPT 로 넘어온 파라미터 목록</param>
  2007. /// <exception cref="Exception">CallParam 미전달</exception>
  2008. private void setGlobalValueWithMultiParam(object pCallParm) {
  2009. try {
  2010. if (pCallParm != null) {
  2011. Dictionary<string, object> callParam = pCallParm as Dictionary<string, object>;
  2012. if (callParam != null && callParam.Count < 2) {
  2013. if (callParam["CALL_PARAMS"] != null) {
  2014. pCallParm = callParam["CALL_PARAMS"] as object;
  2015. }
  2016. }
  2017. foreach (KeyValuePair<string, object> callKV in pCallParm as Dictionary<string, object>) {
  2018. // 사용자 정보
  2019. if (callKV.Key != null && callKV.Key.ToString() == "USER_INFO") {
  2020. foreach (KeyValuePair<string, object> userKV in callKV.Value as Dictionary<string, object>) {
  2021. string value = userKV.Value != null ? userKV.Value.ToString() : "";
  2022. switch (userKV.Key.ToString()) {
  2023. case "USER_ID":
  2024. ConsentExecuteInfo["userNo"] = value;
  2025. ConsentExecuteInfo["loginUserNo"] = value;
  2026. break;
  2027. case "DUTINSTCD":
  2028. ConsentExecuteInfo["dutinstcd"] = value;
  2029. break;
  2030. case "USER_NAME":
  2031. ConsentExecuteInfo["userName"] = value;
  2032. ConsentExecuteInfo["loginUserName"] = value;
  2033. break;
  2034. case "USER_DEPTCD":
  2035. ConsentExecuteInfo["userDeptCd"] = value;
  2036. break;
  2037. case "USER_DEPTNM":
  2038. ConsentExecuteInfo["userDeptName"] = value;
  2039. break;
  2040. default:
  2041. break;
  2042. }
  2043. }
  2044. }
  2045. // 환자 정보
  2046. if (callKV.Key != null && callKV.Key.ToString() == "PATIENT_INFO") {
  2047. foreach (KeyValuePair<string, object> patientKV in callKV.Value as Dictionary<string, object>) {
  2048. string value = patientKV.Value != null ? patientKV.Value.ToString() : "";
  2049. switch (patientKV.Key.ToString()) {
  2050. case "PTNT_NO":
  2051. ConsentExecuteInfo["patientNo"] = value;
  2052. break;
  2053. case "VISIT_TYPE":
  2054. ConsentExecuteInfo["visitType"] = value;
  2055. break;
  2056. case "CLN_DEPT":
  2057. ConsentExecuteInfo["clnDept"] = value;
  2058. break;
  2059. case "CLN_DATE":
  2060. ConsentExecuteInfo["clnDate"] = value;
  2061. break;
  2062. case "CRETNO":
  2063. ConsentExecuteInfo["cretno"] = value;
  2064. break;
  2065. case "CLN_DX_NM":
  2066. ConsentExecuteInfo["clnDxNm"] = value;
  2067. break;
  2068. case "OPRSRVNO":
  2069. ConsentExecuteInfo["opRsrvNo"] = value;
  2070. break;
  2071. default:
  2072. break;
  2073. }
  2074. }
  2075. }
  2076. // 원무
  2077. if (callKV.Key != null && callKV.Key.ToString() == "PAM_INFO") {
  2078. foreach (KeyValuePair<string, object> pamKV in callKV.Value as Dictionary<string, object>) {
  2079. string value = pamKV.Value != null ? pamKV.Value.ToString() : "";
  2080. switch (pamKV.Key.ToString()) {
  2081. case "SPEC_DR_YN":
  2082. ConsentExecuteInfo["SpecDoctorYN"] = value;
  2083. break;
  2084. case "CONT_START_DT":
  2085. ConsentExecuteInfo["ContStartDate"] = value;
  2086. break;
  2087. case "CONT_END_DT":
  2088. ConsentExecuteInfo["ContEndDate"] = value;
  2089. break;
  2090. case "ROOM_CAPA":
  2091. ConsentExecuteInfo["RoomCapa"] = value;
  2092. break;
  2093. case "CONT_TELNO":
  2094. ConsentExecuteInfo["ContTelNo"] = value;
  2095. break;
  2096. case "CONT_STAFF1":
  2097. ConsentExecuteInfo["ContStaff1Name"] = value;
  2098. break;
  2099. case "CONT_STAFF2":
  2100. ConsentExecuteInfo["ContStaff2Name"] = value;
  2101. break;
  2102. case "CONT_STAFF3":
  2103. ConsentExecuteInfo["ContStaff3Name"] = value;
  2104. break;
  2105. case "CARD_NO":
  2106. ConsentExecuteInfo["CardNo"] = value;
  2107. break;
  2108. case "TAG1":
  2109. ConsentExecuteInfo["tag1"] = value;
  2110. break;
  2111. case "TAG2":
  2112. ConsentExecuteInfo["tag2"] = value;
  2113. break;
  2114. case "TAG3":
  2115. ConsentExecuteInfo["tag3"] = value;
  2116. break;
  2117. case "TAG4":
  2118. ConsentExecuteInfo["tag4"] = value;
  2119. break;
  2120. case "TAG5":
  2121. ConsentExecuteInfo["tag5"] = value;
  2122. break;
  2123. case "TAG6":
  2124. ConsentExecuteInfo["tag6"] = value;
  2125. break;
  2126. case "TAG7":
  2127. ConsentExecuteInfo["tag7"] = value;
  2128. break;
  2129. case "TAG8":
  2130. ConsentExecuteInfo["tag8"] = value;
  2131. break;
  2132. case "TAG9":
  2133. ConsentExecuteInfo["tag9"] = value;
  2134. break;
  2135. case "TAG10":
  2136. ConsentExecuteInfo["tag10"] = value;
  2137. break;
  2138. default:
  2139. break;
  2140. }
  2141. }
  2142. }
  2143. }
  2144. }
  2145. else {
  2146. throw new Exception("CallParam 미전달");
  2147. }
  2148. }
  2149. catch (Exception ex) {
  2150. throw ex;
  2151. }
  2152. }
  2153. /// <summary>
  2154. /// 파라미터 배열의 인덱스를 가지고 해당 파라미터에 대한 동의서를 띄운다
  2155. /// </summary>
  2156. /// <param name="page"></param>
  2157. private void showConsentView(int page) {
  2158. Dictionary<string, object> currentParam = multiParams[page] as Dictionary<string, object>;
  2159. if (!(currentParam != null && currentParam.ContainsKey("CONSENT_DATA"))) {
  2160. return;
  2161. }
  2162. setConsentViewMultiParams(page);
  2163. patientInfoCtrl.OnRefeashPartControls("");
  2164. //파라미터를 가지고 동의서 정보를 만든다
  2165. if (currentParam["CONSENT_DATA"] is Dictionary<string, object> currentConsent) {
  2166. //ConsentFormListVO consent = new ConsentFormListVO();
  2167. ConsentVO consent = consentWebService.GetConsentByFormcd(currentConsent["formCd"].ToString(), ConsentExecuteInfo["dutinstcd"].ToString());
  2168. if (consent == null) {
  2169. MessageBox.Show("동의서 정보가 잘못되었습니다.");
  2170. return;
  2171. }
  2172. consent.createUserId = ConsentExecuteInfo["loginUserNo"];
  2173. consent.createUserName = ConsentExecuteInfo["loginUserName"];
  2174. consent.ocrTag = currentConsent["ocrTag"] != null ? currentConsent["ocrTag"].ToString() : "";
  2175. consent.pid = ConsentExecuteInfo["patientNo"] != null ? ConsentExecuteInfo["patientNo"].ToString() : "";
  2176. consent.clnDate = ConsentExecuteInfo["clnDate"] != null ? ConsentExecuteInfo["clnDate"].ToString() : "";
  2177. consent.ordtype = ConsentExecuteInfo["visitType"] != null ? ConsentExecuteInfo["visitType"].ToString() : "";
  2178. consent.clnDeptCd = ConsentExecuteInfo["clnDept"] != null ? ConsentExecuteInfo["clnDept"].ToString() : "";
  2179. if (ConsentExecuteInfo["cretno"] != null) {
  2180. consent.cretno = Int32.TryParse(ConsentExecuteInfo["cretno"], out int res) ? res : 0;
  2181. }
  2182. consent.opRsrvNo = ConsentExecuteInfo["opRsrvNo"] != null ? ConsentExecuteInfo["opRsrvNo"].ToString() : "";
  2183. executePreviewConsent(consent);
  2184. }
  2185. else {
  2186. return;
  2187. }
  2188. }
  2189. private void showNextConsent() {
  2190. //현재 동의서가 몇번째인지 받아온다
  2191. Dictionary<string, object> currentPageParam = ((Dictionary<string, object>)multiParams[multiParams.Count - 1]);
  2192. int page = Int32.TryParse(currentPageParam["PAGE_COUNT"].ToString(), out int cnt) ? cnt : -1;
  2193. currentPageParam["PAGE_COUNT"] = Int32.Parse(currentPageParam["PAGE_COUNT"].ToString()) + 1;
  2194. if (page >= 0) {
  2195. //마지막 서식이면 종료한다.
  2196. if (multiParams.Count - 2 == page) {
  2197. Form parentForm = this.Parent as Form;
  2198. if (parentForm != null) {
  2199. parentForm.Close();
  2200. }
  2201. }
  2202. page++;
  2203. showConsentView(page);
  2204. }
  2205. }
  2206. private void executePreviewConsent(ConsentVO vo) {
  2207. Cursor currentCursor = this.Cursor;
  2208. this.Cursor = Cursors.WaitCursor;
  2209. consentCommandCtrl.CurrentPreviewConsent = new PreviewConsent {
  2210. formId = vo.formId.ToString(),
  2211. formCd = vo.formCd.ToString(),
  2212. formName = vo.formName,
  2213. formPrintName = vo.formPrintName,
  2214. prntCnt = vo.prntCnt,
  2215. consentMstRid = vo.consentMstRid.ToString(),
  2216. consentStateEng = vo.consentState,
  2217. orderNo = 0,
  2218. ocrCode = vo.ocrTag,
  2219. inputId = vo.createUserId,
  2220. inputNm = vo.createUserName,
  2221. ReissueConsentMstRid = IsConsentStatePrintOut(vo) ? vo.consentMstRid : 0,
  2222. RewriteConsentMstRid = !IsConsentStateUnfinished(vo) ? vo.consentMstRid : 0,
  2223. ordType = vo.ordtype,
  2224. ocrtagPrntyn = vo.ocrTagYN,
  2225. userDrFlag = vo.userDrFlag,
  2226. printOnly = vo.prntOnly,
  2227. opDiagName = vo.opDiagName,
  2228. consentState = vo.consentState,
  2229. drOnly = vo.DrOnly,
  2230. opName = vo.opName
  2231. };
  2232. try {
  2233. patientInfoCtrl.SetConsentDocumentName(vo.formName);
  2234. //동의서와 유저 상태에 따라 상단의 저장버튼을 활성화시키는 구문
  2235. if (consentCommandCtrl.CurrentTargetPatient.VisitType.Equals("O")) {
  2236. consentCommandCtrl.setCompleteSaveButton(true);
  2237. }
  2238. else {
  2239. if (ConsentMainControl.SETTING_DATA["ELECTR_CMP"].Equals("Y") && consentCommandCtrl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) {
  2240. consentCommandCtrl.setCompleteSaveButton(true);
  2241. }
  2242. else {
  2243. consentCommandCtrl.setCompleteSaveButton(false);
  2244. }
  2245. }
  2246. if (!consentCommandCtrl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) {
  2247. consentCommandCtrl.setCompleteSaveButton(false);
  2248. }
  2249. consentCommandCtrl.PreviewConsent(this);
  2250. //임시저장 활성화 여부
  2251. consentCommandCtrl.setToolstripEnabled(true);
  2252. Dictionary<string, object> consentData = getParamsWithIndex(getCurrentConsentPage())["CONSENT_DATA"] as Dictionary<string, object>;
  2253. if (consentData.ContainsKey("tempsaveYn")) {
  2254. if (consentData["tempsaveYn"].ToString().Equals("Y")) {
  2255. consentCommandCtrl.setTempSaveButton(true);
  2256. }
  2257. else {
  2258. consentCommandCtrl.setTempSaveButton(false);
  2259. }
  2260. }
  2261. }
  2262. catch {
  2263. }
  2264. finally {
  2265. this.Cursor = currentCursor;
  2266. }
  2267. }
  2268. #region ConsentState 확인
  2269. private static bool IsConsentStateTempSave(ConsentVO vo) {
  2270. if (vo.consentState.ToUpper().Equals("TEMP") || vo.consentState.ToUpper().Equals("VERBAL")) {
  2271. return true;
  2272. }
  2273. return false;
  2274. }
  2275. private static bool IsConsentStatePrintOut(ConsentVO vo) {
  2276. return vo.consentState.ToUpper().Equals("PAPER_OUT");
  2277. }
  2278. private static bool IsConsentStateElectronicComplete(ConsentVO vo) {
  2279. return vo.consentState.ToUpper().Equals("ELECTR_CMP");
  2280. }
  2281. private static bool IsConsentStateCertifyComplete(ConsentVO vo) {
  2282. return vo.consentState.ToUpper().Equals("CERTIFY_CMP");
  2283. }
  2284. private static bool IsConsentStateUnfinished(ConsentVO vo) {
  2285. return vo.consentState.ToUpper().Equals("UNFINISHED");
  2286. }
  2287. #endregion
  2288. /// <summary>
  2289. /// 다중 서식을 받아왔을 때 현재 보고있는 서식의 인덱스를 반환한다
  2290. /// </summary>
  2291. /// <returns></returns>
  2292. private int getCurrentConsentPage() {
  2293. int page = 0;
  2294. if (multiParams != null) {
  2295. Dictionary<string, object> pageParam = multiParams[multiParams.Count - 1];
  2296. if (pageParam.ContainsKey("PAGE_COUNT")) {
  2297. page = Int32.TryParse(pageParam["PAGE_COUNT"].ToString(), out int pageNumber) ? pageNumber : -1;
  2298. }
  2299. }
  2300. return page;
  2301. }
  2302. /// <summary>
  2303. /// 다중 서식의 특정 페이지에 대한 파라미터를 불러온다
  2304. /// </summary>
  2305. /// <param name="page"></param>
  2306. /// <returns></returns>
  2307. private Dictionary<string, object> getParamsWithIndex(int page) {
  2308. Dictionary<string, object> returnParam = null;
  2309. if (multiParams != null) {
  2310. returnParam = multiParams[page];
  2311. }
  2312. return returnParam;
  2313. }
  2314. public void showNextPreview() {
  2315. showNextConsent();
  2316. }
  2317. }
  2318. }