123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851 |
- using System;
- using System.Collections.Generic;
- using System.Windows.Forms;
- using CLIP.eForm.Consent.Common;
- using System.Reflection;
- using System.Threading;
- using System.Xml;
- using System.IO;
- using System.ComponentModel;
- using System.Configuration;
- using System.Drawing;
- using CLIP.eForm.Consent.UI.ConsentSvcRef;
- using ClipSoft.eForm.Base.Dialog;
- namespace CLIP.eForm.Consent.UI {
- /// <summary>
- /// 동의서 관리 메인 컨트롤 클래스
- /// </summary>
- /// <remarks>
- /// <p>[설계자]</p>
- /// <p> 클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)</p>
- /// <p>[원본 작성자]</p>
- /// <p> 클립소프트 기술부 이창훈 (chlee@clipsoft.co.kr)</p>
- /// <p>[수정 작성자]</p>
- /// <p> 클립소프트 기술부 이인희</p>
- /// <p>----------------------------------------------------------------------------------------</p>
- /// <p>[HISTORY]</p>
- /// <p> 2015-07-30 : 최초작성</p>
- /// <p>----------------------------------------------------------------------------------------</p>
- /// </remarks>
- public partial class ConsentMainControl : UserControl, IConsentMainCtrl, IConsentMain {
- // 사용되지 않음
- //private string currentFormGuid = string.Empty;
- private ConsentSvcRef.ConsentSvcSoapClient consentWebService;
- private HospitalSvcRef.HospitalSvcSoapClient hospitalWebService;
- [Browsable(false)]
- public ConsentSvcRef.ConsentSvcSoapClient ConsentWebService { get { return consentWebService; } }
- [Browsable(false)]
- public HospitalSvcRef.HospitalSvcSoapClient HospitalWebService { get { return hospitalWebService; } }
- public string PluginModuleName { get; set; }
- private Dictionary<string, string> outputDataDic = null;
- private Dictionary<string, object> processResultValues = new Dictionary<string, object>();
- public Dictionary<string, string> ConsentExecuteInfo { get; set; }
- public Dictionary<string, string> PluginExecuteInfo { get; set; }
- public Dictionary<string, object> ProcessResultValues { get { return processResultValues; } }
- public List<ConsentVO> PrintInfoList { get; set; }
- public event EventHandler OnLoadPartControls;
- public event EventHandler OnResizeReviewConsent;
- public event EventHandler OnVisibleEFormControl;
- public event EventHandler OnInvisibleEFormControl;
- public event ProcessResultHandler ProcessResult;
- public delegate void ProcessResultHandler(string result);
- public object mCallParm = null;
- private static bool startform = true;
- public bool printSaveStatus { get; set; }
- public int multiPrintPlanCnt { get; set; }
- public int multiPrintExecCnt { get; set; }
- public bool saveClickPoint { get; set; } // true : 메인창, false : 듀얼뷰어창
- public bool checkAutoPrint { get; set; } // true : 입실저장 자동출력, false : 수동출력
- public int agentCallPrintCnt { get; set; }
- public int printConsentCount = 1;
- // 원무 서식 인증서 pass 여부
- // 경북대병원 dependency
- public bool shouldPassCertify = false;
- /// <summary>
- /// Gets or sets the call parameter.
- /// </summary>
- /// <value>
- /// The call parameter.
- /// </value>
- object IConsentMainCtrl.CallParam {
- get {
- return mCallParm;
- }
- set {
- mCallParm = value;
- }
- }
-
- /// <summary>
- /// 세션을 체크하기 위한 내부 클래스
- /// </summary>
- private class MessageFilterClass : IMessageFilter {
- const int WM_KEYDOWN = 0x100; // 키보드 입력
- const int WM_LBUTTONDOWN = 0x0201; // 마우스 입력
- private DateTime lastInput;
- private int sesstionTimeout;
- /// <summary>
- /// 생성자, 반드시 이 생성자를 사용 할 것
- /// </summary>
- /// <param name="now">현재 시간</param>
- /// <param name="sessionTimeout">세션 타임아웃</param>
- public MessageFilterClass(DateTime now, string sessionTimeout) {
- this.lastInput = now;
- this.sesstionTimeout = Convert.ToInt32(sessionTimeout);
- }
- bool checkUseTime(DateTime current) {
- bool needToLogOut = false;
- // 현재시간과 마지막입력시간의 차를 구한다
- TimeSpan delta = current.Subtract(lastInput);
-
- // 세션시간 이상일 경우
- if(delta.Minutes >= this.sesstionTimeout) {
- needToLogOut = true;
- } else {
- lastInput = current;
- }
- return needToLogOut;
- }
- bool IMessageFilter.PreFilterMessage(ref Message m) {
- bool logout = false;
- switch (m.Msg) {
- case WM_LBUTTONDOWN:
- case WM_KEYDOWN:
- logout = checkUseTime(DateTime.Now);
- break;
- }
- if (logout) {
- SessionLogout();
- }
- // 이벤트를 전달하기 위해서는 false 로 리턴
- return false;
- }
- }
- /// <summary>
- /// 세선 타임아웃일 경우 로그아웃을 하기 위한 static 메서드
- /// </summary>
- private static void SessionLogout() {
- System.Diagnostics.Process[] processes = System.Diagnostics.Process.GetProcessesByName("CLIP.e-Form.Consent.WinAgent");
- if(processes.Length > 0) {
- MessageBox.Show("사용시간이 만료되어 종료합니다.");
- processes[0].Kill();
- }
- }
- /// <summary>
- /// Initializes a new instance of the <see cref="ConsentMainControl"/> class.
- /// </summary>
- /// <param name="callParam">The call parameter.</param>
- public ConsentMainControl(object callParam) {
- InitializeComponent();
- ToolTip _toolTip = new ToolTip();
- _toolTip.AutoPopDelay = 5000;
- _toolTip.InitialDelay = 0;
- _toolTip.ReshowDelay = 0;
- _toolTip.ShowAlways = true;
- // 도움말 버튼 비활성화
- //_toolTip.SetToolTip(this.btnHelp, "도움말");
- //MessageBox.Show("waiting for debugging...");
- // 실행 정보 데이터셋 초기화
- ConsentExecuteInfo = new Dictionary<string, string> {
- { "dutinstcd", string.Empty }, // 기관코드
- { "userId", string.Empty },
- { "userName", string.Empty },
- { "loginUserId", string.Empty },
- { "loginUserName", string.Empty },
- { "userDeptCd", string.Empty },
- { "userDeptName", string.Empty },
- { "userSupportDeptCd", string.Empty },
- { "userSupportBaseCd", string.Empty },
- { "patientId", string.Empty },
- { "patientOrdtype", string.Empty },
- { "patientClnDept", string.Empty },
- { "patientClnDate", string.Empty },
- { "patientClnDxNm", string.Empty }, // 진단명
- { "cretno", string.Empty },
- { "opRsrvNo", string.Empty },
- { "enablePatientList", string.Empty }, // 우측 환자 목록 뷰 활성화 여부
- { "enableConsentList", string.Empty }, // 좌측 동의서 목록 뷰 활성화 여부
- { "targetService", string.Empty }, // 대상 서비스 명(eg, DEV, REAL)
- // { "startFormCd", string.Empty },
- // { "printList", string.Empty }, // 다중 출력 목록
- { "formCd", string.Empty },
- { "ocrCd", string.Empty },
- // { "tempSave", string.Empty },
- { "printYN", string.Empty },
- { "printCount", string.Empty },
- { "printIP", string.Empty },
- { "prntCnt", string.Empty },
- { "userIOFlag", "O" }, // 사용자 탭 설정
- // { "readOnly", string.Empty },
- { "SpecDoctorYN", string.Empty },
- { "ContStartDate", string.Empty }, // 약정 시작일
- { "ContEndDate", string.Empty }, // 약정 종료일
- { "RoomCapa", string.Empty }, // 병실 정원
- { "ContTelNo", string.Empty }, // ContStartDate
- { "ContStaff1Name", string.Empty }, // 원무 담당자
- { "ContStaff2Name", string.Empty }, // 원무 팀장
- { "ContStaff3Name", string.Empty }, // 원무 과장
- { "CardNo", string.Empty } // 카드 번호
- //{ "dutinstcd", string.Empty },
- //{ "userNo", string.Empty },
- //{ "loginUserNo", string.Empty },
- //{ "userName", string.Empty },
- //{ "loginUserName", string.Empty },
- //{ "userDeptCd", string.Empty },
- //{ "userDeptName", string.Empty },
- //{ "patientNo", string.Empty },
- //{ "visitType", string.Empty },
- //{ "clnDept", string.Empty },
- //{ "clnDate", string.Empty },
- //{ "cretno", string.Empty },
- //{ "clnDxNm", string.Empty },
- //{ "opRsrvNo", string.Empty },
- //{ "useListView", string.Empty },
- //{ "patientListView", string.Empty },
- //{ "startFormCd", string.Empty },
- //{ "printAct", string.Empty },
- //{ "printList", string.Empty },
- //{ "formCd", string.Empty },
- //{ "ocrTag", string.Empty },
- //{ "tempSave", string.Empty },
- //{ "printYN", string.Empty },
- //{ "printCount", string.Empty },
- //{ "printIP", string.Empty },
- //{ "prntCnt", string.Empty },
- //{ "userIOFlag", "O" },
- //{ "sysInstNm", string.Empty },
- //{ "readOnly", string.Empty },
- //{ "SpecDoctorYN", string.Empty },
- //{ "ContStartDate", string.Empty },
- //{ "ContEndDate", string.Empty },
- //{ "RoomCapa", string.Empty },
- //{ "ContTelNo", string.Empty },
- //{ "ContStaff1Name", string.Empty },
- //{ "ContStaff2Name", string.Empty },
- //{ "ContStaff3Name", string.Empty },
- //{ "CardNo", string.Empty }
- };
- PluginExecuteInfo = new Dictionary<string, string>();
- // 넘겨받은 callParam 를 디코딩 한다
- InitParamSetting(callParam);
- SetWebServiceUrlAndTimeout();
- string sessionTimeout = "30";
- if (hospitalWebService != null) {
- // 세션 타임아웃을 가져온다
- sessionTimeout = hospitalWebService.getSessionTime("101");
- }
- string userId = ConsentExecuteInfo["userId"];
- hospitalWebService.userLoginOutLog(userId, "LOGIN", "PC", Common.getMacAddress());
- MessageFilterClass messageFilter = new MessageFilterClass(DateTime.Now, sessionTimeout);
- Application.AddMessageFilter(messageFilter);
- this.PluginModuleName = ConfigurationManager.AppSettings["UIPluginAssembly"];
- }
- /// <summary>
- /// Gets a value indicating whether this instance has vertical monitor.
- /// </summary>
- /// <value>
- /// <c>true</c> if this instance has vertical monitor; otherwise, <c>false</c>.
- /// </value>
- public static bool HasMultipleMonitor {
- get {
- if (Screen.AllScreens.Length > 1) {
- return true;
- }
- return false;
- }
- }
- /// <summary>
- /// 주어진 서버 이름으로 설정파일을 로딩 한다
- /// </summary>
- /// <param name="pServerName">로드 할 서버 설정 파일</param>
- /// <returns></returns>
- public static Dictionary<string, string> GetConfigDictionary(string pServerName) {
- Dictionary<string, string> result = new Dictionary<string, string>();
- /*
- XmlDocument configXml = new XmlDocument();
- configXml.Load(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + string.Format("/CLIP.Consent.xml"));
- XmlNodeList addNodes = configXml.SelectNodes("configuration/settings/add");
- foreach (XmlNode xmlNode in addNodes) {
- if (xmlNode.Attributes["key"].InnerText == "serviceTarget") {
- serviceTarget = ((XmlCDataSection)xmlNode.ChildNodes[0]).InnerText;
- }
- }
- */
- XmlDocument configXml = new XmlDocument();
- configXml.Load(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + string.Format("/CLIP.Consent-{0}.xml", pServerName));
- XmlNodeList addNodes = configXml.SelectNodes("configuration/settings/add");
- foreach (XmlNode xmlNode in addNodes) {
- result.Add(xmlNode.Attributes["key"].InnerText, ((XmlCDataSection) xmlNode.ChildNodes[0]).InnerText);
- }
- return result;
- }
- /// <summary>
- /// childControl의 부모와 그의 부모들에서 IConsentMain 인터페이스를 구현하는 클래스를 찾는다.
- /// </summary>
- /// <param name="childControl"></param>
- /// <returns></returns>
- public static IConsentMain GetConsentMainInterface(Control childControl) {
- if (childControl.Parent == null) {
- return null;
- } else {
- if (childControl.Parent is IConsentMain) {
- return childControl.Parent as IConsentMain;
- } else {
- return GetConsentMainInterface(childControl.Parent);
- }
- }
- }
- /// <summary>
- /// Sets the web service URL and timeout.
- /// </summary>
- private void SetWebServiceUrlAndTimeout() {
- try {
- Dictionary<string, string> configDic = GetConfigDictionary(ConsentExecuteInfo["sysInstNm"]);
- this.PluginExecuteInfo.Add("consentSvcUrl", configDic["consentSvcUrl"]);
- this.PluginExecuteInfo.Add("hospitalSvcUrl", configDic["hospitalSvcUrl"]);
- this.PluginExecuteInfo.Add("formServiceUrl", configDic["formServiceUrl"]);
- this.PluginExecuteInfo.Add("baseConsentSvcURL", configDic["baseConsentSvcURL"]);
- this.PluginExecuteInfo.Add("imageUploadServerUrl", configDic["imageUploadServerUrl"]);
- this.PluginExecuteInfo.Add("signatureServerUrl", configDic["signatureServerUrl"]);
- this.PluginExecuteInfo.Add("signatureServerPort", configDic["signatureServerPort"]);
- this.PluginExecuteInfo.Add("imageUploadPath", configDic["imageUploadPath"]);
- this.PluginExecuteInfo.Add("ConsentSearchStartDate", configDic["ConsentSearchStartDate"]);
- this.PluginExecuteInfo.Add("timeOut", "10");
- this.consentWebService = WebMethodCommon.GetConsentWebService(configDic["consentSvcUrl"]);
- this.hospitalWebService = WebMethodCommon.GetHospitalWebService(configDic["hospitalSvcUrl"]);
- } catch (Exception ex) {
- throw ex;
- }
- }
- public ConsentSvcRef.ConsentSvcSoapClient getConsentWebService() {
- return this.consentWebService;
- }
- public HospitalSvcRef.HospitalSvcSoapClient getHospitalWebService() {
- return this.hospitalWebService;
- }
- /// <summary>
- /// Initializes the parameters.
- /// </summary>
- public void initParams() {
- InitParamSetting(mCallParm);
- }
- /// <summary>
- /// 화면 초기화 시 수행해야 할 이벤트 처리
- /// </summary>
- /// <param name="e"></param>
- protected override void OnLoad(EventArgs e) {
- try {
- // 프로그램을 닫으면 Agent 도 종료되게끔
- //this.Parent.Disposed += Parent_Disposed;
- if (string.IsNullOrEmpty(this.PluginModuleName)) {
- return;
- }
- // 사용자 고정 모니터 설정
- MoniterViewSetting(false);
- if (ConsentExecuteInfo["printYN"].Equals("Y")) {
- this.Parent.Visible = false;
- }
- // 기존 인증서 삭제
- SignatureConfig sign = new SignatureConfig();
- if (!startform) {
- startform = false;
- sign.SignAllClear();
- }
- // eFormViewer 컨트롤 초기화
- InitEFormControl();
- InvokeDelayedLoadEvent();
- this.eFormViewerCtrl.GetCurrentViewer().UIUpdateOnDrawing
- += new Viewer.UIUpdateOnDrawingHandler(ConsentMainControl_UIUpdateOnDrawing);
- base.OnLoad(e);
- // dbs227
- // TODO 디버그 용 메시지 박스
- //Boolean openDualView = (this.consentWebService.getDualViewMode(ConsentExecuteInfo["dutinstcd"],
- // ConsentExecuteInfo["ipaddr"]) == "Y") ? true : false;
- //MessageBox.Show("Waiting for debugging at " + ConsentExecuteInfo["ipaddr"]);
- // 키보드 마우스 입력 이벤트
-
- // Ku2.0 연동
- GetConsentListByFormcd();
- // 폰트 설치여부 체크
- string familyName;
- string familyList = "";
- FontFamily[] fontFamilies;
- System.Drawing.Text.InstalledFontCollection installedFontCollection = new System.Drawing.Text.InstalledFontCollection();
- fontFamilies = installedFontCollection.Families;
- int count = fontFamilies.Length;
- int fontCheck = 0;
- for (int j = 0; j < count; ++j) {
- familyName = fontFamilies[j].Name;
- familyList = familyList + familyName;
- familyList = familyList + ", ";
- if (fontCheck != 1 && (familyName == "나눔고딕" || familyName == "NanumGothic")) {
- fontCheck = fontCheck + 1;
- }
- if (fontCheck < 100 && (familyName == "나눔고딕 ExtraBold" || familyName == "NanumGothicExtraBold" || familyName == "나눔고딕 아주 굵게")) {
- fontCheck = fontCheck + 10;
- }
- }
- // 폰트 설치 실행
- if (fontCheck < 11) {
- System.Diagnostics.Process UserProcess = new System.Diagnostics.Process();
- UserProcess.StartInfo.UseShellExecute = true;
- //UserProcess.StartInfo.FileName = "NanumFontSetup.exe";
- //UserProcess.StartInfo.WorkingDirectory = Path.GetDirectoryName(Application.StartupPath + "/Font/");
- // 폰트가 없어 최초 실행 시 에러 발생 부분 수정
- UserProcess.StartInfo.FileName = "FontInstall.exe";
- UserProcess.StartInfo.WorkingDirectory = Path.GetDirectoryName(Application.StartupPath + "\\");
- UserProcess.StartInfo.CreateNoWindow = true;
- UserProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
- UserProcess.Start();
- UserProcess.WaitForExit();
- }
- string sTempPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Clipsoft\ClipSoft.eForm.Viewer\DataTemp\";
- if (Directory.Exists(sTempPath)) {
- string[] filePaths = Directory.GetFiles(sTempPath);
- foreach (string fileName in filePaths) {
- FileInfo fileInfo = new FileInfo(fileName);
- if (fileInfo.Extension.Equals(".ept") || fileInfo.Extension.Equals(".jpg") || fileInfo.Extension.Equals(".xml")) {
- fileInfo.Delete();
- }
- }
- }
- } catch (Exception ex) {
- // 데이터베이스 저장 기능 추가로 해당 기능 삭제
- //File.WriteAllText(string.Format(@"{0}\eConsentLog\{1}_Agent.txt", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
- // , DateTime.Now.ToString("yyyyMMdd_HHmmss"))
- // , ex.ToString());
- System.Diagnostics.Trace.WriteLine(string.Format("CLIP.eForm error: {0}", ex.Message));
- if (this.Parent is System.Windows.Forms.Form) {
- ((Form) this.Parent).DialogResult = DialogResult.Cancel;
- ((Form) this.Parent).Close();
- }
- }
- }
- // 화면이 종료될때 Agent도 종료되도록 수정
- /// <summary>
- /// Handles the Disposed event of the Parent control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void Parent_Disposed(object sender, EventArgs e) {
- foreach (Form form in Application.OpenForms) {
- if (form.Name.Equals("ConsentAgentForm")) {
- string userId = ConsentExecuteInfo["userId"];
- hospitalWebService.userLoginOutLog(userId, "LOGOFF", "PC", Common.getMacAddress());
- form.Dispose();
- break;
- }
- }
- }
- // 화면이 종료될때 Agent도 종료되도록 수정
- /// <summary>
- /// Parents the disposed.
- /// </summary>
- public void Parent_Disposed() {
- foreach (Form form in Application.OpenForms) {
- if (form.Name.Equals("ConsentAgentForm")) {
- form.Dispose();
- break;
- }
- }
- }
- /// <summary>
- /// OCX 로 부터 넘겨 받은 파라미터를 decode
- /// </summary>
- /// <param name="pCallParm">EXEC_OPT 로 넘어온 파라미터 목록</param>
- /// <exception cref="Exception">CallParam 미전달</exception>
- private void InitParamSetting(object pCallParm) {
- try {
- if (pCallParm != null) {
- Dictionary<string, object> callParam = pCallParm as Dictionary<string, object>;
- if (callParam != null && callParam.Count < 2) {
- if (callParam["CALL_PARAMS"] != null) {
- pCallParm = callParam["CALL_PARAMS"] as object;
- }
- }
- foreach (KeyValuePair<string, object> callKV in pCallParm as Dictionary<string, object>) {
- // 사용자 정보
- if (callKV.Key != null && !string.IsNullOrEmpty(callKV.Key.ToString()) && callKV.Key.ToString() == "USER_INFO") {
- foreach (KeyValuePair<string, object> userKV in callKV.Value as Dictionary<string, object>) {
- if (userKV.Key != null && !string.IsNullOrEmpty(userKV.Key.ToString()) && userKV.Key.ToString() == "USER_ID") {
- if (userKV.Value != null) {
- ConsentExecuteInfo["userId"] = userKV.Value.ToString();
- ConsentExecuteInfo["loginUserId"] = userKV.Value.ToString();
- }
- } else if (userKV.Key != null && !string.IsNullOrEmpty(userKV.Key.ToString()) && userKV.Key.ToString() == "DUTINSTCD") {
- if (userKV.Value != null) {
- ConsentExecuteInfo["dutinstcd"] = userKV.Value.ToString();
- }
- } else if (userKV.Key != null && !string.IsNullOrEmpty(userKV.Key.ToString()) && userKV.Key.ToString() == "USER_NAME") {
- if (userKV.Value != null) {
- ConsentExecuteInfo["userName"] = userKV.Value.ToString();
- ConsentExecuteInfo["loginUserName"] = userKV.Value.ToString();
- }
- } else if (userKV.Key != null && !string.IsNullOrEmpty(userKV.Key.ToString()) && userKV.Key.ToString() == "USER_DEPTCD") {
- if (userKV.Value != null) {
- ConsentExecuteInfo["userDeptCd"] = userKV.Value.ToString();
- }
- } else if (userKV.Key != null && !string.IsNullOrEmpty(userKV.Key.ToString()) && userKV.Key.ToString() == "USER_DEPTNM") {
- if (userKV.Value != null) {
- ConsentExecuteInfo["userDeptName"] = userKV.Value.ToString();
- }
- } else if (userKV.Key != null && !string.IsNullOrEmpty(userKV.Key.ToString()) && userKV.Key.ToString() == "USER_SUPPORT_DEPT_CD") {
- if (userKV.Value != null) {
- ConsentExecuteInfo["userSupportDeptCd"] = userKV.Value.ToString();
- }
- } else if (userKV.Key != null && !string.IsNullOrEmpty(userKV.Key.ToString()) && userKV.Key.ToString() == "USER_SUPPORT_BASE_CD") {
- if (userKV.Value != null) {
- ConsentExecuteInfo["userSupportBaseCd"] = userKV.Value.ToString();
- }
- }
- //
- }
- }
- // 환자 정보
- if (callKV.Key != null && !string.IsNullOrEmpty(callKV.Key.ToString()) && callKV.Key.ToString() == "PATIENT_INFO") {
- foreach (KeyValuePair<string, object> patientKV in callKV.Value as Dictionary<string, object>) {
- if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "PATIENT_ID") {
- if (patientKV.Value != null) ConsentExecuteInfo["patientId"] = patientKV.Value.ToString();
- }
- if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "PATIENT_ORDTYPE") {
- if (patientKV.Value != null) ConsentExecuteInfo["patientOrdtype"] = patientKV.Value.ToString();
- }
- if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "PATIENT_CLN_DEPT") {
- if (patientKV.Value != null) ConsentExecuteInfo["patientClnDept"] = patientKV.Value.ToString();
- }
- if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "PATIENT_CLN_DATE") {
- if (patientKV.Value != null) ConsentExecuteInfo["patientClnDate"] = patientKV.Value.ToString();
- }
- if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CRETNO") {
- if (patientKV.Value != null) ConsentExecuteInfo["cretno"] = patientKV.Value.ToString();
- }
- // 진단명
- if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "PATIENT_CLN_DX_NM") {
- if (patientKV.Value != null) ConsentExecuteInfo["patientClnDxNm"] = patientKV.Value.ToString();
- }
- if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "OPRSRVNO") {
- if (patientKV.Value != null) ConsentExecuteInfo["opRsrvNo"] = patientKV.Value.ToString();
- }
- }
- }
- if (callKV.Key != null && !string.IsNullOrEmpty(callKV.Key.ToString()) && callKV.Key.ToString() == "EXEC_OPT") {
- // 화면 설정 정보
- foreach (KeyValuePair<string, object> execKV in callKV.Value as Dictionary<string, object>) {
- if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "ENABLE_CONSENT_LIST") {
- if (execKV.Value != null) ConsentExecuteInfo["enableConsentList"] = execKV.Value.ToString(); // 동의서 리스트 사용 유무
- }
- if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "ENABLE_PATIENT_LIST") {
- if (execKV.Value != null) ConsentExecuteInfo["enablePatientList"] = execKV.Value.ToString(); // 환자 리스트 사용 유무
- }
- // 대가대 병원 초기 설정 없음
- if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "START_FORM_CD") {
- if (execKV.Value != null) ConsentExecuteInfo["startFormCd"] = execKV.Value.ToString(); // 시작 FORM ID
- }
- // 대가대 병원 초기 설정 없음
- if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "PTNT_ACT") {
- if (execKV.Value != null) ConsentExecuteInfo["printAct"] = execKV.Value.ToString(); // 초기 프린트
- }
- // 여러 서식 출력
- // 대가대 병원 사용되지 않음
- //eg, {PRINT_LIST: [{START_FORM_CD: VALUE, PTNT_NO: VALUE, VISIT_TYPE: VALUE, CLN_DATE: VALUE, CLN_DEPT:VAELU, PRINT_CNT: VALUE, CRETNO: VALUE}, ...]}
- if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "PRINT_LIST") {
- if (execKV.Value != null) {
- if (execKV.Value is List<object> PatientList && PatientList.Count > 0) {
- PrintInfoList = new List<ConsentVO>();
- ConsentVO consentVO = new ConsentVO();
- for (int i = 0; i < PatientList.Count; i++) {
- consentVO = new ConsentVO {
- printCnt = -1
- };
- foreach (KeyValuePair<string, object> callOrderKV in PatientList[i] as Dictionary<string, object>) {
- if (callOrderKV.Key != null && !string.IsNullOrEmpty(callOrderKV.Key.ToString()) && callOrderKV.Value != null) {
- if (callOrderKV.Key.ToString() == "START_FORM_CD") consentVO.formCode = callOrderKV.Value.ToString(); // 출력 서식코드
- //if (callOrderKV.Key.ToString() == "PTNT_NO") consentVO.PatientCode = callOrderKV.Value.ToString(); // 환자번호
- //if (callOrderKV.Key.ToString() == "VISIT_TYPE") consentVO.VisitType = callOrderKV.Value.ToString(); // 내원구분
- //if (callOrderKV.Key.ToString() == "CLN_DATE") consentVO.ClnDate = callOrderKV.Value.ToString(); // 진료일자
- //if (callOrderKV.Key.ToString() == "CLN_DEPT") consentVO.ClnDeptCd = callOrderKV.Value.ToString(); // 진료과
- if (callOrderKV.Key.ToString() == "PRINT_CNT") {
- int.TryParse(callOrderKV.Value.ToString(), out int PrntCnt);
- consentVO.printCnt = PrntCnt; // 출력 카운트
- }
- if (callOrderKV.Key.ToString() == "CRETNO") {
- int.TryParse(callOrderKV.Value.ToString(), out int cretno);
- //consentVO.Cretno = cretno; // 차트번호
- }
- }
- }
- PrintInfoList.Add(consentVO);
- }
- if (execKV.Value != null) ConsentExecuteInfo["printList"] = PrintInfoList.Count.ToString(); // 출력 데이터
- }
- }
- }
- if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "FORMCD") { // 서식 코드
- if (execKV.Value != null) ConsentExecuteInfo["formCd"] = execKV.Value.ToString();
- }
- if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "OCRCD") { // OCR 태그
- if (execKV.Value != null) ConsentExecuteInfo["ocrCd"] = execKV.Value.ToString();
- }
- if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "TEMP_SAVE") { // 임시 저장 (Ku2.0 연동)
- if (execKV.Value != null) ConsentExecuteInfo["tempSave"] = execKV.Value.ToString();
- }
- if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "PRINT_YN") { // 출력 여부 (Ku2.0 연동)
- if (execKV.Value != null) ConsentExecuteInfo["printYN"] = execKV.Value.ToString();
- }
- if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "PRINT_CNT") { // 출력 매수 (Ku2.0 연동)
- if (execKV.Value != null) ConsentExecuteInfo["printCount"] = execKV.Value.ToString();
- }
- if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "SYSINSTNM") { // 접속 서버 정보
- if (execKV.Value != null) {
- string systemName = string.Empty;
- // 대가대 병원 시스템 CD
- //instCd = execKV.Value.ToString().Contains("교육") ? "DEV101" : "EMR101";
- systemName = execKV.Value.ToString();
- //instCd = execKV.Value.ToString().Contains("본원") ? "031" : execKV.Value.ToString().Contains("칠곡") ? "032" : string.Empty;
- //instCd += execKV.Value.ToString().Contains("교육") ? "edu" : string.Empty;
- //instCd = "Dev";
- ConsentExecuteInfo["sysInstNm"] = systemName;
- }
- }
- // 보기 전용 여부
- // 대가대 병원 초기 설정 없음
- if (execKV.Key != null && !string.IsNullOrEmpty(execKV.Key.ToString()) && execKV.Key.ToString() == "READ_ONLY") {
- if (execKV.Value != null) ConsentExecuteInfo["readOnly"] = execKV.Value.ToString();
- }
- }
- }
- // 원무
- if (callKV.Key != null && !string.IsNullOrEmpty(callKV.Key.ToString()) && callKV.Key.ToString() == "PAM_INFO") {
- foreach (KeyValuePair<string, object> patientKV in callKV.Value as Dictionary<string, object>) {
- if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "SPEC_DR_YN") {
- if (patientKV.Value != null) ConsentExecuteInfo["SpecDoctorYN"] = patientKV.Value.ToString();
- }
- if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CONT_START_DT") {
- if (patientKV.Value != null) ConsentExecuteInfo["ContStartDate"] = patientKV.Value.ToString();
- }
- if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CONT_END_DT") {
- if (patientKV.Value != null) ConsentExecuteInfo["ContEndDate"] = patientKV.Value.ToString();
- }
- if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "ROOM_CAPA") {
- if (patientKV.Value != null) ConsentExecuteInfo["RoomCapa"] = patientKV.Value.ToString();
- }
- if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CONT_TELNO") {
- if (patientKV.Value != null) ConsentExecuteInfo["ContTelNo"] = patientKV.Value.ToString();
- }
- if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CONT_STAFF1") {
- if (patientKV.Value != null) ConsentExecuteInfo["ContStaff1Name"] = patientKV.Value.ToString();
- }
- if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CONT_STAFF2") {
- if (patientKV.Value != null) ConsentExecuteInfo["ContStaff2Name"] = patientKV.Value.ToString();
- }
- if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CONT_STAFF3") {
- if (patientKV.Value != null) ConsentExecuteInfo["ContStaff3Name"] = patientKV.Value.ToString();
- }
- if (patientKV.Key != null && !string.IsNullOrEmpty(patientKV.Key.ToString()) && patientKV.Key.ToString() == "CARD_NO") {
- if (patientKV.Value != null) ConsentExecuteInfo["CardNo"] = patientKV.Value.ToString();
- }
- }
- }
- }
- } else {
- throw new Exception("CallParam 미전달");
- }
- // IP 주소 확인
- string printIp = string.Empty;
- foreach (System.Net.IPAddress ip in System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName())) {
- if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) {
- printIp = ip.ToString();
- break;
- }
- }
- // dbs227, 경북대학교병원 ip address 기록
- ConsentExecuteInfo["ipaddr"] = printIp;
- if (!printIp.Equals(string.Empty)) {
- string[] ipArr = printIp.Split(new string[] { "." }, StringSplitOptions.RemoveEmptyEntries);
- if (ipArr.Length == 4) {
- printIp = string.Format("{0}.{1}", ipArr[2], ipArr[3]);
- } else {
- printIp = string.Empty;
- }
- }
- ConsentExecuteInfo["printIP"] = printIp;
- } catch (Exception ex) {
- throw ex;
- }
- }
- private string monitorNo = string.Empty;
- /// <summary>
- /// 모니터 뷰 설정
- /// </summary>
- /// <param name="printMode">출력 여부</param>
- private void MoniterViewSetting(bool printMode) {
- // 출력 모드라면 화면에 나타내지 않는다
- if (printMode) {
- return;
- }
- // 로딩 시 사용자 설정 모니터 정보를 불러온다.
- string userPrefMonitor = string.Empty;
- if(hospitalWebService != null) {
- userPrefMonitor = hospitalWebService.getUserPrefMonitor(ConsentExecuteInfo["userId"], ConsentExecuteInfo["dutinstcd"]);
- }
- int iMoniterNumber = 0;
- if (!string.IsNullOrEmpty(userPrefMonitor)) {
- //현재 프로그램이 실행되고 있는정보 가져오기: 디버깅 모드라면 bin/debug/프로그램명.exe
- FileInfo exefileinfo = new FileInfo(Path.GetDirectoryName(Application.StartupPath));
- string path = Path.GetDirectoryName(Application.StartupPath);
- string fileName = @"\config.ini"; //파일명
- //만약 현재 실행 되는 경로가 아닌 특정한 위치를 원한다면 위에 과정 상관없이 바로 경로셋팅 해 주면 된다. (예: c:\config.ini)
- string filePath = path + fileName; //ini 파일 경로
- // 만들어 놓았던 iniUtil 객체 생성(생성자 인자로 파일경로 정보 넘겨줌)
- iniUtil ini = new iniUtil(filePath);
- //이제 ini 객체를 이용해 맘것 사용하면 된다.
- string localValue = ini.GetIniValue("DCMC", "MONITER_NUMBER");
- // 서버에서 가져온 값과 로컬값이 다른다면 서버값으로 매핑하여 준다.
- if (!userPrefMonitor.Equals(localValue)) {
- ini.SetIniValue("DCMC", "MONITER_NUMBER", userPrefMonitor);
- }
- int.TryParse(userPrefMonitor, out iMoniterNumber);
- }
- monitorNo = userPrefMonitor;
- //Point location = Point.Empty;
- //int j = 1;
- //FormWindowState windowStateBackup;
- //foreach (Screen sc in Screen.AllScreens) {
- // // 출력할 모니터에 Form 을 생성하여 나타낸다
- // if (j == iMoniterNumber) {
- // Form parentForm = this.Parent as Form;
- // if (parentForm != null) {
- // windowStateBackup = parentForm.WindowState;
- // Size size = parentForm.Bounds.Size;
- // parentForm.WindowState = FormWindowState.Normal;
- // parentForm.StartPosition = FormStartPosition.Manual;
- // parentForm.ClientSize = new Size(size.Width, size.Height);
- // parentForm.Location = new Point(sc.Bounds.Left, sc.Bounds.Top);
- // parentForm.WindowState = windowStateBackup;
- // }
- // break;
- // }
- // j++;
- //}
- }
- public void setDualViewerOption(string monitorNo) {
- if (!string.IsNullOrEmpty(monitorNo)) {
- this.eFormViewerCtrl.SetRunOption("DUALVIEWER_DISPLAY_INDEX", monitorNo);
- }
- }
- /// <summary>
- /// eFormViewer 컨트롤에 대한 초기화
- /// run option 설정
- /// </summary>
- private void InitEFormControl() {
- Screen screen = Screen.FromControl(this);
- if (screen.Primary) {
- this.eFormViewerCtrl.SetRunOption("DEFAULT_ZOOM_RATE", "pagewidth");
- } else {
- this.eFormViewerCtrl.SetRunOption("DEFAULT_ZOOM_RATE", "pagewidth");
- }
- //this.eFormViewerCtrl.SetRunOption("ENABLE_DEBUG_VIEW", "true");
- //this.eFormViewerCtrl.SetRunOption("DEFAULT_TOOL_BAR_VISIBLE", "true");
- this.eFormViewerCtrl.SetRunOption("USE_CREDITCARD_SIGNPAD", "false");
- this.eFormViewerCtrl.SetRunOption("DEFAULT_TOOL_BAR_VISIBLE", "false");
- this.eFormViewerCtrl.SetRunOption("SET_EXTERNAL_CONTROL_DEFINED_PATH", this.PluginExecuteInfo["formServiceUrl"]);
- this.eFormViewerCtrl.SetRunOption("USE_EITHER_SIDE_MOVE_BUTTON", "true");
- // dbs227, 경북대학교병원 옵션, 형광펜 색으로
- this.eFormViewerCtrl.SetRunOption("DRAWING_PEN", "{ \"width\":\"9\",\"color\":{ \"a\":\"50\", \"r\":\"255\", \"g\":\"255\", \"b\":\"1\"} }");
- this.eFormViewerCtrl.SetRunOption("SET_VISIBLE_BUTTONS", "PAGE_ATTACH=true");
- this.eFormViewerCtrl.SetRunOption("IMAGE_SAVE_OPTION", "{\"dpi\":\"150\",\"gray\":\"false\",\"encode\":\"jpeg\",\"base-index\":\"1\",\"quality\":\"100\"}");
- // dbs227, 경북대학교병원 요청사항
- // 마우스 우클릭 그리기 모드 변경
- this.eFormViewerCtrl.SetRunOption("SET_MOUSE_RIGHT_CHANGE_MODE", "Drawing");
- // V2 버전 런 옵션
- this.eFormViewerCtrl.SetRunOption("RUN_AS_REPOSITORY_V2", "true");
- if (HasMultipleMonitor) {
- this.eFormViewerCtrl.SetRunOption("DUALVIEWER_TOOL_BAR_SIZE", "32");
- if (!string.IsNullOrEmpty(monitorNo)) {
- this.eFormViewerCtrl.SetRunOption("DUALVIEWER_DISPLAY_INDEX", monitorNo);
- //this.eFormViewerCtrl.SetRunOption("DUALVIEWER_DISPLAY_INDEX", "1");
- }
- this.eFormViewerCtrl.SetRunOption("RUN_AS_DUALVIEWER", "CLIP.eForm.DualViewer.dll");
- // this.eFormViewerCtrl.SetRunOption("READ_ONLY", "true");
- this.eFormViewerCtrl.SetRunOption("DUALVIEWER_TO_ACTIVATE_CONTROLS", "true");
- this.eFormViewerCtrl.SetRunOption("SET_VISIBLE_DUALVIEWER_TOOLSTRIP_MENU", "true");
- this.eFormViewerCtrl.SetRunOption("DUALVIEWER_TOOL_BAR_ENABLE", "true");
- // 툴바 위치 조절(true : 상단, false : 하단)
- this.eFormViewerCtrl.SetRunOption("USE_DUALVIEWER_TOOL_BAR_TOP", "true");
- // 가상키보드 사용 여부
- this.eFormViewerCtrl.SetRunOption("DUALVIEWER_VIRTUAL_KEYBOARD_VISIBLE", "true");
- // 관리자 권한 실행 저장 여부
- this.eFormViewerCtrl.SetRunOption("USE_ADMIN_PRIVILEGES_SAVE_EXECUTE", "false");
- this.eFormViewerCtrl.SetRunOption("DUALVIEWER_RESOLUTION", "{\"width\":\"768\",\"height\":\"1024\"}");
- }
- }
- /// <summary>
- /// Invokes the delayed load event.
- /// </summary>
- private void InvokeDelayedLoadEvent() // TODO: 리팩터링 대상 comment by jchong 2016.06.11
- {
- if (this.OnLoadPartControls != null) {
- Application.DoEvents();
- Thread.Sleep(1);
- OnLoadPartControls.Invoke(this, new EventArgs());
- }
- }
- /// <summary>
- /// </summary>
- /// <param name="msg">A <see cref="T:System.Windows.Forms.Message" />, passed by reference, that represents the window message to process.</param>
- /// <param name="keyData">One of the <see cref="T:System.Windows.Forms.Keys" /> values that represents the key to process.</param>
- /// <returns>
- /// true if the character was processed by the control; otherwise, false.
- /// </returns>
- protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
- if (msg.Msg == 0x100) {
- if (keyData == Keys.PageUp) {
- this.eFormViewerCtrl.MovePrevPage();
- }
- if (keyData == Keys.Next) {
- this.eFormViewerCtrl.MoveNextPage();
- }
- }
- return base.ProcessCmdKey(ref msg, keyData);
- }
- /// <summary>
- /// Consents the main control UI update on drawing.
- /// </summary>
- /// <param name="sender">The sender.</param>
- /// <param name="undoStackCount">The undo stack count.</param>
- /// <param name="redoStackCount">The redo stack count.</param>
- /// <param name="totalStrokeCount">The total stroke count.</param>
- /// <param name="totalAllPageStrokeCoun">The total all page stroke coun.</param>
- void ConsentMainControl_UIUpdateOnDrawing(object sender, int undoStackCount, int redoStackCount, int totalStrokeCount, int totalAllPageStrokeCoun) {
- if (undoStackCount > 0) {
- this.consentCommandCtrl.EnableUndo = true;
- } else {
- this.consentCommandCtrl.EnableUndo = false;
- }
- if (redoStackCount > 0) {
- this.consentCommandCtrl.EnableRedo = true;
- } else {
- this.consentCommandCtrl.EnableRedo = false;
- }
- if (totalStrokeCount > 0) {
- this.consentCommandCtrl.EnableRemoveAll = true;
- } else {
- this.consentCommandCtrl.EnableRemoveAll = false;
- }
- }
- ConsentListCtrlBase IConsentMain.ConsentListCtrl {
- get { return this.consentListCtrl; }
- }
- PatientInfoCtrlBase IConsentMain.PatientInfoCtrl {
- get { return this.patientInfoCtrl; }
- }
- PatientListCtrlBase IConsentMain.PatientListCtrl {
- get { return this.patientListCtrl; }
- }
- Dictionary<string, string> IConsentMain.ConsentExecuteInfo {
- get {
- return this.ConsentExecuteInfo;
- }
- set {
- this.ConsentExecuteInfo = value;
- }
- }
- Dictionary<string, string> IConsentMain.PluginExecuteInfo {
- get {
- return this.PluginExecuteInfo;
- }
- set {
- this.PluginExecuteInfo = value;
- }
- }
- ConsentCommandCtrlBase IConsentMain.ConsentCommandCtrl {
- get {
- return this.consentCommandCtrl;
- }
- }
- public Dictionary<string, object> ProcessResultValue {
- get {
- return processResultValues;
- }
- }
- /// <summary>
- /// 환자 정보가 바뀌었을때 컨트롤들의 정보를 재조회
- /// </summary>
- /// <param name="visitType">Type of the visit.</param>
- void IConsentMain.UIControlsRefeash(string visitType) {
- this.patientInfoCtrl.OnRefeashPartControls(visitType);
- this.consentListCtrl.OnRefeashPartControls();
- }
- /// <summary>
- /// 사용자 정보 변경
- /// </summary>
- /// <param name="pInstCd">근무지기관코드</param>
- /// <param name="pUserId">사용자ID</param>
- /// <param name="DutPlceCd">근무지부서</param>
- void IConsentMain.SetConsentUserInfo(string pInstCd, string pUserId, string DutPlceCd) {
- this.patientInfoCtrl.SetConsentUserInfo(pUserId, pInstCd, DutPlceCd);
- }
- void IConsentMain.ClearPreviewConsent(bool pDoInit) {
- consentCommandCtrl.CurrentPreviewConsent = null;
- patientInfoCtrl.SetConsentDocumentName("");
- if (pDoInit) {
- eFormViewerCtrl.ReInitializeViewer();
- imageViewCtrl1.Hide();
- }
- }
- void IConsentMain.PreviewConsent(string fos) {
- this.pnlCommand.Visible = true;
- this.pnlViewer.Visible = false;
- this.eFormViewerCtrl.Visible = true;
- // 배율정보 설정
- consentCommandCtrl.setZoomRate(4);
- consentCommandCtrl.setButtonsVisibility(consentCommandCtrl.CurrentTargetPatient.ordtype, consentCommandCtrl.CurrentPreviewConsent.ConsentState);
- this.eFormViewerCtrl.OpenFos(fos);
- }
- void IConsentMain.ClearConsent() {
- this.pnlCommand.Visible = true;
- this.pnlViewer.Visible = false;
- this.eFormViewerCtrl.Visible = true;
- this.eFormViewerCtrl.Open();
- }
- void IConsentMain.ReviewConsent() {
- this.pnlCommand.Visible = false;
- this.pnlViewer.Visible = true;
- this.eFormViewerCtrl.Visible = false;
- }
- void IConsentMain.setDualViewerButtonOtps(string otps) {
- InitEFormControl();
- this.eFormViewerCtrl.SetRunOption("SET_DUALVIEWER_VISIBLE_BUTTONS", otps);
- }
- void IConsentMain.RunConsentDualView() {
- this.eFormViewerCtrl.OpenDualViewer();
- }
- /// <summary>
- /// Prints the consent document.
- /// 수동으로 찾아서출력
- /// 일반 출력의 경우에도 기본프린터로 바로 출력하는 것으로 변경됨
- /// </summary>
- /// <param name="fos">The fos.</param>
- void IConsentMain.PrintConsentDocument(string fos) {
- //int rid = -1;
- if (!string.IsNullOrEmpty(fos)) {
- this.eFormViewerCtrl.OpenFos(fos);
- // dbs227 DB 기록 필요
- //rid = this.consentCommandCtrl.SaveDataForPrintedConsent(String.Empty);
- }
- this.printSaveStatus = false;
- int iPrntCnt = 0;
- //PC 클라이언트에서 출력 버튼 눌럿을때를 구분하여 pageCount넘겨줌
- //pageCount를 넘겨주지 않고 consentCommandCtrl.CurrentPreviewConsent.PrntCnt에서 출력 장수를 받았을때 초기화되어 익셉션 발생
- if (printButtonClick) {
- iPrntCnt = pageCnt;
- printButtonClick = false;
- } else {
- iPrntCnt = consentCommandCtrl.CurrentPreviewConsent.PrntCnt;
- }
- this.multiPrintPlanCnt = iPrntCnt;
- this.multiPrintExecCnt = 0;
- this.checkAutoPrint = false; //수동출력
- if (iPrntCnt > 0) {
- // 출력매수만큼 동의서 출력
- //for (int i = 0; i < iPrntCnt; i++)
- //{
- // if((i+1) == iPrntCnt) this.printSaveStatus = true;
- this.printSaveStatus = true;
- this.eFormViewerCtrl.PrintByPrinterName("");
- //}
- }
- this.printSaveStatus = false;
- // dbs227,
- // 출력 모드가 아닐때는 초기화 하지 않는다.
- //if (rid > 0)
- //{
- // this.consentListCtrl.InquiryConsentData(rid);
- //}
- }
- /// <summary>
- /// 기본프린터로 출력, Agent에서 직접출력
- /// dbs227, 경북대학교병원 사용하지 않음
- /// </summary>
- /// <param name="fos">출력할 FOS string</param>
- void IConsentMain.PrintDirect(string fos) {
- if (!string.IsNullOrEmpty(fos)) {
- // dbs227 DB 기록 필요
- //this.consentCommandCtrl.SaveDataForPrintedConsent(String.Empty);
- this.eFormViewerCtrl.OpenFos(fos);
- //this.consentCommandCtrl.SaveDataForPrintedConsent(String.Empty);
- }
- int prntCnt = 0;
- prntCnt = consentCommandCtrl.CurrentPreviewConsent.PrntCnt;
- this.checkAutoPrint = true;//자동출력
- if (!string.IsNullOrEmpty(this.ConsentExecuteInfo["printList"])) {
- if (!ConsentExecuteInfo["prntCnt"].Equals("-1")) {
- int.TryParse(this.ConsentExecuteInfo["prntCnt"].ToString(), out prntCnt);
- }
- }
- this.multiPrintPlanCnt = prntCnt;
- this.multiPrintExecCnt = 0;
- if (prntCnt > 0) {
- //this.printSaveStatus = false;
- //// 출력매수만큼 동의서 출력
- //for (int i = 0; i < prntCnt; i++)
- //{
- // if ((i + 1) == prntCnt) this.printSaveStatus = true;
- this.printSaveStatus = true;
- //기본프린터로 바로 출력하기로 함
- this.eFormViewerCtrl.PrintByPrinterName("");
- //}
- //this.printSaveStatus = false;
- }
- }
- void IConsentMain.MoveFirstPage() {
- this.eFormViewerCtrl.MoveFirstPage();
- }
- void IConsentMain.MovePrevPage() {
- this.eFormViewerCtrl.MovePrevPage();
- }
- void IConsentMain.MoveNextPage() {
- this.eFormViewerCtrl.MoveNextPage();
- }
- void IConsentMain.MoveLastPage() {
- this.eFormViewerCtrl.MoveLastPage();
- }
- void IConsentMain.Save() {
- this.eFormViewerCtrl.Save();
- }
- /// <summary>
- /// eFormViewerCtrl 컨트롤의 TempSave 이벤트를 호출
- /// </summary>
- void IConsentMain.TempSave() {
- this.eFormViewerCtrl.TempSave();
- }
- int IConsentMain.GetCurrentPageIndex() {
- return this.eFormViewerCtrl.GetCurrentPageIndex();
- }
- int IConsentMain.GetTotalPageCount() {
- return this.eFormViewerCtrl.GetTotalPageCount();
- }
- void IConsentMain.MoveToPageIndex(int pageIndex) {
- this.eFormViewerCtrl.MoveToPageIndex(pageIndex);
- }
- void IConsentMain.SetZoomRate(string zoomRate) {
- this.eFormViewerCtrl.SetZoomRate(zoomRate);
- }
- void IConsentMain.EnableDrawing(bool enable) {
- this.eFormViewerCtrl.EnableDrawing(enable);
- }
- bool IConsentMain.IsDrawMode() {
- return this.eFormViewerCtrl.IsDrawMode();
- }
- void IConsentMain.RemoveAllDrawing() {
- this.eFormViewerCtrl.RemoveAllDrawing();
- }
- void IConsentMain.UndoDrawing() {
- this.eFormViewerCtrl.UndoDrawing();
- }
- void IConsentMain.RedoDrawing() {
- this.eFormViewerCtrl.RedoDrawing();
- }
- void IConsentMain.ConfigDrawingPen() {
- this.eFormViewerCtrl.ConfigDrawingPen();
- }
- void IConsentMain.SetFingerScanValue(string controlId, string base64Image) {
- this.eFormViewerCtrl.SetFingerPrintImage(controlId, base64Image, true);
- }
- void IConsentMain.SetSignatureImage(string controlId, string base64Image) {
- this.eFormViewerCtrl.SetSignatureImage(controlId, base64Image, true);
- }
- public CLIP.eForm.ImageView.ImageViewCtrl GetImageViewerCtrl() {
- return this.imageViewCtrl1;
- }
- void IConsentMain.CloseSignaturePopup(string controlId) {
- this.eFormViewerCtrl.CloseSignaturePopup(controlId);
- }
- void IConsentMain.SetRunOption(string optionKey, string optionValue) {
- this.eFormViewerCtrl.SetRunOption(optionKey, optionValue);
- }
- void IConsentMain.TerminateConsentMain() {
- if (this.Parent is System.Windows.Forms.Form) {
- ((Form) this.Parent).DialogResult = DialogResult.Cancel;
- ((Form) this.Parent).Close();
- }
- }
- /// <summary>
- /// 첨지 삭제
- /// </summary>
- void IConsentMain.DeleteAttach() {
- this.eFormViewerCtrl.DeleteAttach();
- }
- /// <summary>
- /// 첨지 추가
- /// </summary>
- void IConsentMain.InsertAttach() {
- this.eFormViewerCtrl.InsertAttach();
- }
- /// <summary>
- /// 환자정보 설정
- /// </summary>
- void IConsentMain.SetPatientInfo() {
- this.patientInfoCtrl.SetPatientInfo();
- }
- /// <summary>
- /// Closes the dual viewer.
- /// </summary>
- public void CloseDualViewer() {
- this.eFormViewerCtrl.CloseDualViewer();
- this.consentCommandCtrl.SetEnableConsentIssueCommands(true);
- this.consentCommandCtrl.SetEnableButtonsByCurrentConsent();
- }
- /// <summary>
- /// 서명 시 이미지 파일 생성 된 후 호출
- /// </summary>
- /// <param name="value">저장 이미지 파일 설명</param>
- private void OnWrittenImageFile(string value) {
- this.consentCommandCtrl.WorkExtraWithSavedImageFiles(value);
- }
- /// <summary>
- /// Called when [written data XML file].
- /// </summary>
- /// <param name="value">The value.</param>
- private void OnWrittenDataXmlFile(string value) {
- string dataXmlValue = string.Empty;
- if (!string.IsNullOrEmpty(value)) {
- XmlDocument xmlDocument = new XmlDocument();
- xmlDocument.Load(value);
- dataXmlValue = xmlDocument.InnerXml;
- outputDataDic = new Dictionary<string, string>();
- XmlNode rootNode = xmlDocument.SelectSingleNode("form-data");
- foreach (XmlNode childNode in rootNode.ChildNodes) {
- string fieldName = string.Empty;
- string fieldValue = string.Empty;
- XmlElement outFieldElement = childNode as XmlElement;
- if (outFieldElement != null) {
- fieldName = outFieldElement.Name;
- if (outFieldElement.ChildNodes.Count > 0
- && outFieldElement.ChildNodes[0] is XmlCDataSection) {
- fieldValue = ((XmlCDataSection) outFieldElement.ChildNodes[0]).InnerText;
- }
- if (outputDataDic.ContainsKey(fieldName)) {
- outputDataDic[fieldName] = fieldValue;
- } else {
- outputDataDic.Add(fieldName, fieldValue);
- }
- }
- }
- if (processResultValues.ContainsKey("OUTPUT_VALUES")) {
- processResultValues["OUTPUT_VALUES"] = outputDataDic;
- } else {
- processResultValues.Add("OUTPUT_VALUES", outputDataDic);
- }
- }
- try {
- //int state = this.consentWebService.CheckConsentState(int.Parse(consentCommandCtrl.CurrentPreviewConsent.ConsentMstRid), consentCommandCtrl.CurrentPreviewConsent.ConsentState);
- //if (state == 1) {
- // MessageBoxDlg.Show(this, "이미 저장된 서식 입니다."
- // , string.Format(Properties.Resources.msg_caption_confirm),
- // MessageBoxButtons.OK, MessageBoxIcon.Information);
- // return;
- //}
- string eptXmlValue = this.eFormViewerCtrl.GetTempSaveForm();
- // Gzip -> base64 인코딩
- eptXmlValue = Convert.ToBase64String(Common.Zip(eptXmlValue));
- dataXmlValue = Convert.ToBase64String(Common.Zip(dataXmlValue));
- bool isSaved = this.consentCommandCtrl.SaveCompleteConsentData(eptXmlValue, dataXmlValue, out object saveResult);
- if (processResultValues.ContainsKey("OTHER_VALUE_1")) {
- processResultValues["OTHER_VALUE_1"] = saveResult;
- } else {
- processResultValues.Add("OTHER_VALUE_1", saveResult);
- }
- if (isSaved) {
- if (ProcessResult != null) {
- ProcessResult.Invoke("SUCCESS");
- }
- } else {
- ProcessResult.Invoke("FAIL");
- }
- } catch (Exception ex) {
- System.Diagnostics.Trace.WriteLine(string.Format("CLIP.eForm error: {0}", ex.Message));
- MessageBoxDlg.Show(true, string.Format(ex.Message)
- , string.Format(Properties.Resources.msg_caption_fail),
- MessageBoxButtons.OK, MessageBoxIcon.Error);
- ProcessResult.Invoke("FAIL");
- } finally {
- this.eFormViewerCtrl.CloseDualViewer();
- }
- }
- private void OnWrittenTempSaveFile(string value) {
- XmlDocument xmlDocument = new XmlDocument();
- xmlDocument.Load(value);
- string eptXmlValue = xmlDocument.InnerXml; // 임시저장 서식 xml
- try {
- string dataXml = this.eFormViewerCtrl.GetDataXml(); // 저장 데이터 xml
- consentCommandCtrl.CurrentPreviewConsent.PrntCnt = eFormViewerCtrl.GetTotalPageCount();
- // Gzip -> base64 인코딩
- eptXmlValue = Convert.ToBase64String(Common.Zip(eptXmlValue));
- dataXml = Convert.ToBase64String(Common.Zip(dataXml));
- consentCommandCtrl.SaveTempConsentData(eptXmlValue, dataXml, false);
- } catch (Exception ex) {
- System.Diagnostics.Trace.WriteLine(string.Format("CLIP.eForm error: {0}", ex.Message));
- return;
- } finally {
- this.eFormViewerCtrl.CloseDualViewer();
- }
- }
- private void OnWrittenTempSave2File(string value) {
- XmlDocument xmlDocument = new XmlDocument();
- xmlDocument.Load(value);
- string eptXmlValue = xmlDocument.InnerXml; // 임시저장 서식 xml
- try {
- string dataXml = this.eFormViewerCtrl.GetDataXml(); // 저장 데이터 xml
- consentCommandCtrl.CurrentPreviewConsent.PrntCnt = eFormViewerCtrl.GetTotalPageCount();
- // Gzip -> base64 인코딩
- eptXmlValue = Convert.ToBase64String(Common.Zip(eptXmlValue));
- dataXml = Convert.ToBase64String(Common.Zip(dataXml));
- consentCommandCtrl.SaveTempConsentData(eptXmlValue, dataXml, true);
- } catch (Exception ex) {
- System.Diagnostics.Trace.WriteLine(string.Format("CLIP.eForm error: {0}", ex.Message));
- return;
- } finally {
- this.eFormViewerCtrl.CloseDualViewer();
- }
- }
- public void SetConsentListSplitPanelVisibility(bool visibility) {
- if (!visibility) {
- this.splitConsent.Panel1Collapsed = true;
- }
- }
- public void SetPatientListSplitPanelVisibility(bool visibility) {
- if (!visibility) {
- this.splitPatient.Panel2Collapsed = true;
- }
- }
- public bool UseFingerScan { get; set; }
- public bool viewStatus { get; set; }
- public bool IsComplete() {
- bool _isComplete = false;
- if (consentCommandCtrl != null && consentCommandCtrl.CurrentPreviewConsent != null) {
- string _state = consentCommandCtrl.CurrentPreviewConsent.ConsentState ?? string.Empty;
- if (_state.Equals("ELECTR_CMP")) {
- _isComplete = true;
- }
- }
- return _isComplete;
- }
- private void panelReview_Resize(object sender, EventArgs e) {
- if (this.pnlViewer.Visible) {
- if (OnResizeReviewConsent != null) {
- OnResizeReviewConsent.Invoke(this, new EventArgs());
- }
- }
- }
- /// <summary>
- /// 동의서 뷰어 컨트롤 OnError 이벤트 핸들러
- /// </summary>
- /// <param name="errorCode">에러코드</param>
- /// <param name="errorMessage">에러 메시지</param>
- private void eFormViewerCtrl_OnError(string errorCode, string errorMessage) {
- }
- /// <summary>
- /// 동의서 뷰어 컨트롤 OnProcess 이벤트 핸들러
- /// </summary>
- /// <param name="eventCode">이벤트 코드</param>
- /// <param name="value">이벤트 값</param>
- private void eFormViewerCtrl_OnProcess(string eventCode, string value) {
- System.Diagnostics.Trace.WriteLine(string.Format("eventCode: {0} - value: {1}", eventCode, value));
- // 동의서의 현제 페이지 번호 설정
- if (eventCode.Equals("PAGING")) {
- this.consentCommandCtrl.OnPaging(this.eFormViewerCtrl.GetCurrentPageIndex());
- }
- // 듀얼 뷰어 버튼 활성화 여부 제어?
- if (eventCode.Equals("DUAL_VIEWER")) {
- if (value.Equals("OPEN")) {
- this.consentListCtrl.Enabled = false;
- this.patientInfoCtrl.Enabled = false;
- this.patientListCtrl.Enabled = false;
- // this.eFormViewerCtrl.SetRunOption("READ_ONLY", "false");
- this.consentCommandCtrl.EnablePenDrawing = true;
- this.consentCommandCtrl.EnablePenConfig = true;
- this.consentCommandCtrl.SetEnablementExecuteWhenDualViewerActive(false);
- }
- if (value.Equals("CLOSE")) {
- this.consentListCtrl.Enabled = true;
- this.patientInfoCtrl.Enabled = true;
- this.patientListCtrl.Enabled = true;
- // this.eFormViewerCtrl.SetRunOption("READ_ONLY", "true");
- this.consentCommandCtrl.EnablePenDrawing = false;
- this.consentCommandCtrl.EnablePenConfig = false;
- this.consentCommandCtrl.onEnableDrawing(false);
- this.eFormViewerCtrl.EnableDrawing(false);
- this.consentCommandCtrl.SetEnablementExecuteWhenDualViewerActive(true);
- }
- }
- // 동의서 작성완료 후 이미지 저장
- if (eventCode.Equals("WRITTEN_IMAGE_FILE")) {
- // bjw, [확인] 시에는 이미지 저장하지 않음
- // dbs227, 확인 저장 시 이미지도 저장 하여야 함
- //if (!consentCommandCtrl.IsComplete)
- {
- this.OnWrittenImageFile(value);
- }
- }
- // 동의서 작성완료 후 Data XML 저장
- if (eventCode.Equals("DATA_XML_PATH")) {
- // [확인] 시에는 임시 저장만 한다.
- if (consentCommandCtrl.IsComplete) {
- //eFormViewerCtrl.TempSave();
- eFormViewerCtrl.TempSave2();
- } else {
- // 작성완료 버튼이 활성화 되어 있을 경우에만 작성완료 로직을 진행한다.
- if (this.consentCommandCtrl.getSaveButton()) {
- this.consentCommandCtrl.setSaveButton(false);
- this.OnWrittenDataXmlFile(value);
- this.consentCommandCtrl.setSaveButton(true);
- this.eFormViewerCtrl.ConfirmSave(true, "");
- }
- }
- }
-
- // 동의서 확인 저장
- if (eventCode.Equals("TEMP_SAVE_PATH2")) {
- this.OnWrittenTempSave2File(value);
- this.eFormViewerCtrl.ConfirmSave(true, "");
- }
- // 동의서 임시저장
- if (eventCode.Equals("TEMP_SAVE_PATH")) {
- // 임시저장 버튼이 활성화 되어 있을 경우에만 임시저장 로직을 진행한다.
- // Ku2.0 연동 시 임시저장 로직을 진행한다.
- // 작성 완료 시
- if (this.consentCommandCtrl.getTempSaveButton() || consentCommandCtrl.IsComplete) {
- this.consentCommandCtrl.setTempSaveButton(false);
- this.OnWrittenTempSaveFile(value);
- if (!consentCommandCtrl.IsComplete) {
- this.consentCommandCtrl.setTempSaveButton(true);
- }
- this.eFormViewerCtrl.ConfirmSave(true, "");
- }
- }
- // 동의서 종이 출력
- if (eventCode.Equals("PRINT_COMPLETE")) {
- //this.consentCommandCtrl.OnPrint(value);
- // dbs227, 출력 로그 업데이트
- // 출력을 위한 호출일 경우 form 을 종료한다
- if (printConsentCount == 0 && ConsentExecuteInfo["printYN"].Equals("Y")) {
- Form parentForm = this.Parent as Form;
- if (parentForm != null) {
- parentForm.Close();
- }
- }
- }
- // dbs227, 동의서 프린트 실패
- if (eventCode.Equals("PRINT_FAIL") || eventCode.Equals("PRINT_CANCEL")) {
- }
- //필수 항목 누락시 메시지 박스 호출
- if (eventCode.Equals("REQUIRED_INPUT_VIOLATION")) {
- this.consentCommandCtrl.OnRequiredInputViolation(value);
- }
- // 펜 그리기 모드 활성화 여부 제어
- if (eventCode.Equals("ENABLE_DRAWING")) {
- if (value.Equals("TRUE")) {
- this.consentCommandCtrl.onEnableDrawing(true);
- } else if (value.Equals("FALSE")) {
- this.consentCommandCtrl.onEnableDrawing(false);
- }
- }
- // 초기화 상태
- if (eventCode.Equals("INITIALIZE_STATE")) {
- if (value.Equals("FormViewInitialized")) {
- viewStatus = true;
- }
- }
- // 그외 이벤트
- // 동의서 저장 버튼 활셩화여부 제어
- // 동의서 임시서장 버튼 활성화 여부 반환(get)
- // 동의서 임시저장 버튼 활성화 여부 제어(set)
- }
- private void eFormViewerCtrl_VisibleChanged(object sender, EventArgs e) {
- if (this.eFormViewerCtrl.Visible) {
- if (this.OnVisibleEFormControl != null) {
- this.OnVisibleEFormControl.Invoke(this, new EventArgs());
- }
- } else {
- if (this.OnInvisibleEFormControl != null) {
- this.OnInvisibleEFormControl.Invoke(this, new EventArgs());
- }
- }
- }
- /// <summary>
- /// startFormCd 를 초기화 한다
- /// </summary>
- public void preParamClean() {
- this.ConsentExecuteInfo["startFormCd"] = string.Empty;
- }
- void IConsentMain.ReInitializeViewer() {
- if (eFormViewerCtrl.GetTotalPageCount() > 0) {
- this.eFormViewerCtrl.ReInitializeViewer();
- }
- this.viewStatus = false;
- }
- public void OnProcessCmdKey(Keys keyData) {
- }
- /// <summary>
- /// OCX 에서 넘겨 받은 FORMCD 리스트를 서버에서 조회해 온다
- /// </summary>
- private void GetConsentListByFormcd() {
- try {
- string[] formCdArr = ConsentExecuteInfo["formCd"].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
- string[] ocrTagArr = ConsentExecuteInfo["ocrCd"].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
- printConsentCount = formCdArr.Length;
- var today = DateTime.Today.ToString("yyyyMMdd");
- for (int i = 0; i < formCdArr.Length; i++) {
- // 서버에서 목록 조회
- ConsentVO[] voArr = consentWebService.GetConsentByFormcd(formCdArr[i], ConsentExecuteInfo["dutinstcd"], today);
- //ConsentVO[] voArr = consentWebService.GetConsentByFormcd(formCdArr[i], ConsentExecuteInfo["dutinstcd"]);
- if (voArr == null || voArr.Length < 1) {
- throw new Exception("지정된 동의서를 찾을 수 없습니다.");
- }
- ConsentVO vo = voArr[0];
- // 현재 preview 할동의서 정보 설정
- //consentCommandCtrl.CurrentPreviewConsent = new PreviewConsent();
- consentCommandCtrl.CurrentPreviewConsent = new PreviewConsent {
- FormRid = vo.formId.ToString(),
- FormCd = vo.formCode.ToString(),
- FormName = vo.formName,
- FormPrintName = vo.formPrntNm,
- PrntCnt = vo.printCnt,
- ConsentMstRid = "-1",
- ConsentState = string.Empty,
- Ocrcode = vo.ocrTag,
- certPass = vo.certPass,
- InputId = consentCommandCtrl.CurrentEndUser.userId,
- InputNm = consentCommandCtrl.CurrentEndUser.userName,
- ReissueConsentMstRid = 0,
- RewriteConsentMstRid = 0,
- OpDiagName = consentCommandCtrl.CurrentTargetPatient.OpDiagName,
- VisitType = consentCommandCtrl.CurrentTargetPatient.ordtype,
- OpName = consentCommandCtrl.CurrentTargetPatient.OpName
- };
- // 출력 연동이 아닌 경우
- if (ConsentExecuteInfo["printYN"].Equals("N")) {
- Dictionary<FOSParameter, string> globalParams = Common.CreateGlobalParamsDictionary(ConsentExecuteInfo["dutinstcd"]);
- List<string> formGuids = new List<string> {
- consentCommandCtrl.CurrentPreviewConsent.FormGuid
- };
- consentCommandCtrl.SetPatientAndUser(globalParams);
- if (ocrTagArr.Length > 0) {
- globalParams[FOSParameter.LIST_OCRCODE] = consentCommandCtrl.CurrentPreviewConsent.Ocrcode = ocrTagArr[i]; // OCR 코드
- } else {
- globalParams[FOSParameter.LIST_OCRCODE] = consentCommandCtrl.CurrentPreviewConsent.Ocrcode = consentCommandCtrl.GetOcrCode(); // OCR 코드
- }
- globalParams[FOSParameter.GLOBAL_MAIN_DR1_NM] = consentCommandCtrl.CurrentTargetPatient.mainDrNm;
- // 빌드를 위한 주석 처리
- // 임시저장의 경우 C 로 설정
- //globalParams[FOSParameter.Device] = "PC";
- //globalParams[FOSParameter.PrintTime] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- //globalParams[FOSParameter.SignTime] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- //globalParams[FOSParameter.PrintIp] = ConsentExecuteInfo["printIP"];
- string fos = Common.getNewFosString(PluginExecuteInfo["formServiceUrl"],
- globalParams,
- null,
- new List<String> { consentCommandCtrl.CurrentPreviewConsent.FormRid });
- consentCommandCtrl.SetEnableButtonsByCurrentConsent();
- // 동의서 열기
- eFormViewerCtrl.OpenFos(fos);
- // 출력 히스토리 기록
- //this.consentCommandCtrl.OnPrint(vo.FormPrintName);
- //------------------------------
- // TODO 자동 듀얼뷰어 실행
- //Boolean openDualView = false;
- Boolean openDualView = (this.consentWebService.getDualViewMode(ConsentExecuteInfo["dutinstcd"],
- ConsentExecuteInfo["ipaddr"]) == "Y") ? true : false;
- if (openDualView) {
- consentCommandCtrl.RunConsentDualView();
- }
- // 배율정보 설정
- consentCommandCtrl.setZoomRate(4);
- //-------------------------------
- if (ConsentExecuteInfo["tempSave"].Equals("N")) { // 지정된 동의서를 열기만 하는 경우
- // 여러 개의 formcd 를 받더라도 첫번째 것만 보여준다
- break;
- } else if (ConsentExecuteInfo["tempSave"].Equals("Y")) { // 임시 저장
- // 동의서 임시저장
- eFormViewerCtrl.TempSave();
- }
- }
- // 출력 연동
- if (ConsentExecuteInfo["printYN"].Equals("Y")) {
- int prntCnt = consentCommandCtrl.CurrentPreviewConsent.PrntCnt;
- // 실행 파라미터에 PRINT_CNT 가 있고 0보다 클 경우 실행 파라미터를 우선으로 한다.
- if (!string.IsNullOrEmpty(ConsentExecuteInfo["printCount"])) {
- int.TryParse(ConsentExecuteInfo["printCount"], out prntCnt);
- }
- Dictionary<string, Dictionary<FOSParameter, string>> formParamsList = new Dictionary<string, Dictionary<FOSParameter, string>>();
- string[] formGuidList = new string[prntCnt];
- string sOcrCd = string.Empty;
- for (int j = 0; j < prntCnt; j++) {
- Dictionary<FOSParameter, string> formParams = Common.CreateGlobalParamsDictionary(ConsentExecuteInfo["dutinstcd"]);
- consentCommandCtrl.SetPatientAndUser(formParams);
- if (ocrTagArr.Length > 0) {
- formParams[FOSParameter.LIST_OCRCODE] = consentCommandCtrl.CurrentPreviewConsent.Ocrcode = ocrTagArr[i];
- } else {
- sOcrCd = formParams[FOSParameter.LIST_OCRCODE] = consentCommandCtrl.CurrentPreviewConsent.Ocrcode = consentCommandCtrl.GetOcrCode();
- }
- // 동일 서식을 2장 있을 출력할 경우, 2장째부터는 OCR 태그가 아닌 [환자보관용] 텍스트가 출력
- //if (j > 0) {
- // var ocrStr = this.consentWebService.getOcrString(consentCommandCtrl.CurrentPreviewConsent.FormCd,
- // ConsentExecuteInfo["dutinstcd"]);
- // if (ocrStr == null) {
- // ocrStr = "[환자 보관용]";
- // }
- // //ocrStr = (ocrStr == n) ? "[환자 보관용]" : ocrStr;
- // //formParams[FOSParameter.OCRCode] = "[환자 보관용]";
- // formParams[FOSParameter.LIST_OCRCODE] = ocrStr;
- //}
- // 빌드를 위한 주석 처리
- //formParams[FOSParameter.Device] = "P";
- //formParams[FOSParameter.PrintTime] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- //formParams[FOSParameter.PrintIp] = ConsentExecuteInfo["printIP"];
- //if (j == 1) formParams[FOSParameter.PrintComment] = Properties.Resources.msg_print_comment_2;
- //else if (j == 2) formParams[FOSParameter.PrintComment] = Properties.Resources.msg_print_comment_3;
- formGuidList[j] = consentCommandCtrl.CurrentPreviewConsent.FormGuid;
- formParamsList.Add((j + 1).ToString(), formParams);
- }
- Dictionary<FOSParameter, string> globalParams = Common.CreateGlobalParamsDictionary(ConsentExecuteInfo["dutinstcd"]);
- globalParams[FOSParameter.GLOBAL_MAIN_DR1_NM] = consentCommandCtrl.CurrentTargetPatient.mainDrNm;
- string fos = Common.getNewFosString(PluginExecuteInfo["formServiceUrl"],
- globalParams,
- null,
- new List<String> { consentCommandCtrl.CurrentPreviewConsent.FormRid });
- String formPrintName = formParamsList["1"][FOSParameter.LIST_FORM_NM];
- this.eFormViewerCtrl.OpenFos(fos);
- // 출력 히스토리 기록
- this.consentCommandCtrl.OnPrint(formPrintName);
- //int testpagecnt = this.eFormViewerCtrl.GetTotalPageCount();
- // dbs227, 출력 로그 업데이트
- // consent_mst 기록
- // InsertPrintData API 추가 후 기록
- //this.consentCommandCtrl.SaveDataForPrintedConsent(String.Empty);
- printConsentCount--;
- this.eFormViewerCtrl.PrintByPrinterName("");
- }
- }
- } catch (Exception ex) {
- MessageBox.Show(ex.ToString());
- throw ex;
- }
- }
- private void btnHelp_Click(object sender, EventArgs e) {
- btnHelp.Enabled = false;
- Application.DoEvents();
- System.Diagnostics.Process.Start(@"https://ema031.knuh.kr:9091/doc/guide.pdf");
- btnHelp.Enabled = true;
- }
- int pageCnt = 0;
- Boolean printButtonClick = false;
- void IConsentMain.setPageCnt(int pageCnt) {
- this.pageCnt = pageCnt;
- //throw new NotImplementedException();
- }
- int IConsentMain.getPageCnt() {
- return this.pageCnt;
- //throw new NotImplementedException();
- }
- void IConsentMain.setPrintButton(bool flag) {
- this.printButtonClick = flag;
- //throw new NotImplementedException();
- }
- bool IConsentMain.getPrintButton() {
- return this.printButtonClick;
- //throw new NotImplementedException();
- }
- }
- }
|