#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.Collections.Generic; using System.Web.Services; using System.Collections; using IBatisNet.DataMapper; using CLIP.eForm.Server.Data; using CLIP.eForm.Consent.Entity; using CLIP.eForm.Consent.Dac; using System.IO; using System.Drawing; using System.Text; namespace CLIP.eForm.Consent.WebService { /// /// Class description /// /// ///

[설계자]

///

클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)

///

[원본 작성자]

///

클립소프트 기술부 이인희

///

[수정 작성자]

///

파티마병원 정보지원과 오재은

///

----------------------------------------------------------------------------------------

///

[HISTORY]

///

2016-06-15 : 최초작성

///

----------------------------------------------------------------------------------------

///
/// /// HospitalSvc 요약 설명입니다. /// [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // ASP.NET AJAX를 사용하여 스크립트에서 이 웹 서비스를 호출하려면 다음 줄의 주석 처리를 제거합니다. // [System.Web.Script.Services.ScriptService] public class HospitalSvc :System.Web.Services.WebService { private IBatisHelper _ibatisHelper; // 영남대병원은 cendb 가 없음 // CEN 연결 기능은 HIS DB 에 직접 기록 하여야 함. //private IBatisHelper cendbHelper; public HospitalSvc() { _ibatisHelper = new IBatisHelper("HospitalSvcOracleMap.config"); //cendbHelper = new IBatisHelper("CenDBOracleMap.config"); } protected override void Dispose(bool disposing) { if (IbatisSession != null && IbatisSession.Transaction != null) { IbatisSession.CommitTransaction(); IbatisSession.CloseConnection(); } if (IbatisMapper != null) IbatisMapper.CloseConnection(); //if (cendbSession != null && cendbSession.Transaction != null) { // cendbSession.CommitTransaction(); // cendbSession.CloseConnection(); //} //if (cendbMapper != null) { // cendbMapper.CloseConnection(); //} base.Dispose(disposing); } /// /// 현재 연결된 IBatis Connection을 반환 /// public ISqlMapper IbatisMapper { get { if (_ibatisHelper == null) { return null; } else { return _ibatisHelper.GetSqlMapper(); } } } //public ISqlMapper cendbMapper { // get { // if (cendbHelper == null) { // return null; // } else { // return cendbHelper.GetSqlMapper(); // } // } //} /// /// 현재 연결된 ISqlMapSession 을 반환 /// public ISqlMapSession IbatisSession { get { if (_ibatisHelper == null) { return null; } else { return _ibatisHelper.GetMapSession(); } } } //public ISqlMapSession cendbSession { // get { // if (cendbHelper == null) { // return null; // } else { // return cendbHelper.GetMapSession(); // } // } //} [WebMethod] public bool CheckWebService() { return true; } //[WebMethod] //public string checkCendbService() { // int hashCode = 0; // if (cendbHelper != null) { // hashCode = cendbHelper.GetHashCode(); // } // return String.Format("result is: {0}", hashCode); //} [WebMethod] public bool CheckDatabaseConnection() { // TODO: 데이터 베이스 커넥션 테스트 호출 필요 if (IbatisMapper != null) { return true; } return false; } /// /// 사용자 상세정보 /// 의사의 경우 엔존번호를 반환한다 /// /// 사용자 ID /// 근무지기관코드 /// 근무지부서코드 /// [WebMethod(Description = "사용자 상세정보")] public UserVO GetUserInfo(string userId, string instCd, string deptCd) { UserVO user = new UserVO(); try { using (UserDac dac = new UserDac()) { Hashtable param = new Hashtable { { "userId", userId }, { "instCd", instCd }, { "deptCd", deptCd ?? "" } }; user = dac.GetUserInfo(this.IbatisMapper, param); if (user == null) { user = new UserVO(); user.userId = ""; user.userName = ""; user.userDeptCode = ""; user.userDeptName = ""; user.deptEngAbbr = ""; user.jobKindCd = ""; user.jobKindNm = ""; user.instCd = ""; user.userTelNo = ""; user.ioFlag = ""; } } return user; } catch (Exception ex) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetUserInfo error: {0}", ex.Message)); throw ex; } } /// /// 환자 진료일 조회 /// /// 환자번호 /// 검색진료일 /// 검색조건, (searchType == ">=" 이면 clnDate >= searchClnDate, searchType == "=" 이면 clnDate = searchClnDate) /// 진료부서코드 /// 근무지기관코드 /// [WebMethod(Description = "환자 진료일 조회")] public List GetTrmtDateList(string patientNo, string searchClnDate, string searchType, string orddeptcd , string dutinstcd, string ordType) { List clnDateList; try { using (PatientDac dac = new PatientDac()) { Hashtable param = new Hashtable { { "instcd", dutinstcd }, { "pid", patientNo }, { "searchClnDate", searchClnDate }, { "searchType", searchType }, { "orddeptcd", orddeptcd }, { "ordType", ordType} }; clnDateList = (List) dac.GetTrmtDateList(this.IbatisMapper, param); } return clnDateList; } catch (Exception ex) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetTrmtDateList error: {0}", ex.Message)); throw ex; } } /// /// 환자리스트 조회 /// /// 조회일자 ex) 20200101 /// 진료과 코드 /// 의사 아이디 /// 환자 등록번호 /// 동의서 상태 및 환자 상태 /// 병원 기관코드 /// 병동코드 /// 사용자 아이디 /// 입원에서 내환자 검색 조건 /// /// 의사 구분코드 전공의(A), 담당교수(B), 그외 직종(C) 구분코드 /// 화면 구분 입원 : I, 외래 : O, 응급 : ER, 수술 : OP, 검색 : S /// 검색 화면 여부 /// [WebMethod(Description = "환자리스트 조회")] public List GetPatientList(String srchDd, String ordDeptCd, String doctorId, String pid, String patientState, String instCd, String wardCd, String userId, String myPatient, String jobKindCd, String drKind, String selectFlag, String srchYN) { wardCd = wardCd ?? ""; userId = userId ?? ""; myPatient = myPatient ?? "N"; jobKindCd = jobKindCd ?? ""; drKind = drKind ?? ""; selectFlag = selectFlag.ToUpper(); if (selectFlag.Equals("SR")) { if (patientState.Equals("A")) { selectFlag = "I"; //patientState = "A"; } else if (patientState.Equals("0")) { selectFlag = "O"; } else if (patientState.Equals("1")) { selectFlag = "E"; //patientState = "A"; } patientState = ""; } List result; try { using (PatListDac dac = new PatListDac()) { Hashtable param = new Hashtable(); param.Add("srchDd", srchDd); param.Add("ordDeptCd", ordDeptCd); param.Add("doctorId", doctorId); param.Add("pid", pid); param.Add("patientState", patientState); param.Add("instCd", instCd); param.Add("selectFlag", selectFlag); param.Add("srchYN", srchYN); if (selectFlag.Equals("I")) { param.Add("wardCd", wardCd); param.Add("userId", userId); param.Add("myPatient", myPatient); } if (selectFlag.Equals("I") || selectFlag.Equals("E")) { param.Add("jobKindCd", jobKindCd); param.Add("drKind", drKind); } result = (List) dac.GetPatList(this.IbatisMapper, param); } return result; } catch (Exception ex) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetPatientList error: {0}", ex.Message)); throw ex; } } ///// ///// 입원탭 환자리스트 조회 ///// ///// 조회일자 ex)20160623 ///// 진료과 및 집도과 ex) 빈값은 전체 ///// 진료의 또는 주치의 또는 집도의 ex) 빈값은 전체 ///// 환자등록번호 ex) 빈값은 전체 ///// 병동 코드 ex) 3041400000 ///// 환자 상태구분 (외래 : 진료구분, 입원 : 구분, 수술 : 수술상태, 응급 : 재원구분, 환자찾기 : ID인지 이름인지) ex)빈값은 전체 ///// ///// 근무지기관코드 ///// 로그인 사용자 ID ///// 내환자 검색 checkbox value, 내환자 검색의 경우 pid 파라미터는 null 로 보내야 한다.ex) Y, N //[WebMethod(Description = "입원탭 환자리스트 조회")] //public List GetInPatList(String srchdd, String orddeptcd, String doctorid, String pid, String wardcd, String patstat, String jobkindcd, String dutinstcd, String userId, String myPatient, String drKind) { // List result; // try { // using (PatListDac dac = new PatListDac()) { // var myPatValue = myPatient ?? "N"; // var userIdValue = userId ?? ""; // // 내환자 검색일 경우 입력된 환자 번호를 무시하도록 설정 // if (myPatValue == "Y") { // pid = ""; // } // //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetCategoryForDropdown error: {0}", srchdd)); // Hashtable param = new Hashtable { // { "instcd", dutinstcd }, // { "srchdd", srchdd }, // { "orddeptcd", orddeptcd }, // { "wardcd", wardcd }, // { "patstat", patstat }, // { "pid", pid }, // { "doctorid", doctorid }, // { "selectflag", "I" }, // { "userid", userIdValue }, // { "myPatient", myPatValue }, // { "srchYN", "N" }, // { "drKind", drKind } // }; // result = (List) dac.GetPatList(this.IbatisMapper, param); // } // return result; // } catch (Exception ex) { // CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetInPatList error: {0}", ex.Message)); // throw ex; // } //} ///// ///// 외래탭 환자리스트 조회 ///// ///// 조회일자 ex)20160628 orddd ///// 진료과 및 집도과 ex)빈값은 전체, 2010400000 ///// 진료의 또는 주치의 또는 집도의 ex)빈값은 전체, 104796 orddrid ///// 환자등록번호 ex)빈값은 전체 ///// 환자 상태구분 (외래 : 진료구분, 입원 : 구분, 수술 : 수술상태, 응급 : 재원구분, 환자찾기 : ID인지 이름인지) 빈값은 전체 ///// 근무지기관코드 ///// 외래 환자 리스트 //[WebMethod(Description = "외래탭 환자리스트 조회")] //public List GetOutPatList(String srchdd, String orddeptcd, String doctorid, String pid, String patstat, String dutinstcd) { // List result = null; // try { // using (PatListDac dac = new PatListDac()) { // Hashtable param = new Hashtable { // { "instcd", dutinstcd }, // { "srchdd", srchdd }, // { "orddeptcd", orddeptcd }, // { "orddrid", doctorid }, // { "pid", pid }, // { "patstat", patstat }, // { "selectflag", "O" }, // { "srchYN", "N" } // }; // result = (List) dac.GetPatList(this.IbatisMapper, param); // } // return result; // } catch (Exception ex) { // CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetOutPatList error: {0}", ex.Message)); // throw ex; // } //} ///// ///// 수술탭 환자리스트 조회 ///// ///// 조회일자 ex)20160623 ///// 진료과 및 집도과 ex)빈값은 전체 ///// 진료의 또는 주치의 또는 집도의 ex)빈값은 전체 ///// 환자등록번호 ex)빈값은 전체 ///// 환자 상태구분 (외래 : 진료구분, 입원 : 구분, 수술 : 수술상태, 응급 : 재원구분, 환자찾기 : ID인지 이름인지) ex)A ///// 근무지기관코드 ///// //[WebMethod(Description = "수술탭 환자리스트 조회")] //public List GetOpPatList(String srchdd, String orddeptcd, String doctorid, String pid, String patstat, String dutinstcd) { // List result; // try { // using (PatListDac dac = new PatListDac()) { // Hashtable param = new Hashtable { // { "instcd", dutinstcd }, // { "srchdd", srchdd }, // { "opstatcd", patstat }, // { "orddeptcd", orddeptcd }, // { "orddrid", doctorid }, // { "pid", pid }, // { "selectflag", "OP" }, // { "srchYN", "N" } // }; // result = (List) dac.GetPatList(this.IbatisMapper, param); // } // return result; // } catch (Exception ex) { // CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetOpPatList error: {0}", ex.Message)); // throw ex; // } //} ///// ///// 응급탭 환자 리스트 조회 ///// ///// 조회일자 ex) 20160623 ///// 진료과 및 집도과 ex)빈값은 전체 ///// 진료의 또는 주치의 또는 집도의 ex)빈값은 전체 ///// 환자등록번호 ex)빈값은 전체 ///// 환자 상태구분 (외래 : 진료구분, 입원 : 구분, 수술 : 수술상태, 응급 : 재원구분, 환자찾기 : ID인지 이름인지) ex)빈값은 전체 ///// 직무의 종류와 담당분야가 동일한 직무의군 코드값 아직 정의 되지 않았음. 예)영양직, 의무정보직, 임상병리직' ///// 근무지기관코드 ///// //[WebMethod(Description = "응급탭 환자 리스트 조회")] //public List GetErPatList(String srchdd, String orddeptcd, String doctorid, String pid, String patstat, String jobkindcd, String dutinstcd, String drKind) { // List result; // try { // using (PatListDac dac = new PatListDac()) { // CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("srchdd: " + srchdd); // Hashtable param = new Hashtable { // { "instcd", dutinstcd }, // { "srchdd", srchdd }, // { "orddeptcd", orddeptcd }, // { "orddrid", doctorid }, // { "patstat", patstat }, // { "pid", pid }, // { "selectflag", "ER" }, // { "srchYN", "N" }, // { "drKind", drKind } // }; // var text = ""; // IDictionaryEnumerator enum1 = param.GetEnumerator(); // while (enum1.MoveNext()) { // text += enum1.Key + ", "; // text += enum1.Value + "\n"; // } // CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(text); // result = (List) dac.GetPatList(this.IbatisMapper, param); // } // return result; // } catch (Exception ex) { // CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetErPatList error: {0}", ex.Message)); // throw ex; // } //} ///// ///// 환자검색 조회 기능 ///// ///// 조회일자 ex)20160623 ///// 진료과 및 집도과 ex)빈값은 전체 ///// 진료의 또는 주치의 또는 집도의 ex)빈값은 전체 ///// 환자등록번호 ex)빈값은 전체 ///// 외래 O / 입원 I / 응급 ER ///// 근무지기관코드 ///// 로그인 사용자 ID ///// 내환자 검색 checkbox value, 내환자 검색의 경우 pid 파라미터는 null 로 보내야 한다.ex) Y, N ///// //[WebMethod(Description = "환자검색 조회 기능")] //public List GetSrPatList(String srchdd, String orddeptcd, String doctorid, String pid, String ordtype, String dutinstcd, String userId, String myPatient) { // List result; // try { // using (PatListDac dac = new PatListDac()) { // var myPatValue = myPatient ?? "N"; // var userIdValue = userId ?? ""; // // 내환자 검색일 경우 입력된 환자 번호를 무시하도록 설정 // if (myPatValue == "Y") { // pid = ""; // } // Hashtable param = new Hashtable { // { "instcd", dutinstcd }, // { "srchdd", srchdd }, // { "orddeptcd", orddeptcd }, // { "wardcd", "" }, // { "medispclid", doctorid }, // { "orddrid", doctorid }, // { "pid", pid }, // { "opstatcd", "A" }, // { "selectflag", ordtype }, // { "patstat", "0" }, // { "myPatient", myPatValue }, // { "userId", userIdValue }, // { "srchYN", "Y" } // }; // result = (List) dac.GetPatList(this.IbatisMapper, param); // } // return result; // } catch (Exception ex) { // CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetSrPatList error: {0}", ex.Message)); // throw ex; // } //} /// /// 환자리스트 조회조건 중 진료과 조회 /// /// 내원 종류 ( 탭 종류 ) 외래 : O , 입원 : I , 수술 : OP, 응급 : ER, 환자검색 : SR /// 근무지기관코드 [WebMethod(Description = "환자리스트 조회조건 중 진료과 조회")] public List GetDeptList(String ordType, String instCd) { List result; try { using (PatListDac dac = new PatListDac()) { Hashtable param = new Hashtable(); if (instCd == null) { instCd = "031"; } param.Add("instCd", instCd); param.Add("ordType", ordType); result = (List) dac.GetDeptList(this.IbatisMapper, param); } return result; } catch (Exception ex) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetDeptList error: {0}", ex.Message)); throw ex; } } /// /// 환자리스트 조회조건 중 병동 조회 /// /// 근무지기관코드 /// [WebMethod(Description = "환자리스트 조회조건 중 병동 조회")] public List GetWardList(String instCd) { List result; try { using (PatListDac dac = new PatListDac()) { Hashtable param = new Hashtable(); param.Add("instCd", instCd); result = (List) dac.GetWardList(this.IbatisMapper, param); } return result; } catch (Exception ex) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetWardList error: {0}", ex.Message)); throw ex; } } /* * 환자리스트 조회조건 중 의사 조회 * * srchDd : 조회일자 ex)"20160629" * ordDeptCd : 진료과 ex)빈값은 전체조회 */ [WebMethod(Description = "환자리스트 조회조건 중 의사 조회")] public List GetDoctorList(String srchDd, String ordDeptCd, String instCd) { List result; try { using (PatListDac dac = new PatListDac()) { Hashtable param = new Hashtable(); param.Add("instCd", instCd); param.Add("srchDd", srchDd); param.Add("ordDeptCd", ordDeptCd); result = (List) dac.GetDocList(this.IbatisMapper, param); } return result; } catch (Exception ex) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetDoctorList error: {0}", ex.Message)); throw ex; } } /// /// 환자리스트 조회조건 중 환자 검색 팝업 /// /// 조회 구분( 1: 등록번호, 2: 환자명, 3: 주민번호, 4: 환자명+주민번호) /// 환자 등록번호 ex) 2234596 /// 환자이름 ex) 오재은 /// 주민번호 앞자리 ex) 891117 /// 주민번호 뒷자리 ex) 1682813 /// 근무지기관코드 /// [WebMethod(Description = "환자리스트 조회조건 중 환자 검색 팝업")] public List GetSrchPatInfo(String srchcond, String pid, String hngnm, String rrgstno1, String rrgstno2, String dutinstcd) { List result; try { using (PatListDac dac = new PatListDac()) { Hashtable param = new Hashtable(); param.Add("instcd", dutinstcd); param.Add("srchcond", srchcond); param.Add("pid", pid); param.Add("hngnm", hngnm); param.Add("rrgstno1", rrgstno1); param.Add("rrgstno2", rrgstno2); result = (List) dac.GetSrchPatInfo(this.IbatisMapper, param); } return result; } catch (Exception ex) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetSrchPatInfo error: {0}", ex.Message)); throw ex; } } /// /// 환자 선택시 수진일자별 진단 데이터 조회. /// 입원일때 한 수진에 수술이 여러개일 경우 집도과로 체크 /// 외래일때 당일 수진이 여러개일경우 진료과로 체크 /// /// 환자 등록번호 ex) 2234596 , 2270516 /// 외래 : 진료일, 입원: 입원일 ex) 20160205 , 20151201 /// 내원 구분 (I: 입원, E: 응급, O: 외래) O , I /// 내원 구분 (I: 입원, E: 응급, O: 외래) O , I /// 생성번호 /// 근무지기관코드 /// 수술예약번호 /// [WebMethod(Description = "환자 선택시 수진일자별 진단 데이터 조회")] public List GetPatientInfo(String pid, String inDd, String ordType, String ordDeptCd, String cretNo, String instCd, String opRsrvNo) { List result; opRsrvNo = opRsrvNo ?? ""; try { using (PatientDac dac = new PatientDac()) { Hashtable param = new Hashtable { { "instCd", instCd }, { "inDd", inDd }, { "pid", pid }, { "ordType", ordType}, { "ordDeptCd", ordDeptCd}, { "cretNo", cretNo }, { "opRsrvNo", opRsrvNo } }; result = (List) dac.GetPatientInfo(this.IbatisMapper, param); } return result; } catch (Exception ex) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetPatientInfo error: {0}", ex.Message)); throw ex; } } /// /// 동의서 SET 조회 /// /// 사용자 아이디 107810 /// 근무지기관코드 [WebMethod(Description = "동의서 SET 조회")] public List GetConsentSetList(string userId, string instCd) { List result; try { using (ConsentDac dac = new ConsentDac()) { Hashtable param = new Hashtable(); param.Add("instCd", instCd); param.Add("userId", userId); result = (List) dac.GetConsentSetList(this.IbatisMapper, param); } return result; } catch (Exception ex) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetConsentSetList error: {0}", ex.Message)); throw ex; } } /// /// 사용자 즐겨찾기 추가 /// /// 사용자 아이디 107810 /// 서식코드 /// 근무지기관코드 [WebMethod(Description = "사용자 즐겨찾기 추가")] public SingleReturnData SetUserFormSetList(String userId, String formCd, String instCd) { SingleReturnData result = new SingleReturnData(); int res = 0; try { using (UserDac dac = new UserDac()) { Hashtable param = new Hashtable(); param.Add("instCd", instCd); param.Add("userId", userId); param.Add("formCd", formCd); //------------------------------------------------------------------- // KNUH dependency 제거 // // 교육 DB 일때 // 교육 DB 에서는 CEN DB 가 없기 때문에 직접 해당 테이블에 값을 저장 //if (cendbHelper.GetSqlMapper().DataSource.Name == "knuhCenDB_ED") { // res = dac.SetUserFormSet(this.IbatisMapper, param); //} // 운영 DB 일때 // CEN DB 에 작업하여 반영 //else { // res = dac.SetUserFormSet(this.cendbMapper, param); //} //------------------------------------------------------------------- // TODO. 영남대병원에서 사용 데이터베이스 테이블 확인 필요 res = dac.SetUserFormSet(this.IbatisMapper, param); } result.responseData = Convert.ToString(res); return result; } catch (Exception ex) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm SetUserFormSetList error: {0}", ex.Message)); throw ex; } } /// /// 사용자 즐겨찾기 삭제 /// /// 사용자 아이디 107810 /// 서식코드 /// 근무지기관코드 [WebMethod(Description = "사용자 즐겨찾기 삭제")] public SingleReturnData DelUserFormSetList(String userId, String formCd, String instCd) { SingleReturnData result = new SingleReturnData(); int res = 0; try { using (UserDac dac = new UserDac()) { Hashtable param = new Hashtable(); param.Add("instCd", instCd); param.Add("userId", userId); param.Add("formCd", formCd); //------------------------------------------------------------------- // KNUH dependency 제거 // //if (cendbHelper.GetSqlMapper().DataSource.Name == "knuhCenDB_ED") { // res = dac.DelUserFormSet(this.IbatisMapper, param); //} else { // res = dac.DelUserFormSet(this.cendbMapper, param); //} // //------------------------------------------------------------------- res = dac.DelUserFormSet(this.IbatisMapper, param); } result.responseData = Convert.ToString(res); } catch (Exception ex) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm DelUserFormSetList error: {0}", ex.Message)); throw ex; } return result; } [WebMethod(Description = "OCRTAG 중복 확인")] public int checkOcrDup(string instCd, string ocrtag) { int cnt = 0; using(ConsentDac consentDac = new ConsentDac()) { Hashtable param = new Hashtable(); param.Add("instCd", instCd); param.Add("ocrTag", ocrtag); cnt = consentDac.checkOcrtagDup(this.IbatisMapper, param); } return cnt; } /// /// OCRTAG 할당 /// /// 근무지기관코드 /// [WebMethod(Description = "OCRTAG 할당")] public SingleReturnData GetOcrTag(string instCd) { SingleReturnData result = new SingleReturnData(); string resultOcrTag = ""; try { // 먼저 OCRCODE 가 중복되어 있는지 확인한다 using (PatientDac dac = new PatientDac()) { Hashtable param = new Hashtable(); param.Add("instCd", instCd); resultOcrTag = dac.GetOcrTag(this.IbatisMapper, param); } // OCRTAG 중복 검사 using (ConsentDac consentDac = new ConsentDac()) { Hashtable param = new Hashtable(); param.Add("instCd", instCd); param.Add("ocrTag", resultOcrTag); int cnt = consentDac.checkOcrtagDup(this.IbatisMapper, param); if (cnt > 0) { resultOcrTag = ""; } } result.responseData = resultOcrTag; return result; } catch (Exception ex) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetOcrTag error: {0}", ex.Message)); throw ex; } } /// /// 사용자의 서명이미지 조회 /// /// 사용자 아이디 103043 /// 근무지기관코드 [WebMethod(Description = "사용자의 서명이미지 조회")] public UserSignImageVO GetSignImage(string userId, string instCd) { UserSignImageVO vo = new UserSignImageVO(); try { string base64stringimg = string.Empty; using (UserDac dac = new UserDac()) { userId = userId.ToUpper(); Hashtable param = new Hashtable(); param.Add("userId", userId); param.Add("instCd", instCd); IList vos = dac.GetUserSignImage(this.IbatisMapper, param); foreach (UserSignImageVO item in vos) { vo = item; break; } if (vos.Count == 0) { vo.SignImage = new Byte[0]; } } return vo; } catch (Exception ex) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetSignImage error: {0}", ex.Message)); throw ex; } } /// /// 주,부 진단명 리스트 조회(진단명 팝업) /// /// 등록번호 /// 진료일, 입원일 /// 근무지기관코드 [WebMethod(Description = "주,부 진단명 리스트 조회(진단명 팝업)")] public List GetDiagNameList(String pid, String orddd, String dutinstcd) { List result; try { using (PatientDac dac = new PatientDac()) { Hashtable param = new Hashtable(); if (dutinstcd == null) { dutinstcd = "031"; } param.Add("instcd", dutinstcd); param.Add("orddd", orddd); param.Add("pid", pid); result = (List) dac.GetDiagList(this.IbatisMapper, param); } return result; } catch (Exception ex) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetDiagNameList error: {0}", ex.Message)); throw ex; } } public List getOpNameList(String pid, string dutinstcd) { List result = null; try { //using (OperationNameDAC opDac = new OperationNameDAC()) { Hashtable args = new Hashtable(); //Hashtable param = new Hashtable(); args.Add("pid", pid); args.Add("dutinstcd", dutinstcd); //result = (List)opDac.getOpNameList(this.IbatisMapper, args); } return result; } catch (Exception e) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm getOpNameList error: {0}", e.Message)); throw e; } } /// /// 파일이름 조회 /// /// 등록번호 1640515 /// 내원구분 I /// 내월일자 20151130 /// 퇴원일자 99991231 /// 이력번호 1 /// 파일크기 없어도됨 /// 서식코드 1300010289 /// 페이지번호 6 /// OCR코드 2016071989074 /// 사용자아이디 105042 /// 근무지기관코드 [WebMethod(Description = "파일이름 조회")] public string GetFileName(string pid, string ordtype, string orddd, string dschdd, string cretno, string filesize, string formcd, string pageno, string ocrtag, string userid, string orddeptcd, string dutinstcd) { try { using (PatientDac dac = new PatientDac()) { Hashtable param = new Hashtable(); param.Add("instcd", dutinstcd); param.Add("pid", pid); param.Add("ordtype", ordtype); param.Add("orddd", orddd); param.Add("dschdd", dschdd); param.Add("cretno", cretno); param.Add("filesize", filesize); param.Add("formcd", formcd); param.Add("pageno", pageno); param.Add("ocrtag", ocrtag); param.Add("userid", userid); param.Add("orddeptcd", orddeptcd); return dac.GetFileName(this.IbatisMapper, param); //string tempPath = dac.GetFileName(this.IbatisMapper, param); //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm GetFileName : {0}", Server.MapPath("./DataTempImage/") + DateTime.Now.Ticks.ToString().Substring(8, 10))); //return Server.MapPath("./DataTempImage/") + DateTime.Now.Ticks.ToString().Substring(8, 10); } } catch (Exception ex) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetFileName error: {0}", ex.Message)); throw ex; } } /// /// setFileName으로 등록된 데이터 삭제하는 로직 /// /// 등록번호 1640515 /// 내원구분 I /// 내월일자 20151130 /// 퇴원일자 99991231 /// 이력번호 1 /// 서식코드 1300010289 /// OCR코드 2016071989074 /// 사용자아이디 105042 /// 사용자명 홍길동 /// 동의서 생성 아이디 1573 /// 병원구분 111 /// 진료과 코드 /// 근무지기관코드 [WebMethod(Description = "setFileName으로 등록된 데이터 삭제하는 함수")] public void delEformData(string pid, string ordtype, string orddd, string dschdd, string cretno, string formcd, string ocrtag, string userid, string username, string consentmstrid, string hostype, string orddeptcd, string dutinstcd) { try { using (PatientDac dac = new PatientDac()) { Hashtable param = new Hashtable(); param.Add("instcd", dutinstcd); param.Add("pid", pid); param.Add("ordtype", ordtype); param.Add("orddd", orddd); param.Add("dschdd", dschdd); param.Add("cretno", cretno); param.Add("formcd", formcd); param.Add("ocrtag", ocrtag); param.Add("userid", userid); param.Add("username", username); param.Add("consentmstrid", consentmstrid); param.Add("hostype", hostype); param.Add("orddeptcd", orddeptcd); dac.delEformData(this.IbatisMapper, param); } } catch (Exception ex) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm delEformData error: {0}", ex.Message)); throw ex; } } /// /// 모바일 Default Tap(외래, 입원..) 설정 /// /// 사용자 아이디 /// 외래 O 입원 I 응급 E 수술 OP 검색 SR /// 근무지기관코드 [WebMethod(Description = "모바일 Default Tap(외래, 입원..) 설정")] public SingleReturnData UpdateUserSetup(string userId, string status, string instCd) { SingleReturnData result = new SingleReturnData(); int res = 0; try { using (PatientDac dac = new PatientDac()) { Hashtable param = new Hashtable(); param.Add("userId", userId); param.Add("status", status); param.Add("instCd", instCd); res = dac.UpdateUserSetup(this.IbatisMapper, param); } result.responseData = Convert.ToString(res); return result; } catch (Exception ex) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm UpdateUserSetup error: {0}", ex.Message)); throw ex; } } /// /// 모바일 주치의별 미작성 리스트 가져오기 /// /// 사용자 아이디 /// 동의서 상태(UNFINISHED, TEMP ....) /// /// /// 근무지기관코드 /// [WebMethod(Description = "모바일 주치의별 미작성 리스트 가져오기")] public List GetUnfinishedListPerDoctor(string userid, string status, string fromdd, string todd, string dutinstcd) { try { using (ConsentDac dac = new ConsentDac()) { Hashtable param = new Hashtable { { "userid", userid }, { "status", status }, { "fromdd", fromdd }, { "todd", todd }, { "instcd", dutinstcd } }; return (List) dac.GetUnfinishedListPerDoctor(this.IbatisMapper, param); } } catch (Exception ex) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetUnfinishedListPerDoctor error: {0}", ex.Message)); throw ex; } } /// /// 모바일 사용자 로그인 API /// /// /// /// /// [WebMethod(Description = "모바일 사용자 로그인 API")] public List doLogin(string userid, string pwd, string dutinstcd, String certSucc) { MobileLoginResult result; try { using (UserDac dac = new UserDac()) { Hashtable param = new Hashtable(); int n; if (!int.TryParse(userid, out n)) { userid = userid.ToUpper(); } param.Add("userid", userid); result = dac.doLogin(this.IbatisMapper, param); if (result == null) { return null; } if (certSucc == "false") { if (result.pwd != pwd) { return null; } } string syscd = (dutinstcd == "031") ? "HIS031" : "HIS032"; Hashtable param2 = new Hashtable(); param2.Add("userid", result.userid); param2.Add("syscd", syscd); return (List) dac.getUserdeptList(this.IbatisMapper, param2); } } catch (Exception e) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error( string.Format("CLIP.eForm doLogin ERROR : {0}", e.ToString())); throw e; } } /// /// 모바일 사용자 정보요청 API /// /// /// /// /// [WebMethod(Description = "모바일 사용자 정보요청 API")] public MobileUserInfo GetMobileUserInfo(string userid, string dutplceinstcd, string dutplcecd) { MobileUserInfo result = null; try { using (UserDac dac = new UserDac()) { Hashtable param = new Hashtable(); param.Add("userid", userid); param.Add("dutplceinstcd", dutplceinstcd); param.Add("dutplcecd", dutplcecd); result = dac.getMobileUserInfo(this.IbatisMapper, param); } return result; } catch (Exception e) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error( string.Format("CLIP.eForm GetMobileUserInfo ERROR : {0}", e.ToString())); throw e; } } [WebMethod(Description = "경북대학교병원, 출력 가능한 수진이력을 가진 환자인지 조회")] public int checkPrintablePatient(string instcd, string pid, string orddd, string cretno) { int count = 0; try { using (PatientDac dac = new PatientDac()) { Hashtable param = new Hashtable { {"instcd", instcd}, {"pid", pid}, {"orddd", orddd }, {"cretno", cretno } }; count = dac.checkPrintablePatient(this.IbatisMapper, param); } } catch (Exception e) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error( string.Format("CLIP.eForm checkPrintable ERROR : {0}", e.ToString())); } return count; } [WebMethod(Description = "펜 설정 검색")] public string getPenOptions(string instcd) { string otps = string.Empty; try { using (ConsentDac dac = new ConsentDac()) { Hashtable param = new Hashtable(); param.Add("instcd", instcd); otps = dac.getPenOptions(this.IbatisMapper, param); } } catch (Exception e) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error( string.Format("CLIP.eForm getPenOptions ERROR : {0}", e.ToString())); } return otps; } [WebMethod(Description = "확대 배율 검색")] public string getZoomRate(string instcd) { string otps = string.Empty; try { using (ConsentDac dac = new ConsentDac()) { Hashtable param = new Hashtable(); param.Add("instcd", instcd); otps = dac.getZoomRate(this.IbatisMapper, param); } } catch (Exception e) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error( string.Format("CLIP.eForm getPenOptions ERROR : {0}", e.ToString())); } return otps; } [WebMethod(Description = "프린트 제어 메시지 검색")] public string getPrintControlMsg(string instcd, string ordtype) { string ctrlMsg = string.Empty; try { using (ConsentDac dac = new ConsentDac()) { Hashtable param = new Hashtable(); param.Add("instcd", instcd); param.Add("ordtype", ordtype); ctrlMsg = dac.getPrintControlMsg(this.IbatisMapper, param); } } catch (Exception e) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error( string.Format("CLIP.eForm getPrintControlMsg ERROR : {0}", e.ToString())); } return ctrlMsg; } [WebMethod(Description = "프린트 제어 메시지 검색")] public string getPrintOnly(string instcd, string formcd) { string ctrlMsg = string.Empty; try { using (ConsentDac dac = new ConsentDac()) { Hashtable param = new Hashtable(); param.Add("instcd", instcd); param.Add("formcd", formcd); ctrlMsg = dac.getPrintOnly(this.IbatisMapper, param); } } catch (Exception e) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error( string.Format("CLIP.eForm getPrintOnly ERROR : {0}", e.ToString())); } return ctrlMsg; } [WebMethod(Description = "멀티출력 가능 서식 카운트")] public int getMultiprintable(string instcd, string formcd) { int count = 0; try { using (ConsentDac dac = new ConsentDac()) { Hashtable param = new Hashtable(); param.Add("instcd", instcd); param.Add("formcd", formcd); count = dac.getMultiprintable(this.IbatisMapper, param); } } catch (Exception e) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error( string.Format("CLIP.eForm getMultiprintable ERROR : {0}", e.ToString())); } return count; } [WebMethod(Description = "기준자료검색")] public int checkHardcd(string instcd, string hardcdno, string trgtcd) { int count = 0; try { using (PatientDac dac = new PatientDac()) { Hashtable param = new Hashtable { {"instcd", instcd}, {"hardcdno", hardcdno}, {"trgtcd", trgtcd } }; count = dac.checkHardcd(this.IbatisMapper, param); } } catch (Exception e) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error( string.Format("CLIP.eForm checkPrintable ERROR : {0}", e.ToString())); } return count; } /// /// 세션타임을 가져온다 /// /// [WebMethod(Description = "모바일 세션 시간을 가져옴")] public SingleReturnData GetBaseData(String instCd) { SingleReturnData result = new SingleReturnData(); try { using (UserDac dac = new UserDac()) { Hashtable param = new Hashtable(); param.Add("instCd", instCd); result.responseData = dac.GetBaseData(this.IbatisMapper, param); } } catch (Exception e) { //result.responseData = "30"; CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm checkPrintable ERROR : {0}", e.ToString())); } return result; } #region 사용자 서명이미지 저장 코드 /// /// 사용자에 대한 서명 이미지를 저장한다. /// /// /// /// /// /// base64로 변환된 사인이미지 데이터 /// [WebMethod(Description = "서명 이미지 저장")] public String setSignImage(string instCd, string userId, string signSeq, string inptId, string signImage) { ISqlMapper mapper = IbatisMapper; // KNUH dependency 제거 //ISqlMapper mapper = this.cendbMapper; ISqlMapper hospitalMapper = this.IbatisMapper; //ISqlMapper cendbMapper = this.cendbMapper; UserSignDataVo signData = null; byte[] decodedImage = Convert.FromBase64String(signImage); //string decodedImage = Encoding.UTF8.GetString(Convert.FromBase64String(signImage)); string result = "0"; try { using (UserDac dac = new UserDac()) { String userName = String.Empty; { Hashtable temp = new Hashtable(); temp.Add("userId", userId); userName = dac.getUserName(hospitalMapper, temp); } Hashtable param = new Hashtable(); //받아온 사용자의 사인데이터를 조회 param.Add("instCd", instCd); param.Add("userId", userId); param.Add("userName", userName); CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(String.Format("test")); signData = dac.getUserSignDataInfo(mapper, param); if (signData == null) { signData = new UserSignDataVo(); signData.userId = userId; signData.signImgeSeqNo = 0; signData.instCd = instCd; signData.signImgeFromDd = DateTime.Now.ToString("yyyyMMdd"); signData.signData = decodedImage; } int signSeqInt = Int32.Parse(signSeq); //사인데이터가 있을 경우 //if (signData != null) if(signSeqInt >= 0) { string today = DateTime.Now.ToString("yyyyMMdd"); string yesterday = DateTime.Now.AddDays(-1).ToString("yyyyMMdd"); //해당 사인데이터가 오늘 저장된 것이 아니라면 오늘날짜로 새로 저장하고 이전 데이터의 유효기간을 마감시킨다. if (signData.signImgeSeqNo == 0 || !signData.signImgeFromDd.Equals(today)) { // KNUH dependency 제거 //insSignImage(instCd, userId, signData.signImgeSeqNo + 1, decodedImage, inptId, dac, this.cendbMapper); insSignImage(instCd, userId, signData.signImgeSeqNo + 1, decodedImage, inptId, dac, this.IbatisMapper); if (signData.signImgeSeqNo != 0) { // KNUH dependency 제거 //setSignToDd(instCd, userId, signData.signImgeSeqNo, yesterday, "N", inptId, dac, this.cendbMapper); setSignToDd(instCd, userId, signData.signImgeSeqNo, yesterday, "N", inptId, dac, this.IbatisMapper); } } else { // 사인데이터가 오늘 저장된 것이라면 사인데이터를 업데이트 해준다. param = new Hashtable(); param.Add("instCd", instCd); param.Add("userId", userId); param.Add("curSeqNo", signData.signImgeSeqNo); param.Add("signData", decodedImage); param.Add("inptUser", inptId); // KNUH dependency 제거 //dac.setUserSignData(this.cendbMapper, param); dac.setUserSignData(this.IbatisMapper, param); } } else { //사인데이터가 없으면 그대로 저장 insSignImage(instCd, userId, int.TryParse(signSeq, out int res) ? res : 1, decodedImage, inptId, dac, mapper); } } result = "1"; return result; } catch (Exception ex) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm setSignImage error: {0}", ex.Message)); throw ex; } } /// /// 서명이미지를 생성한다. /// /// /// /// /// /// /// /// private void insSignImage(string instCd, string userId, int nextSeqNo, byte[] signImage, string inptId, UserDac dac, ISqlMapper mapper) { Hashtable param = new Hashtable(); param.Add("instCd", instCd); param.Add("userId", userId); param.Add("nextSeqNo", nextSeqNo); param.Add("signData", signImage); param.Add("inputUserId", inptId); dac.insSignImage(mapper, param); } /// /// 사용자 사인데이터의 ToDd를 설정한다 /// /// /// /// /// /// /// /// /// private void setSignToDd(string instCd, string userId, int curSeqNo, string toDd, string repryn, string inptUser, UserDac dac, ISqlMapper mapper) { Hashtable param = new Hashtable(); param.Add("instCd", instCd); param.Add("userId", userId); param.Add("curSeqNo", curSeqNo); param.Add("yesterDay", toDd); param.Add("repryn", repryn); param.Add("inptUser", inptUser); dac.setUserSignToDd(mapper, param); } /// /// 사용자에 대한 서명정보 조회 /// /// /// /// [WebMethod(Description = "서명 이미지 조회")] public UserSignDataVo getUserSignDataInfo(string instCd, string userId) { UserSignDataVo result = null; UserDac dac = new UserDac(); Hashtable param = new Hashtable(); param.Add("instCd", instCd); param.Add("userId", userId); result = dac.getUserSignDataInfo(IbatisMapper, param); if(result == null) { CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("data: null")); Hashtable param2 = new Hashtable(); param2.Add("userId", userId); result = new UserSignDataVo(); result.userId = userId; result.signImgeSeqNo = 0; result.instCd = instCd; result.signImgeFromDd = DateTime.Now.ToString("yyyyMMdd"); result.signData = null; result.userNm = dac.getUserName(this.IbatisMapper, param2); } return result; } #endregion } }