ConsentMainControl.cs 112 KB

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