12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544 |
- #region Copyright © 2015 CLIPSOFT Co.,Ltd. All Rights Reserved.
- //
- // All rights are reserved. Reproduction or transmission in whole or in part,
- // in any form or by any means, electronic, mechanical or otherwise, is
- // prohibited without the prior written consent of the copyright owner.
- //
- // Filename: ConsentSvc.asmx.cs
- //
- #endregion
- using System;
- using System.IO;
- using System.Text;
- using System.Xml;
- using System.Collections.Generic;
- using System.Web.Services;
- using System.Collections;
- using IBatisNet.DataMapper;
- using CLIP.eForm.Server.Data;
- using CLIP.eForm.Server.VO;
- using CLIP.eForm.Consent.Dfh.Entity;
- using CLIP.eForm.Consent.Dfh.Dac;
- using CLIP.eForm.Consent.Dfh.Web;
- namespace CLIP.eForm.Consent.Dfh.WebService
- {
- /// <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> 2016-06-15 : 최초작성</p>
- /// <p>----------------------------------------------------------------------------------------</p>
- /// </remarks>
- /// <summary>
- /// ConsentSvc의 요약 설명입니다.
- /// </summary>
- [WebService(Namespace = "http://tempuri.org/")]
- [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
- [System.ComponentModel.ToolboxItem(false)]
- // ASP.NET AJAX를 사용하여 스크립트에서 이 웹 서비스를 호출하려면 다음 줄의 주석 처리를 제거합니다.
- // [System.Web.Script.Services.ScriptService]
- public class ConsentSvc : System.Web.Services.WebService {
- private IBatisHelper _ibatisHelper;
- private static string tempImageDelStatus = string.Empty;
- public ConsentSvc() {
- _ibatisHelper = new IBatisHelper("ConsentSvcOracleMap.config");
- }
- protected override void Dispose(bool disposing) {
- if (IbatisSession != null && IbatisSession.Transaction != null) {
- IbatisSession.CommitTransaction();
- IbatisSession.CloseConnection();
- }
- if (IbatisMapper != null)
- IbatisMapper.CloseConnection();
- base.Dispose(disposing);
- }
- /// <summary>
- /// 현재 연결된 IBatis Connection을 반환
- /// </summary>
- public ISqlMapper IbatisMapper {
- get {
- if (_ibatisHelper == null) {
- return null;
- } else {
- return _ibatisHelper.GetSqlMapper();
- }
- }
- }
- /// <summary>
- /// 현재 연결된 ISqlMapSession 을 반환
- /// </summary>
- public ISqlMapSession IbatisSession {
- get {
- if (_ibatisHelper == null) {
- return null;
- } else {
- return _ibatisHelper.GetMapSession();
- }
- }
- }
- [WebMethod]
- public bool CheckWebService() {
- return true;
- }
- [WebMethod]
- public bool CheckDatabaseConnection() {
- // TODO: 데이터 베이스 커넥션 테스트 호출 필요
- return false;
- }
- // 동의서 하위 카테고리 조회
- [WebMethod(Description = "동의서 하위 카테고리 조회")]
- public List<CategoryForDropdownVO> GetCategoryForDropdown(string categoryId) {
- List<CategoryForDropdownVO> result;
- try {
- using (FormCategoryDac dac = new FormCategoryDac()) {
- Hashtable param = new Hashtable();
- param.Add("category_id", categoryId);
- result = (List<CategoryForDropdownVO>)dac.GetCategoryForDropdown(this.IbatisMapper, param);
- if (categoryId.Equals("1")) {
- CategoryForDropdownVO categoryForDropdownVO = new CategoryForDropdownVO();
- categoryForDropdownVO.CategoryType = "F";
- categoryForDropdownVO.CategoryId = "1CB1B494-1EF0-48BD-84D6-4965A54E6AEA";
- categoryForDropdownVO.CategoryName = "전체";
- result.Insert(0, categoryForDropdownVO);
- } else {
- CategoryForDropdownVO allSubCategory = new CategoryForDropdownVO();
- allSubCategory.CategoryId = categoryId;
- allSubCategory.CategoryName = "전체";
- allSubCategory.CategoryType = "F";
- result.Insert(0, allSubCategory);
- }
- }
- return result;
- } catch (Exception ex) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm error: {0}", ex.Message));
- throw ex;
- }
- }
- // 환자, 상태에 따른 동의서 목록 검색
- [WebMethod(Description = "환자/상태에 따른 동의서 목록 검색")]
- public List<ConsentVO> GetConsentList(string patientCode, string startDt, string endDt, string consentState, string jobkindcd) {
- List<ConsentVO> result;
- try {
- using (ConsentDac dac = new ConsentDac()) {
- Hashtable param = new Hashtable();
- string isnurs = "N";
- param.Add("patientCode", patientCode);
- param.Add("startDt", startDt);
- param.Add("endDt", endDt);
- param.Add("consentState", consentState);
- if (jobkindcd == "1140" || jobkindcd == "1113") {
- isnurs = "Y";
- }
- param.Add("isnurs", isnurs);
- result = (List<ConsentVO>)dac.GetConsentList(this.IbatisMapper, param);
- }
- return result;
- } catch (Exception ex) {
- System.Diagnostics.Trace.WriteLine(string.Format("CLIP.eForm error: {0}", ex.Message));
- throw ex;
- }
- }
- // 동의서 찾기
- [WebMethod(Description = "동의서 찾기(조회)")]
- public List<ConsentBySearchVO> GetConsentBySearch(string categoryId, string keyWord) {
- List<ConsentBySearchVO> result;
- try {
- using (ConsentDac dac = new ConsentDac()) {
- Hashtable param = new Hashtable();
- param.Add("category_id", categoryId);
- param.Add("key_word", string.Format("%{0}%", keyWord));
- result = (List<ConsentBySearchVO>)dac.GetConsentBySearch(this.IbatisMapper, param);
- }
- return result;
- } catch (Exception ex) {
- System.Diagnostics.Trace.WriteLine(string.Format("CLIP.eForm error: {0}", ex.Message));
- throw ex;
- }
- }
- /// <summary>
- /// CONSENT_MST_RID를 갖고 저장된 동의서 이미지를 조회
- /// </summary>
- /// <param name="consentMstRid">동의서 마스터 데이터 Rid</param>
- [WebMethod(Description = "동의서 저장된 이미지 내역 조회")]
- public List<ConsentImageVO> GetConsentImage(string consentMstRid) {
- List<ConsentImageVO> result;
- try {
- using (ConsentDac dac = new ConsentDac()) {
- Hashtable param = new Hashtable();
- int consentMstRidInt = 0;
- int.TryParse(consentMstRid, out consentMstRidInt);
- param.Add("consent-mst-rid", consentMstRidInt);
- result = (List<ConsentImageVO>)dac.GetConsentImage(this.IbatisMapper, param);
- //이미지를 조회한 후, 서버의 임시디렉토리에 파일을 복사해둔다.
- //파일명이 겹칠 수 있으므로 O:\fnuImage\201607\19\100501967 에서 fnuImage20160719100501967 으로 저장한다.
- foreach (ConsentImageVO img in result) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm File Upload Impersonate START workemr"));
- //// 윈도우 계정으로 Impersonate
- ClipSoft.Utility.ImpersonationUtility util = new ClipSoft.Utility.ImpersonationUtility();
- util.ImpersonationStart(string.Empty, "workemr", "workemr");
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm File Upload Impersonate END"));
- // @"\\192.168.0.222\00. 공용폴더\04. 프로그램 및 관련 매뉴얼\5. oracle\oracle"
- //string orgFile = @"\\192.168.100.32\image_a03\fnuImage\201610\13" + "\\" + img.ImageFilename;
- string lastChar = img.ImagePath.Substring(img.ImagePath.Length-1);
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm GetConsentImage lastChar: {0}", lastChar));
- string orgFile = "";
- if (lastChar.Equals("\\"))
- {
- orgFile = img.ImagePath + img.ImageFilename;
- } else
- {
- orgFile = img.ImagePath + "\\" + img.ImageFilename;
- }
-
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm GetConsentImage orgFile: {0}", orgFile));
- string tempImgNm = orgFile.Substring(orgFile.IndexOf("\\") + 1).Replace("\\", "");
- if (!System.IO.File.Exists(Server.MapPath("./DataTempImage/") + tempImgNm)) {
- System.IO.File.Copy(orgFile, Server.MapPath("./DataTempImage/") + tempImgNm);
- }
- // Impersonate 종료
- util.ImpersonationEnd();
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm File Upload Impersonate CLOSE"));
- }
- }
- int iResult = DeleteTempFile();
- return result;
- } catch (Exception ex) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetConsentImage error: {0}", ex.Message));
- throw ex;
- }
- }
- [WebMethod(Description = "테스트 테스트 테스트")]
- public int SaveTempData1(string userId,
- string patientCode,
- string clnDeptCode,
- int formRid,
- string formCd,
- int consentMstRid,
- int rewriteConsentMstRid,
- string formXml,
- string dataXml,
- string deviceType,
- string deviceIdentNo,
- string vistType,
- string hosType,
- string clnDate,
- string ward,
- string roomcd,
- int orderNo,
- string orderName,
- string orderCd,
- string ocrCode,
- int cretno,
- string createUserName,
- string modifyUserName,
- string mainDrId
- ) {
- string paramLog = "";
- paramLog += "clnDept[" + userId + "]patientCode[" + patientCode + "]clnDeptCode[" + clnDeptCode + "]formRid[" + formRid + "]";
- paramLog += "formCd[" + formCd + "]" + "consentMstRid[" + consentMstRid + "]rewriteConsentMstRid[" + rewriteConsentMstRid + "]";
- paramLog += "deviceType[" + deviceType + "]vistType[" + vistType + "]hosType[" + hosType + "]";
- paramLog += "clnDate[" + clnDate + "]ward[" + ward + "]roomcd[" + roomcd + "]orderNo[" + orderNo + "]";
- paramLog += "orderName[" + orderName + "]orderCd[" + orderCd + "]ocrCode[" + ocrCode + "]cretno[" + cretno + "]";
- paramLog += "createUserName[" + createUserName + "]modifyUserName[" + modifyUserName + "]";
- paramLog += "deviceIdentNo[" + deviceIdentNo + "]mainDrId[" + mainDrId + "]";
- paramLog += "dataXml[" + dataXml + "]formXml[" + formXml + "]";
- byte[] byte64 = Convert.FromBase64String(dataXml);
- dataXml = Encoding.UTF8.GetString(byte64);
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("CLIP.eForm SaveTempData param : " + dataXml);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("SaveTempData1 --> ", "!@#!@#!@#!@#!@#!@#!@#!@#"));
- return 1;
- }
- /// <summary>
- /// 전자동의서를 임시저장 한다.
- /// </summary>
- /// <param name="userId">로그인 사용자ID</param>
- /// <param name="patientCode">환자 등록번호</param>
- /// <param name="clnDeptCode">진료과 코드</param>
- /// <param name="formRid">(작성대상)서식 Rid</param>
- /// <param name="formCd">서식코드</param>
- /// <param name="consentMstRid">동의서 마스터 데이터 Rid</param>
- /// <param name="rewriteConsentMstRid">재 작성 대상 동의서 마스터 데이터 Rid</param>
- /// <param name="formXml">동의서 EPT Xml</param>
- /// <param name="dataXml">동의서 Data(필드들) Xml</param>
- /// <param name="deviceType">장비 유형 (WIN, AND, IOS, PRT 중1)</param>
- /// <param name="deviceIdentNo">장비 고유 식별자</param>
- /// <param name="vistType">내원구분</param>
- /// <param name="hosType">병원 구분</param>
- /// <param name="clnDate">병원 구분이 "I" 일 경우 입원일자/병원 구분이 "O"일 경우 진료일자</param>
- /// <param name="ward">병동 코드</param>
- /// <param name="roomcd">병실 코드</param>
- /// <param name="orderNo">처방번호</param>
- /// <param name="orderName">처방명</param>
- /// <param name="orderCd">처방코드</param>
- /// <param name="ocrCode">OCR 코드</param>
- /// <param name="cretno">생성번호</param>
- /// <param name="createUserName">작성자명</param>
- /// <param name="modifyUserName">수정자명</param>
- /// <param name="mainDrId">주치의 아이디</param>
- [WebMethod(Description = "동의서 임시저장")]
- public int SaveTempData(string userId, string patientCode, string clnDeptCode, int formRid, string formCd,
- int consentMstRid, int rewriteConsentMstRid, string formXml, string dataXml,
- string deviceType, string deviceIdentNo, string vistType, string hosType, string clnDate,
- string ward, string roomcd, int orderNo, string orderName, string orderCd, string ocrCode, int cretno,
- string createUserName, string modifyUserName, string mainDrId)
- {
- string paramLog = "";
- paramLog += "clnDept[" + userId + "]patientCode[" + patientCode + "]clnDeptCode[" + clnDeptCode + "]formRid[" + formRid + "]";
- paramLog += "formCd[" + formCd + "]consentMstRid[" + consentMstRid + "]rewriteConsentMstRid[" + rewriteConsentMstRid + "]";
- paramLog += "deviceType[" + deviceType + "]vistType[" + vistType + "]hosType[" + hosType + "]";
- paramLog += "clnDate[" + clnDate + "]ward[" + ward + "]roomcd[" + roomcd + "]orderNo[" + orderNo + "]";
- paramLog += "orderName[" + orderName + "]orderCd[" + orderCd + "]ocrCode[" + ocrCode + "]cretno[" + cretno + "]";
- paramLog += "createUserName[" + createUserName + "]modifyUserName[" + modifyUserName + "]";
- paramLog += "deviceIdentNo[" + deviceIdentNo + "]mainDrId[" + mainDrId + "]";
- paramLog += "dataXml[" + dataXml + "]formXml[" + formXml + "]";
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("CLIP.eForm SaveTempData param : " + paramLog);
- int reissueConsentMstRid = 0;
- string consentState = "TEMP";
- string paperYn = "N";
- string reasonForUseN = string.Empty;
- string verbal = string.Empty;
- byte[] byte64 = Convert.FromBase64String(dataXml);
- dataXml = Encoding.UTF8.GetString(byte64);
- if (!string.IsNullOrEmpty(dataXml))
- {
- Dictionary<string, string> outputDataDic;
- XmlDocument xmlDocument = new XmlDocument();
- xmlDocument.LoadXml(dataXml);
- 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)
- {
- }
- else
- {
- fieldName = outFieldElement.Name;
- if (outFieldElement.ChildNodes.Count == 1
- && outFieldElement.ChildNodes[0] is XmlCDataSection)
- {
- fieldValue = ((XmlCDataSection)outFieldElement.ChildNodes[0]).InnerText;
- if (!string.IsNullOrEmpty(fieldName) && fieldName.Equals("IO_verbal")
- && !string.IsNullOrEmpty(fieldValue) && fieldValue.Equals("Y"))
- {
- consentState = "VERBAL";
- break;
- }
- }
- else if (outFieldElement.ChildNodes.Count > 1)
- {
- foreach (XmlNode childNode2 in childNode.ChildNodes)
- {
- string fieldName2 = string.Empty;
- string fieldValue2 = string.Empty;
- XmlElement outFieldElement2 = childNode2 as XmlElement;
- fieldName2 = outFieldElement2.Name;
- if (outFieldElement2.ChildNodes.Count > 0
- && outFieldElement2.ChildNodes[0] is XmlCDataSection)
- {
- fieldValue2 = ((XmlCDataSection)outFieldElement2.ChildNodes[0]).InnerText;
- if (!string.IsNullOrEmpty(fieldName2) && fieldName2.Equals("IO_verbal")
- && !string.IsNullOrEmpty(fieldValue2) && fieldValue2.Equals("Y"))
- {
- consentState = "VERBAL";
- break;
- }
- }
- }
- }
- }
- }
- }
- rewriteConsentMstRid = 0;
- consentMstRid = SaveData(userId, patientCode, clnDeptCode, formRid, formCd,
- consentMstRid, rewriteConsentMstRid, reissueConsentMstRid, consentState, paperYn, formXml, dataXml,
- deviceType, deviceIdentNo, vistType, hosType, clnDate,
- ward, roomcd, reasonForUseN, orderNo, orderName, orderCd, ocrCode, cretno,
- createUserName, modifyUserName, null, null, null, mainDrId);
- return consentMstRid;
- }
- /// <summary>
- /// 전자 동의서를 완료저장 한다.
- /// </summary>
- /// <param name="userId">로그인 사용자ID</param>
- /// <param name="patientCode">환자 등록번호</param>
- /// <param name="clnDeptCode">진료과 코드</param>
- /// <param name="formRid">(작성대상)서식 Rid</param>
- /// <param name="formCd">서식코드</param>
- /// <param name="consentMstRid">동의서 마스터 데이터 Rid</param>
- /// <param name="rewriteConsentMstRid">재 작성 대상 동의서 마스터 데이터 Rid</param>
- /// <param name="formXml">동의서 EPT Xml</param>
- /// <param name="dataXml">동의서 Data(필드들) Xml</param>
- /// <param name="deviceType">장비 유형 (WIN, AND, IOS, PRT 중1)</param>
- /// <param name="deviceIdentNo">장비 고유 식별자</param>
- /// <param name="vistType">내원구분</param>
- /// <param name="hosType">병원 구분</param>
- /// <param name="clnDate">병원 구분이 "I" 일 경우 입원일자/병원 구분이 "O"일 경우 진료일자</param>
- /// <param name="ward">병동 코드</param>
- /// <param name="roomcd">병실 코드</param>
- /// <param name="orderNo">처방번호</param>
- /// <param name="orderCd">처방코드</param>
- /// <param name="orderName">처방명</param>
- /// <param name="createUserName">작성자명</param>
- /// <param name="modifyUserName">수정자명</param>
- /// <param name="mainDrId">주치의 아이디</param>
- [WebMethod(Description = "동의서 서명 완료")]
- public int SaveComplete(string userId, string patientCode, string clnDeptCode, int formRid, string formCd,
- int consentMstRid, int rewriteConsentMstRid, string formXml, string dataXml,
- string deviceType, string deviceIdentNo, string vistType, string hosType, string clnDate,
- string ward, string roomcd, int orderNo, string orderName, string orderCd, string ocrCode, int cretno,
- string createUserName, string modifyUserName, string mainDrId)
- {
- int reissueConsentMstRid = 0;
- string consentState = "ELECTR_CMP";
- string paperYn = "N";
- string reasonForUseN = string.Empty;
- rewriteConsentMstRid = 0;
- consentMstRid = SaveData(userId, patientCode, clnDeptCode, formRid, formCd,
- consentMstRid, rewriteConsentMstRid, reissueConsentMstRid, consentState, paperYn, formXml, dataXml,
- deviceType, deviceIdentNo, vistType, hosType, clnDate,
- ward, roomcd, reasonForUseN, orderNo, orderName, orderCd, ocrCode, cretno,
- createUserName, modifyUserName, null, null, null, mainDrId);
- return consentMstRid;
- }
- /// <summary>
- /// 전자 동의서를 완료저장 한다.
- /// </summary>
- /// <param name="userId">로그인 사용자ID</param>
- /// <param name="patientCode">환자 등록번호</param>
- /// <param name="clnDeptCode">진료과 코드</param>
- /// <param name="formRid">(작성대상)서식 Rid</param>
- /// <param name="formCd">서식코드</param>
- /// <param name="consentMstRid">동의서 마스터 데이터 Rid</param>
- /// <param name="rewriteConsentMstRid">재 작성 대상 동의서 마스터 데이터 Rid</param>
- /// <param name="formXml">동의서 EPT Xml</param>
- /// <param name="dataXml">동의서 Data(필드들) Xml</param>
- /// <param name="deviceType">장비 유형 (WIN, AND, IOS, PRT 중1)</param>
- /// <param name="deviceIdentNo">장비 고유 식별자</param>
- /// <param name="vistType">내원구분</param>
- /// <param name="hosType">병원 구분</param>
- /// <param name="clnDate">병원 구분이 "I" 일 경우 입원일자/병원 구분이 "O"일 경우 진료일자</param>
- /// <param name="ward">병동 코드</param>
- /// <param name="roomcd">병실 코드</param>
- /// <param name="orderNo">처방번호</param>
- /// <param name="orderCd">처방코드</param>
- /// <param name="orderName">처방명</param>
- /// <param name="createUserName">작성자명</param>
- /// <param name="modifyUserName">수정자명</param>
- /// <param name="imageFileJson">이미지 파일 정보(전자동의서 서버)</param>
- /// <param name="certTarget">이미지 파일 공인인증 대상정보</param>
- /// <param name="certResult">이미지 파일 공인인증 처리정보</param>
- /// <param name="dschdd">퇴원일자</param>
- /// <param name="consentState">상태</param>
- /// <param name="mainDrId">주치의 아이디</param>
- [WebMethod(Description = "동의서 서명 완료")]
- public int SaveCompleteAll(string userId, string patientCode, string clnDeptCode, int formRid, string formCd,
- int consentMstRid, int rewriteConsentMstRid, string formXml, string dataXml,
- string deviceType, string deviceIdentNo, string vistType, string hosType, string clnDate,
- string ward, string roomcd, int orderNo, string orderName, string orderCd, string ocrCode, int cretno,
- string createUserName, string modifyUserName, string imageFileJson, string certTarget, string certResult,
- string dschdd, string consentState, string mainDrId)
- {
- string paramLog = "";
- paramLog += "clnDept[" + userId + "]patientCode[" + patientCode + "]clnDeptCode[" + clnDeptCode + "]formRid[" + formRid + "]";
- paramLog += "formCd[" + formCd + "]consentMstRid[" + consentMstRid + "]rewriteConsentMstRid[" + rewriteConsentMstRid + "]";
- paramLog += "deviceType[" + deviceType + "]vistType[" + vistType + "]hosType[" + hosType + "]";
- paramLog += "clnDate[" + clnDate + "]ward[" + ward + "]roomcd[" + roomcd + "]orderNo[" + orderNo + "]";
- paramLog += "orderName[" + orderName + "]orderCd[" + orderCd + "]ocrCode[" + ocrCode + "]cretno[" + cretno + "]";
- paramLog += "createUserName[" + createUserName + "]modifyUserName[" + modifyUserName + "]imageFileJson[" + imageFileJson + "]certTarget[" + certTarget + "]";
- paramLog += "dschdd[" + dschdd + "]consentState[" + consentState + "]mainDrId[" + mainDrId + "]";
- paramLog += "dataXml[" + dataXml + "]formXml[" + formXml + "]certResult[" + certResult + "]";
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("CLIP.eForm SaveCompleteAll param : " + paramLog);
- int reissueConsentMstRid = 0;
- string paperYn = "N";
- string reasonForUseN = string.Empty;
- byte[] byte64 = Convert.FromBase64String(dataXml);
- dataXml = Encoding.UTF8.GetString(byte64);
- rewriteConsentMstRid = 0;
- consentMstRid = SaveDataAll(userId, patientCode, clnDeptCode, formRid, formCd,
- consentMstRid, rewriteConsentMstRid, reissueConsentMstRid, consentState, paperYn, formXml, dataXml,
- deviceType, deviceIdentNo, vistType, hosType, clnDate,
- ward, roomcd, reasonForUseN, orderNo, orderName, orderCd, ocrCode, cretno,
- createUserName, modifyUserName, imageFileJson, certTarget, certResult, dschdd, mainDrId);
- return consentMstRid;
- }
- /// <summary>
- /// 동의서 삭제/폐기 데이터를 저장 한다.
- /// </summary>
- /// <param name="userId">로그인 사용자ID</param>
- /// <param name="consentMstRid">동의서 마스터 데이터 Rid</param>
- /// <param name="patientCode">환자 등록번호</param>
- /// <param name="clnDeptCode">진료과 코드</param>
- /// <param name="ward">병동 코드</param>
- /// <param name="formRid">(작성대상)서식 Rid</param>
- /// <param name="rewriteConsentMstRid">재 작성 대상 동의서 마스터 데이터 Rid</param>
- /// <param name="reissueConsentMstRid">삭제/폐기 대상 동의서 마스터 데이터 Rid</param>
- /// <param name="consentState">동의서 상태</param>
- /// <param name="deviceIdentNo">장비 고유 식별자</param>
- /// <param name="reasonForUseN">삭제/폐기 사유</param>
- [WebMethod(Description = "동의서 삭제/폐기 데이터를 저장")]
- public int SaveDelete(string userId, int consentMstRidInt, string patientCode, string clnDeptCode,
- string ward, string roomcd, int formRid, int rewriteConsentMstRid, int reissueConsentMstRid,
- string consentState, string deviceIdentNo, string reasonForUseN )
- {
- string paperYn = "N";
- consentMstRidInt = SaveData(userId, patientCode, clnDeptCode, formRid, null,
- consentMstRidInt, rewriteConsentMstRid, reissueConsentMstRid, consentState, paperYn, null, null,
- null, deviceIdentNo, null, null, null,
- ward, roomcd, reasonForUseN, 0, null, null, null, 0,
- null, null, null, null, null, null);
- return consentMstRidInt;
- }
- /// <summary>
- /// 프린트 출력 후 데이터를 저장 한다.
- /// </summary>
- /// <param name="userId">로그인 사용자ID</param>
- /// <param name="patientCode">환자 등록번호</param>
- /// <param name="clnDeptCode">진료과 코드</param>
- /// <param name="formRid">(작성대상)서식 Rid</param>
- /// <param name="formCd">서식코드</param>
- /// <param name="consentMstRid">동의서 마스터 데이터 Rid</param>
- /// <param name="rewriteConsentMstRid">재 작성 대상 동의서 마스터 데이터 Rid</param>
- /// <param name="formXml">동의서 EPT Xml</param>
- /// <param name="dataXml">동의서 Data(필드들) Xml</param>
- /// <param name="deviceType">장비 유형 (WIN, AND, IOS, PRT 중1)</param>
- /// <param name="deviceIdentNo">장비 고유 식별자</param>
- /// <param name="vistType">내원구분</param>
- /// <param name="hosType">병원 구분</param>
- /// <param name="clnDate">병원 구분이 "I" 일 경우 입원일자/병원 구분이 "O"일 경우 진료일자</param>
- /// <param name="ward">병동 코드</param>
- /// <param name="roomcd">병실 코드</param>
- /// <param name="orderNo">처방번호</param>
- /// <param name="orderName">처방명</param>
- /// <param name="orderCd">처방코드</param>
- /// <param name="ocrCode">OCR코드</param>
- /// <param name="cretno">생성번호</param>
- /// <param name="createUserName">작성자명</param>
- /// <param name="modifyUserName">수정자명</param>
- /// <param name="mainDrId">주치의 아이디</param>
- [WebMethod(Description = "동의서 프린트 출력 후 데이터를 저장")]
- public int SavePrintOut(string userId, string patientCode, string clnDeptCode, int formRid, string formCd,
- int consentMstRid, int reissueConsentMstRid, string formXml, string dataXml,
- string deviceType, string deviceIdentNo, string vistType, string hosType, string clnDate,
- string ward, string roomcd, int orderNo, string orderName, string orderCd, string ocrCode, int cretno,
- string createUserName, string modifyUserName, string mainDrId)
- {
- string consentState = "PAPER_OUT";
- string paperYn = "Y";
- consentMstRid = SavePrintData(userId, patientCode, clnDeptCode, formRid, formCd,
- consentMstRid, 0, reissueConsentMstRid, consentState, paperYn, formXml, dataXml,
- deviceType, deviceIdentNo, vistType, hosType, clnDate,
- ward, roomcd, null, orderNo, orderName, orderCd, ocrCode, cretno,
- createUserName, modifyUserName, null, null, null, mainDrId);
- return consentMstRid;
- }
- /// <summary>
- /// 동의서의 기왕력 데이터 저장
- /// </summary>
- /// <param name="patientCode">환자 등록번호</param>
- /// <param name="clnDate">진료일</param>
- /// <param name="bp">고/저혈압</param>
- /// <param name="dm">당뇨병</param>
- /// <param name="heart">심장질환</param>
- /// <param name="kidney">신장질환</param>
- /// <param name="respiration">호흡기질환</param>
- /// <param name="hx">과거병력</param>
- /// <param name="allergy">알레르기</param>
- /// <param name="drug">복용약물</param>
- /// <param name="smoking">흡연상태</param>
- /// <param name="idio">특이체질</param>
- /// <param name="nacrotics">마약사고</param>
- /// <param name="airway">기도이상 유무</param>
- /// <param name="hemorrhage">출혈소인</param>
- /// <param name="status_etc">기타</param>
- /// <param name="userId">로그인 사용자ID</param>
- [WebMethod(Description = "동의서의 기왕력 데이터 저장")]
- public string SaveMedicalHistory(string patientCode, string clnDate,
- string bp, string dm, string heart, string kidney, string respiration,
- string hx, string allergy, string drug, string smoking,
- string idio, string nacrotics, string airway, string hemorrhage, string status_etc,
- string userId)
- {
- try
- {
- using (SaveConsentDac dac = new SaveConsentDac())
- {
- Hashtable paramHashTable = new Hashtable();
- paramHashTable.Add("patientCode", patientCode);
- paramHashTable.Add("clnDate", clnDate);
- paramHashTable.Add("bp", bp);
- paramHashTable.Add("dm", dm);
- paramHashTable.Add("heart", heart);
- paramHashTable.Add("kidney", kidney);
- paramHashTable.Add("respiration", respiration);
- paramHashTable.Add("hx", hx);
- paramHashTable.Add("allergy", allergy);
- paramHashTable.Add("drug", drug);
- paramHashTable.Add("smoking", smoking);
- paramHashTable.Add("idio", idio);
- paramHashTable.Add("nacrotics", nacrotics);
- paramHashTable.Add("airway", airway);
- paramHashTable.Add("hemorrhage", hemorrhage);
- paramHashTable.Add("status_etc", status_etc);
- paramHashTable.Add("userId", userId);
- dac.SetMediHistory(this.IbatisMapper, paramHashTable);
- }
- }
- catch (Exception ex)
- {
- if (this.IbatisSession != null) this.IbatisSession.RollBackTransaction();
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm SaveMedicalHistory ERROR : [{0}]", ex.ToString()));
- throw ex;
- }
- finally
- {
- }
- return patientCode;
- }
- /// <summary>
- /// 동의서 서명 완료일 경우 이미지 데이터 저장
- /// </summary>
- /// <param name="consentState">동의서 상태</param>
- /// <param name="imageFileName">이미지파일명(경로포함)</param>
- /// <param name="consentMstRid">동의서 마스터 데이터 Rid</param>
- /// <param name="userId">등록자ID</param>
- /// <param name="formRid">동의서 FORM ID</param>
- [WebMethod(Description = "동의서 서명 완료일 경우 이미지 데이터 저장")]
- public int SaveImageUploadInfo(string consentState, string imageFileName, int consentMstRid, string userId, int formRid)
- {
- int consentImageRid = 0;
- if (!string.IsNullOrEmpty(consentState) && consentState == "ELECTR_CMP")
- {
- using (SaveConsentDac dac = new SaveConsentDac())
- {
- Hashtable imageHashTable = new Hashtable();
- imageHashTable.Add("consentMstRid", consentMstRid);
- consentImageRid = this.GetSequence("CONSENT_IMAGE");
- imageHashTable.Add("consentImageRid", consentImageRid);
- imageHashTable.Add("userId", userId);
- imageHashTable.Add("formRid", formRid);
- imageHashTable.Add("imagePath", imageFileName.Substring(0, imageFileName.LastIndexOf("\\")));
- imageHashTable.Add("imageFilename", imageFileName.Substring(imageFileName.LastIndexOf("\\") + 1));
- imageHashTable.Add("completeYn", "Y"); //paramHashTable["completeYn"]
- dac.InsertConsentImage(this.IbatisMapper, imageHashTable);
- }
- }
- return consentImageRid;
- }
- /// <summary>
- /// 서명완료된 이미지의 hash 정보 저장
- /// </summary>
- /// <param name="consentState">동의서 상태</param>
- /// <param name="consentMstRid">동의서 마스터 데이터 Rid</param>
- /// <param name="consentImageRid">이미지 데이터 Rid</param>
- /// <param name="userId">등록자ID</param>
- /// <param name="certTarget">hash 정보</param>
- [WebMethod(Description = "서명완료된 이미지의 hash 정보 저장")]
- public void SaveImageSignInfo(string consentState, int consentMstRid, int consentImageRid, string userId, string certTarget, string sCertResult)
- {
- string paramLog = "";
- paramLog += "consentState[" + consentState + "]consentMstRid[" + consentMstRid + "]consentImageRid[" + consentImageRid + "]userId[" + userId + "]";
- paramLog += "certTarget[" + certTarget + "]sCertResult[" + sCertResult + "]";
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("CLIP.eForm SaveTempData param : " + paramLog);
- if (!string.IsNullOrEmpty(consentState) && consentState == "ELECTR_CMP")
- {
- using (SaveConsentDac dac = new SaveConsentDac())
- {
- Hashtable imageHashTable = new Hashtable();
- imageHashTable.Add("consentMstRid", consentMstRid);
- imageHashTable.Add("consentImageRid", consentImageRid);
- imageHashTable.Add("certTarget", certTarget);
- imageHashTable.Add("certResult", sCertResult);
- imageHashTable.Add("userId", userId);
- dac.InsertConsentImageSign(this.IbatisMapper, imageHashTable);
- imageHashTable.Add("consentState", "CERTIFY_CMP");
- dac.UpdateConsentMstStatus(this.IbatisMapper, imageHashTable);
-
- }
- }
- }
- private int SaveData(string userId, string patientCode, string clnDeptCode, int formRid, string formCd,
- int consentMstRid, int rewriteConsentMstRid, int reissueConsentMstRid, string consentState, string paperYn, string formXml, string dataXml,
- string deviceType, string deviceIdentNo, string vistType, string hosType, string clnDate,
- string ward, string roomcd, string reasonForUseN, int orderNo, string orderName, string orderCd, string ocrCode, int cretno,
- string createUserName, string modifyUserName, string imageFileName, string certTarget, string certResult,
- string mainDrId)
- {
- bool isNewConsentMasterCase = false;
- if (consentMstRid < 1)
- {
- isNewConsentMasterCase = true;
- }
- try
- {
- using (SaveConsentDac dac = new SaveConsentDac())
- {
- Hashtable paramHashTable = GetParamHashTable(userId, patientCode, clnDeptCode, formRid, formCd, consentMstRid, rewriteConsentMstRid,
- reissueConsentMstRid, consentState, paperYn, formXml, dataXml, deviceType, deviceIdentNo,
- vistType, hosType, clnDate, ward, roomcd, reasonForUseN,
- orderNo, orderName, orderCd, ocrCode, cretno, createUserName, modifyUserName,
- certTarget, certResult, mainDrId);
- consentMstRid = (int)paramHashTable["consentMstRid"];
- //새로 작성하는 경우
- if (isNewConsentMasterCase)
- {
- dac.InsertConsentMst(this.IbatisMapper, paramHashTable);
- dac.InsertConsentData(this.IbatisMapper, paramHashTable);
- //ImageUploadInfo(dac, consentState, imageFileName, paramHashTable, consentMstRid, userId, formRid, deviceType);
- }
- //새로 작성 아닌 경우
- else
- {
- if (reissueConsentMstRid > 0)
- {
- if (string.IsNullOrEmpty(reasonForUseN))
- {
- //종이->종이 재발행
- int newConsentMstRid = this.GetSequence("CONSENT_MST");
- paramHashTable["consentMstRid"] = newConsentMstRid;
- consentMstRid = newConsentMstRid;
- dac.InsertConsentMst(this.IbatisMapper, paramHashTable);
- dac.InsertConsentData(this.IbatisMapper, paramHashTable);
- //ImageUploadInfo(dac, consentState, imageFileName, paramHashTable, consentMstRid, userId, formRid, deviceType);
- }
- else
- {
- dac.UpdateConsentMstForDelete(this.IbatisMapper, paramHashTable);
- }
-
- }
- //임시저장 또는 저장인 경우
- else
- {
- dac.UpdateConsentMst(this.IbatisMapper, paramHashTable);
- dac.InsertConsentData(this.IbatisMapper, paramHashTable);
- //ImageUploadInfo(dac, consentState, imageFileName, paramHashTable, consentMstRid, userId, formRid, deviceType);
- }
- }
- if (!string.IsNullOrEmpty(dataXml))
- {
- Dictionary<string, string> outputDataDic = DataXmlToDictionary(dataXml);
-
- Hashtable paramHashTableForMediHistory = new Hashtable();
- paramHashTableForMediHistory.Add("patientCode", patientCode);
- paramHashTableForMediHistory.Add("clnDate", clnDate.Replace("-", ""));
- paramHashTableForMediHistory.Add("bp", outputDataDic.ContainsKey("IO_bp") ? outputDataDic["IO_bp"] : "");
- paramHashTableForMediHistory.Add("dm", outputDataDic.ContainsKey("IO_dm") ? outputDataDic["IO_dm"] : "");
- paramHashTableForMediHistory.Add("heart", outputDataDic.ContainsKey("IO_heart") ? outputDataDic["IO_heart"] : "");
- paramHashTableForMediHistory.Add("kidney", outputDataDic.ContainsKey("IO_kidney") ? outputDataDic["IO_kidney"] : "");
- paramHashTableForMediHistory.Add("respiration", outputDataDic.ContainsKey("IO_respiration") ? outputDataDic["IO_respiration"] : "");
- paramHashTableForMediHistory.Add("hx", outputDataDic.ContainsKey("IO_hx") ? outputDataDic["IO_hx"] : "");
- paramHashTableForMediHistory.Add("allergy", outputDataDic.ContainsKey("IO_allergy") ? outputDataDic["IO_allergy"] : "");
- paramHashTableForMediHistory.Add("drug", outputDataDic.ContainsKey("IO_drug") ? outputDataDic["IO_drug"] : "");
- paramHashTableForMediHistory.Add("smoking", outputDataDic.ContainsKey("IO_smoking") ? outputDataDic["IO_smoking"] : "");
- paramHashTableForMediHistory.Add("idio", outputDataDic.ContainsKey("IO_idio") ? outputDataDic["IO_idio"] : "");
- paramHashTableForMediHistory.Add("nacrotics", outputDataDic.ContainsKey("IO_nacrotics") ? outputDataDic["IO_nacrotics"] : "");
- paramHashTableForMediHistory.Add("airway", outputDataDic.ContainsKey("IO_airway") ? outputDataDic["IO_airway"] : "");
- paramHashTableForMediHistory.Add("hemorrhage", outputDataDic.ContainsKey("IO_hemorrhage") ? outputDataDic["IO_hemorrhage"] : "");
- paramHashTableForMediHistory.Add("status_etc", outputDataDic.ContainsKey("IO_status_etc") ? outputDataDic["IO_status_etc"] : "");
- paramHashTableForMediHistory.Add("userId", userId);
- dac.SetMediHistory(this.IbatisMapper, paramHashTableForMediHistory);
- }
- }
- }
- catch (Exception ex)
- {
- if (this.IbatisSession != null) this.IbatisSession.RollBackTransaction();
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm SaveData ERROR : [{0}]", ex.ToString()));
- throw ex;
- }
- finally
- {
- }
- return consentMstRid;
- }
- private int SaveDataAll(string userId, string patientCode, string clnDeptCode, int formRid, string formCd,
- int consentMstRid, int rewriteConsentMstRid, int reissueConsentMstRid, string consentState, string paperYn, string formXml, string dataXml,
- string deviceType, string deviceIdentNo, string vistType, string hosType, string clnDate,
- string ward, string roomcd, string reasonForUseN, int orderNo, string orderName, string orderCd, string ocrCode, int cretno,
- string createUserName, string modifyUserName, string imageFileJson, string certTarget,
- string certResult, string dschdd, string mainDrId)
- {
- bool isNewConsentMasterCase = false;
- if (consentMstRid < 1)
- {
- isNewConsentMasterCase = true;
- }
- try
- {
- using (SaveConsentDac dac = new SaveConsentDac())
- {
- Hashtable paramHashTable = GetParamHashTable(userId, patientCode, clnDeptCode, formRid, formCd, consentMstRid, rewriteConsentMstRid,
- reissueConsentMstRid, consentState, paperYn, formXml, dataXml, deviceType, deviceIdentNo,
- vistType, hosType, clnDate, ward, roomcd, reasonForUseN,
- orderNo, orderName, orderCd, ocrCode, cretno, createUserName, modifyUserName,
- certTarget, certResult, mainDrId);
- consentMstRid = (int)paramHashTable["consentMstRid"];
- //새로 작성하는 경우
- if (isNewConsentMasterCase)
- {
- dac.InsertConsentMst(this.IbatisMapper, paramHashTable);
- dac.InsertConsentData(this.IbatisMapper, paramHashTable);
- imageUpload(dac, paramHashTable, userId
- , patientCode, vistType, clnDate, dschdd, cretno, ocrCode
- , consentMstRid, consentState, formCd, formRid, dataXml, imageFileJson, certTarget, certResult, hosType, createUserName);
- }
- //새로 작성 아닌 경우
- else
- {
- if (reissueConsentMstRid > 0)
- {
- if (string.IsNullOrEmpty(reasonForUseN))
- {
- //종이->종이 재발행
- int newConsentMstRid = this.GetSequence("CONSENT_MST");
- paramHashTable["consentMstRid"] = newConsentMstRid;
- consentMstRid = newConsentMstRid;
- dac.InsertConsentMst(this.IbatisMapper, paramHashTable);
- dac.InsertConsentData(this.IbatisMapper, paramHashTable);
-
- imageUpload(dac, paramHashTable, userId
- , patientCode, vistType, clnDate, dschdd, cretno, ocrCode
- , consentMstRid, consentState, formCd, formRid, dataXml, imageFileJson, certTarget, certResult, hosType, createUserName);
- }
- else
- {
- dac.UpdateConsentMstForDelete(this.IbatisMapper, paramHashTable);
- }
- }
- //임시저장 또는 저장인 경우
- else
- {
- dac.UpdateConsentMst(this.IbatisMapper, paramHashTable);
- dac.InsertConsentData(this.IbatisMapper, paramHashTable);
-
- imageUpload(dac, paramHashTable, userId
- , patientCode, vistType, clnDate, dschdd, cretno, ocrCode
- , consentMstRid, consentState, formCd, formRid, dataXml, imageFileJson, certTarget, certResult, hosType, createUserName);
- }
- }
- if (!string.IsNullOrEmpty(dataXml))
- {
- Dictionary<string, string> outputDataDic = DataXmlToDictionary(dataXml);
- Hashtable paramHashTableForMediHistory = new Hashtable();
- paramHashTableForMediHistory.Add("patientCode", patientCode);
- paramHashTableForMediHistory.Add("clnDate", clnDate.Replace("-", ""));
- paramHashTableForMediHistory.Add("bp", outputDataDic.ContainsKey("IO_bp") ? outputDataDic["IO_bp"] : "");
- paramHashTableForMediHistory.Add("dm", outputDataDic.ContainsKey("IO_dm") ? outputDataDic["IO_dm"] : "");
- paramHashTableForMediHistory.Add("heart", outputDataDic.ContainsKey("IO_heart") ? outputDataDic["IO_heart"] : "");
- paramHashTableForMediHistory.Add("kidney", outputDataDic.ContainsKey("IO_kidney") ? outputDataDic["IO_kidney"] : "");
- paramHashTableForMediHistory.Add("respiration", outputDataDic.ContainsKey("IO_respiration") ? outputDataDic["IO_respiration"] : "");
- paramHashTableForMediHistory.Add("hx", outputDataDic.ContainsKey("IO_hx") ? outputDataDic["IO_hx"] : "");
- paramHashTableForMediHistory.Add("allergy", outputDataDic.ContainsKey("IO_allergy") ? outputDataDic["IO_allergy"] : "");
- paramHashTableForMediHistory.Add("drug", outputDataDic.ContainsKey("IO_drug") ? outputDataDic["IO_drug"] : "");
- paramHashTableForMediHistory.Add("smoking", outputDataDic.ContainsKey("IO_smoking") ? outputDataDic["IO_smoking"] : "");
- paramHashTableForMediHistory.Add("idio", outputDataDic.ContainsKey("IO_idio") ? outputDataDic["IO_idio"] : "");
- paramHashTableForMediHistory.Add("nacrotics", outputDataDic.ContainsKey("IO_nacrotics") ? outputDataDic["IO_nacrotics"] : "");
- paramHashTableForMediHistory.Add("airway", outputDataDic.ContainsKey("IO_airway") ? outputDataDic["IO_airway"] : "");
- paramHashTableForMediHistory.Add("hemorrhage", outputDataDic.ContainsKey("IO_hemorrhage") ? outputDataDic["IO_hemorrhage"] : "");
- paramHashTableForMediHistory.Add("status_etc", outputDataDic.ContainsKey("IO_status_etc") ? outputDataDic["IO_status_etc"] : "");
- paramHashTableForMediHistory.Add("userId", userId);
- dac.SetMediHistory(this.IbatisMapper, paramHashTableForMediHistory);
- }
- }
- }
- catch (Exception ex)
- {
- if (this.IbatisSession != null) this.IbatisSession.RollBackTransaction();
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm SaveDataAll ERROR : [{0}]", ex.ToString()));
- throw ex;
- }
- finally
- {
- }
- return consentMstRid;
- }
- private void imageUpload(SaveConsentDac dac
- , Hashtable paramHashTable
- , string userId
- , string patientCode
- , string visitType
- , string clnDate
- , string Dschdd
- , int cretno
- , string ocrcode
- , int consentMstRid
- , string consentState
- , string formCd
- , int formRid
- , string dataXml
- , string imageFileJson
- , string certTarget
- , string certResult
- , string hosType
- , string createUserName
- )
- {
- // 서명 저장일 경우 emrindxm 테이블에 저장
- if (!string.IsNullOrEmpty(consentState) && ( consentState.Equals("ELECTR_CMP") || consentState.Equals("CERTIFY_CMP")) )
- {
- string clnDeptCode = paramHashTable["clnDeptCd"] == null ? string.Empty : paramHashTable["clnDeptCd"].ToString();
- try
- {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm File Upload imageFileJson[{0}]", imageFileJson));
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm File Upload consentState[{0}]", consentState));
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm File Upload certTarget[{0}]", certTarget));
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm File Upload paramHashTable[certTarget[{0}]", paramHashTable["certTarget"]));
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm File Upload certResult[{0}]", certResult));
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm File Upload paramHashTable[certResult[{0}]", paramHashTable["certResult"]));
- int consentImageRid = this.GetSequence("CONSENT_IMAGE");
- //if (consentState.Equals("CERTIFY_CMP"))
- //{
- paramHashTable.Add("consentImageRid", consentImageRid);
- // 사인정보 저장
- dac.InsertConsentImageSign(this.IbatisMapper, paramHashTable);
- //}
- string sPath = string.Empty;
- string sFileName = string.Empty;
- string newFileFullName = string.Empty;
- if (!string.IsNullOrEmpty(imageFileJson))
- {
- Dictionary<string, object> jsonRoot = null;
- jsonRoot = fastJSON.JSON.Parse(imageFileJson) as Dictionary<string, object>;
- if (jsonRoot != null && jsonRoot.Count > 0)
- {
- Hashtable imageHashTable = new Hashtable();
- int nowCnt = 1;
- foreach (KeyValuePair<string, object> jr in jsonRoot)
- {
- imageHashTable = new Hashtable();
- imageHashTable.Add("consentMstRid", consentMstRid);
- if(nowCnt > 1) consentImageRid = this.GetSequence("CONSENT_IMAGE");
- imageHashTable.Add("consentImageRid", consentImageRid);
- imageHashTable.Add("userId", userId);
- imageHashTable.Add("formRid", formRid);
- if (jr.Value != null && !string.IsNullOrEmpty(jr.Value.ToString()))
- {
- sPath = "";
- sFileName = "";
- string[] filepath = jr.Value.ToString().Split('/');
- for (int i = 0; i < filepath.Length; i++)
- {
- if (i == 0)
- {
- sPath = filepath[i];
- }
- else if ((i + 1) == filepath.Length)
- {
- sFileName = filepath[i];
- }
- else
- {
- sPath += "/" + filepath[i];
- }
- }
- newFileFullName = string.Empty;
- using (HospitalSvc hospitalWebService = new HospitalSvc())
- {
- newFileFullName = hospitalWebService.GetFileName(patientCode, visitType,
- clnDate.Replace("-", ""), Dschdd, string.Format("{0}", cretno),
- "500", formCd, nowCnt.ToString(),
- ocrcode, userId, clnDeptCode);
- }
- //if (string.IsNullOrEmpty(newFileFullName))
- string uploadFileName = newFileFullName + ".jpg";
- string sUploadPath = uploadFileName.Substring(0, uploadFileName.LastIndexOf("\\") + 1);
- string sUploadFileName = uploadFileName.Substring(uploadFileName.LastIndexOf("\\") + 1);
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm File Upload localpath[{0}]", Server.MapPath(string.Format("./UPLOAD/{0}/{1}", sPath, sFileName))));
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm File Upload uploadFileName[{0}]", uploadFileName));
- if(uploadFileName.Length > 5)
- {
- if (Convert.ToInt16(uploadFileName.Substring(5, 1)) < 10) {
- uploadFileName = string.Format("\\\\192.168.100.32\\image_a0{0}", uploadFileName.Substring(5));
- }
- else
- {
- uploadFileName = string.Format("\\\\192.168.100.32\\image_a{0}", uploadFileName.Substring(5));
- }
-
- }
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm File Upload uploadFileName[{0}]", uploadFileName));
- //// 윈도우 계정으로 Impersonate
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm File Upload Impersonate START workemr"));
- ClipSoft.Utility.ImpersonationUtility util = new ClipSoft.Utility.ImpersonationUtility();
- util.ImpersonationStart(string.Empty, "workemr", "workemr");
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm File Upload Impersonate END"));
- // 디렉토리 존재여부 체크
- DirectoryInfo di = new DirectoryInfo(uploadFileName.Substring(0, uploadFileName.LastIndexOf("\\") + 1));
- if (di.Exists == false)
- {
- di.Create();
- }
- // 파일 저장
- System.IO.File.Copy(Server.MapPath(string.Format("./UPLOAD/{0}/{1}", sPath, sFileName)), uploadFileName);
- // Impersonate 종료
- util.ImpersonationEnd();
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm File Upload Impersonate CLOSE"));
- imageHashTable.Add("imagePath", sUploadPath);
- imageHashTable.Add("imageFilename", sUploadFileName);
- imageHashTable.Add("completeYn", paramHashTable["completeYn"]);
- dac.InsertConsentImage(this.IbatisMapper, imageHashTable);
- }
- nowCnt++;
- }
- }
- }
- //if (patientCode.Equals("0586244"))
- //{
- // throw new Exception();
- //}
- }
- catch (Exception ex)
- {
- using (HospitalSvc hospitalWebService = new HospitalSvc())
- {
- hospitalWebService.delEformData(patientCode, visitType,
- clnDate.Replace("-", ""), Dschdd, string.Format("{0}", cretno),
- formCd, ocrcode, userId, createUserName, string.Format("{0}", consentMstRid), hosType,
- clnDeptCode);
- }
- if (this.IbatisSession != null) this.IbatisSession.RollBackTransaction();
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm imageUpload ERROR : [{0}]", ex.ToString()));
- throw ex;
- }
- }
- }
- private int SavePrintData(string userId, string patientCode, string clnDeptCode, int formRid, string formCd,
- int consentMstRid, int rewriteConsentMstRid, int reissueConsentMstRid, string consentState, string paperYn, string formXml, string dataXml,
- string deviceType, string deviceIdentNo, string vistType, string hosType, string clnDate,
- string ward, string roomcd, string reasonForUseN, int orderNo, string orderName, string orderCd, string ocrCode, int cretno,
- string createUserName, string modifyUserName, string imageFileName, string certTarget,
- string certResult, string mainDrId)
- {
- bool isNewConsentMasterCase = false;
- if (consentMstRid < 1)
- {
- isNewConsentMasterCase = true;
- }
- try
- {
- using (SaveConsentDac dac = new SaveConsentDac())
- {
- Hashtable paramHashTable = GetParamHashTable(userId, patientCode, clnDeptCode, formRid, formCd, consentMstRid, rewriteConsentMstRid,
- reissueConsentMstRid, consentState, paperYn, formXml, dataXml, deviceType, deviceIdentNo,
- vistType, hosType, clnDate, ward, roomcd, reasonForUseN,
- orderNo, orderName, orderCd, ocrCode, cretno, createUserName, modifyUserName,
- certTarget, certResult, mainDrId);
- consentMstRid = (int)paramHashTable["consentMstRid"];
- //새로 출력하는 경우
- if (isNewConsentMasterCase)
- {
- dac.InsertConsentMst(this.IbatisMapper, paramHashTable);
- }
- //새로 작성 아닌 경우
- else
- {
- if (reissueConsentMstRid > 0)
- dac.UpdateConsentMstForReissue(this.IbatisMapper, paramHashTable);
- else
- dac.UpdateConsentMst(this.IbatisMapper, paramHashTable);
- }
- }
- }
- catch (Exception ex)
- {
- if (this.IbatisSession != null) this.IbatisSession.RollBackTransaction();
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm SaveData ERROR : [{0}]", ex.ToString()));
- throw ex;
- }
- finally
- {
- }
- return consentMstRid;
- }
- private static Dictionary<string, string> DataXmlToDictionary(string dataXml)
- {
- Dictionary<string, string> outputDataDic;
- XmlDocument xmlDocument = new XmlDocument();
- xmlDocument.LoadXml(dataXml);
- 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)
- {
- }
- else
- {
- fieldName = outFieldElement.Name;
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("DataXmlToDictionary 0 : {0}/{1}", outFieldElement.ChildNodes.Count, fieldName));
- if (outFieldElement.ChildNodes.Count == 1
- && outFieldElement.ChildNodes[0] is XmlCDataSection)
- {
- fieldValue = ((XmlCDataSection)outFieldElement.ChildNodes[0]).InnerText;
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("DataXmlToDictionary 1 : {0}/{1}", fieldName, fieldValue));
- if (outputDataDic.ContainsKey(fieldName))
- {
- outputDataDic[fieldName] = fieldValue;
- }
- else
- {
- outputDataDic.Add(fieldName, fieldValue);
- }
- }
- else if (outFieldElement.ChildNodes.Count > 1)
- {
- foreach (XmlNode childNode2 in childNode.ChildNodes)
- {
- string fieldName2 = string.Empty;
- string fieldValue2 = string.Empty;
- XmlElement outFieldElement2 = childNode2 as XmlElement;
- fieldName2 = outFieldElement2.Name;
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("DataXmlToDictionary : {0}", fieldName2));
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("DataXmlToDictionary : {0}", outFieldElement2.ChildNodes.Count));
- if (outFieldElement2.ChildNodes.Count > 0
- && outFieldElement2.ChildNodes[0] is XmlCDataSection)
- {
- fieldValue2 = ((XmlCDataSection)outFieldElement2.ChildNodes[0]).InnerText;
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("DataXmlToDictionary 2 : {0}/{1}", fieldName2, fieldValue2));
- }
- if (outputDataDic.ContainsKey(fieldName2))
- {
- outputDataDic[fieldName2] = fieldValue2;
- }
- else
- {
- outputDataDic.Add(fieldName2, fieldValue2);
- }
- }
- }
- }
- }
- return outputDataDic;
- }
- /// <summary>
- /// EFORM_CODE에 정의하는 시퀀스(채번)을 구한다.
- /// </summary>
- /// <param name="sSubCd"></param>
- /// <returns></returns>
- private int GetSequence(string sSubCd)
- {
- int nSeq = -1;
- try
- {
- using (CommonCodeDac dac = new CommonCodeDac())
- {
- Code param = new Code();
- param.sub_cd = sSubCd;
- nSeq = dac.GetSequence(this.IbatisMapper, param);
- if (nSeq == 0)
- {
- dac.InsertSequence(this.IbatisMapper, param);
- nSeq = 1;
- }
- else
- {
- param.ud1_num = ++nSeq;
- dac.UpdateSequence(this.IbatisMapper, param);
- }
- }
- }
- catch (Exception ex)
- {
- if (this.IbatisSession != null) this.IbatisSession.RollBackTransaction();
- throw ex;
- }
- return nSeq;
- }
- #region GetParamHashTable
- private Hashtable GetParamHashTable(string userId, // 사용자 Id
- string patientCode, // 환자 등록번호
- string clnDeptCode, // 진료과 코드
- int formRid, // (작성대상)서식 Rid
- string formCd, // 서식코드 === CONSENT_DATA_CHOICE에서 입력여부 판단할 파라미터
- int consentMstRid, // 동의서 마스터 데이터 Rid
- int rewriteConsentMstRid, // 재 작성 대상 동의서 마스터 데이터 Rid
- int reissueConsentMstRid, // 재 발행 대상 동의서 마스터 데이터 Rid
- string consentState, // 동의서 상태 (TEMP, PAPER_OUT, ELECTR_CMP, CERTIFY_CMP)
- string paperYn, // 인쇄 발행 여부
- string formXml, // 동의서 EPT Xml
- string dataXml, // 동의서 Data(필드들) Xml
- string deviceType, // 장비 유형 (WIN, AND, IOS, PRT 중1)
- string deviceIdentNo, // 장비 고유식별 번호
- string vistType, // 내원 구분
- string hosType, // 병원 구분
- string clnDate, // 내원구분에 따른 입원일자/진료일자
- string ward, // 병동 코드
- string roomcd, // 병실 코드
- string reasonForUseN, // 출력된 동의서 폐기 사유
- int orderNo, // 처방번호
- string orderName, // 처방명
- string orderCd, // 처방코드
- string ocrCode, // OCR 코드
- int cretno, // 생성번호
- string createUserName, // 작성자명
- string modifyUserName, // 수정자명
- string certTarget, // 서명데이터 원본
- string certResult, // 서명데이터 결과값
- string mainDrId // 주치의 아이디
- )
- {
- Hashtable paramHashTable = new Hashtable();
- paramHashTable.Add("userId", userId);
- if (consentMstRid < 1)
- {
- // insert case
- consentMstRid = this.GetSequence("CONSENT_MST");
- }
- paramHashTable.Add("consentMstRid", consentMstRid);
- paramHashTable.Add("patientCode", patientCode);
- paramHashTable.Add("clnDeptCd", clnDeptCode);
- paramHashTable.Add("vistType", vistType);
- paramHashTable.Add("hosType", hosType);
- paramHashTable.Add("clnDate", clnDate);
- paramHashTable.Add("ward", ward);
- paramHashTable.Add("roomcd", roomcd);
- paramHashTable.Add("orderNo", orderNo);
- paramHashTable.Add("orderName", orderName);
- paramHashTable.Add("orderCd", orderCd);
- paramHashTable.Add("ocrCode", ocrCode);
- paramHashTable.Add("cretno", cretno);
- paramHashTable.Add("createUserName", createUserName);
- paramHashTable.Add("modifyUserName", modifyUserName);
- paramHashTable.Add("formRid", formRid);
- paramHashTable.Add("formCd", formCd);
- paramHashTable.Add("consentState", consentState);
- paramHashTable.Add("certTarget", certTarget);
- paramHashTable.Add("certResult", certResult);
- paramHashTable.Add("mainDrId", mainDrId);
- Encoding encoding = Encoding.GetEncoding("UTF-8");
- //if (certResult != null)
- //{
- // paramHashTable.Add("certResult", encoding.GetBytes(certResult));
- //}
- string completeYn = "N"; // 완료 여부
- switch (consentState)
- {
- case "ELECTR_CMP":
- case "CERTIFY_CMP":
- completeYn = "Y";
- break;
- default:
- break;
- }
- paramHashTable.Add("completeYn", completeYn);
- string completeDateTimeToChars = string.Empty;
- if (completeYn.Equals("Y"))
- {
- completeDateTimeToChars = "TO_CHAR(SYSDATE,'YYYY-MM-DD hh24:mi:ss')";
- paramHashTable.Add("completeDateTimeToChars", completeDateTimeToChars);
- }
- else
- {
- paramHashTable.Add("completeDateTimeToChars", "''");
- }
- paramHashTable.Add("paperYn", paperYn);
- string rewriteYn = "N"; // 재 작성 여부
- if (rewriteConsentMstRid > 1)
- {
- rewriteYn = "Y";
- }
- paramHashTable.Add("rewriteYn", rewriteYn);
- paramHashTable.Add("rewriteConsentMstRid", rewriteConsentMstRid);
- string reissueYn = "N"; // 재 발행(종이) 여부
- if (reissueConsentMstRid > 1)
- {
- reissueYn = "Y";
- }
- paramHashTable.Add("reissueYn", reissueYn);
- paramHashTable.Add("reissueConsentMstRid", reissueConsentMstRid);
- int consentDataRid = this.GetSequence("CONSENT_DATA");
- paramHashTable.Add("consentDataRid", consentDataRid);
- paramHashTable.Add("useYn", "Y");
- encoding = Encoding.GetEncoding("UTF-8");
- byte[] formBytesConent = null;
- if (!string.IsNullOrEmpty(formXml))
- {
- formBytesConent = encoding.GetBytes(formXml);
- }
- byte[] dataBytesConent = null;
- if (!string.IsNullOrEmpty(dataXml))
- {
- dataBytesConent = encoding.GetBytes(dataXml);
- }
- paramHashTable.Add("formXml", formBytesConent);
- paramHashTable.Add("dataXml", dataBytesConent);
- paramHashTable.Add("deviceType", deviceType);
- paramHashTable.Add("deviceIdentNo", deviceIdentNo);
- paramHashTable.Add("reasonForUseN", reasonForUseN);
- return paramHashTable;
- }
- #endregion
- //임시파일 삭제 (1일전 파일은 삭제)
- //public int DeleteTempFile(string targetDate)
- public int DeleteTempFile()
- {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("DeleteTempFile DateTime.Now.AddDays(-1) : {0}", DateTime.Now.AddDays(-1).ToString())); // 2016-11-06 오후 8:19:56
- if(tempImageDelStatus.Equals(DateTime.Now.AddDays(-1).ToString().Substring(0, 10).Replace("-", "")))
- {
- return 1;
- }
- try
- {
- string sSeverImgPath = Server.MapPath("./DataTempImage/");
- DirectoryInfo di = new System.IO.DirectoryInfo(sSeverImgPath);
- if (Directory.Exists(sSeverImgPath))
- {
- string[] filePaths = Directory.GetFiles(sSeverImgPath);
- foreach (string fileName in filePaths)
- {
- FileInfo fileInfo = new FileInfo(fileName);
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("DeleteTempFile fileInfo.CreationTime : {0}", fileInfo.CreationTime.ToString()));
- if (fileInfo.CreationTime < DateTime.Now.AddDays(-1))
- {
- fileInfo.Delete();
- }
- }
- }
- tempImageDelStatus = DateTime.Now.AddDays(-1).ToString().Substring(0,10).Replace("-","");
- return 1;
- }
- catch
- {
- return -1;
- }
- }
- //동의서 로드 전 consent_mst_rid에 해당하는 동의서가 상위 상태값이 있는지 체크
- [WebMethod(Description = "동의서 상위 상태값이 있는지 체크")]
- public int CheckConsentState(int consentmstrid, string consent_state)
- {
- try
- {
- int result = -1;
- int StateNo = 0;
- String CurState;
- using (ConsentDac dac = new ConsentDac())
- {
- Hashtable param = new Hashtable();
- param.Add("consentmstrid", consentmstrid);
- CurState = dac.GetConsentStateCheck(this.IbatisMapper, param);
- }
- if(CurState == null){
- return result;
- }else if (CurState.Equals("UNFINISHED")){
- StateNo = 1;
- }else if (CurState.Equals("TEMP")){
- StateNo = 2;
- }else if (CurState.Equals("VERBAL")){
- StateNo = 3;
- }else if (CurState.Equals("PAPER_OUT")){
- StateNo = 4;
- }else if (CurState.Equals("ELECTR_CMP")){
- StateNo = 5;
- }else if (CurState.Equals("CERTIFY_CMP")){
- StateNo = 6;
- }
- if(consent_state == null){
- return result;
- }else if (consent_state.Equals("UNFINISHED")){
- result = 1;
- }else if (consent_state.Equals("TEMP")){
- result = 2;
- }else if (consent_state.Equals("VERBAL")){
- result = 3;
- }else if (consent_state.Equals("PAPER_OUT")){
- result = 4;
- }else if (consent_state.Equals("ELECTR_CMP")){
- result = 5;
- }else if (consent_state.Equals("CERTIFY_CMP")){
- return result;
- }
- if(result < StateNo)//로드하려는 동의서의 상태보다 현재 저장된 상태가 더 높은 상태일 경우
- {
- return 1;
- }else//로드하려는 동의서보다 현재 저장된 상태가 낮은상태일 경우 또는 같을경우
- {
- return 0;
- }
- }
- catch
- {
- return -1;
- }
- }
- }
- }
|