HospitalSvc.asmx.cs 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518
  1. #region Copyright © 2015 CLIPSOFT Co.,Ltd. All Rights Reserved.
  2. //
  3. // All rights are reserved. Reproduction or transmission in whole or in part,
  4. // in any form or by any means, electronic, mechanical or otherwise, is
  5. // prohibited without the prior written consent of the copyright owner.
  6. //
  7. // Filename: ConsentSvc.asmx.cs
  8. //
  9. #endregion
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Web.Services;
  13. using System.Collections;
  14. using IBatisNet.DataMapper;
  15. using CLIP.eForm.Server.Data;
  16. using CLIP.eForm.Consent.Entity;
  17. using CLIP.eForm.Consent.Dac;
  18. using System.IO;
  19. using System.Drawing;
  20. using System.Text;
  21. namespace CLIP.eForm.Consent.WebService {
  22. /// <summary>
  23. /// Class description
  24. /// </summary>
  25. /// <remarks>
  26. /// <p>[설계자]</p>
  27. /// <p> 클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)</p>
  28. /// <p>[원본 작성자]</p>
  29. /// <p> 클립소프트 기술부 이인희</p>
  30. /// <p>[수정 작성자]</p>
  31. /// <p> 파티마병원 정보지원과 오재은</p>
  32. /// <p>----------------------------------------------------------------------------------------</p>
  33. /// <p>[HISTORY]</p>
  34. /// <p> 2016-06-15 : 최초작성</p>
  35. /// <p>----------------------------------------------------------------------------------------</p>
  36. /// </remarks>
  37. /// <summary>
  38. /// HospitalSvc 요약 설명입니다.
  39. /// </summary>
  40. [WebService(Namespace = "http://tempuri.org/")]
  41. [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
  42. [System.ComponentModel.ToolboxItem(false)]
  43. // ASP.NET AJAX를 사용하여 스크립트에서 이 웹 서비스를 호출하려면 다음 줄의 주석 처리를 제거합니다.
  44. // [System.Web.Script.Services.ScriptService]
  45. public class HospitalSvc :System.Web.Services.WebService {
  46. private IBatisHelper _ibatisHelper;
  47. private IBatisHelper cendbHelper;
  48. public HospitalSvc() {
  49. _ibatisHelper = new IBatisHelper("HospitalSvcOracleMap.config");
  50. cendbHelper = new IBatisHelper("CenDBOracleMap.config");
  51. }
  52. protected override void Dispose(bool disposing) {
  53. if (IbatisSession != null && IbatisSession.Transaction != null) {
  54. IbatisSession.CommitTransaction();
  55. IbatisSession.CloseConnection();
  56. }
  57. if (IbatisMapper != null)
  58. IbatisMapper.CloseConnection();
  59. if (cendbSession != null && cendbSession.Transaction != null) {
  60. cendbSession.CommitTransaction();
  61. cendbSession.CloseConnection();
  62. }
  63. if (cendbMapper != null) {
  64. cendbMapper.CloseConnection();
  65. }
  66. base.Dispose(disposing);
  67. }
  68. /// <summary>
  69. /// 현재 연결된 IBatis Connection을 반환
  70. /// </summary>
  71. public ISqlMapper IbatisMapper {
  72. get {
  73. if (_ibatisHelper == null) {
  74. return null;
  75. } else {
  76. return _ibatisHelper.GetSqlMapper();
  77. }
  78. }
  79. }
  80. public ISqlMapper cendbMapper {
  81. get {
  82. if (cendbHelper == null) {
  83. return null;
  84. } else {
  85. return cendbHelper.GetSqlMapper();
  86. }
  87. }
  88. }
  89. /// <summary>
  90. /// 현재 연결된 ISqlMapSession 을 반환
  91. /// </summary>
  92. public ISqlMapSession IbatisSession {
  93. get {
  94. if (_ibatisHelper == null) {
  95. return null;
  96. } else {
  97. return _ibatisHelper.GetMapSession();
  98. }
  99. }
  100. }
  101. public ISqlMapSession cendbSession {
  102. get {
  103. if (cendbHelper == null) {
  104. return null;
  105. } else {
  106. return cendbHelper.GetMapSession();
  107. }
  108. }
  109. }
  110. [WebMethod]
  111. public bool CheckWebService() {
  112. return true;
  113. }
  114. [WebMethod]
  115. public string checkCendbService() {
  116. int hashCode = 0;
  117. if (cendbHelper != null) {
  118. hashCode = cendbHelper.GetHashCode();
  119. }
  120. return String.Format("result is: {0}", hashCode);
  121. }
  122. [WebMethod]
  123. public bool CheckDatabaseConnection() {
  124. // TODO: 데이터 베이스 커넥션 테스트 호출 필요
  125. if (IbatisMapper != null) {
  126. return true;
  127. }
  128. return false;
  129. }
  130. /// <summary>
  131. /// 사용자 상세정보
  132. /// 의사의 경우 엔존번호를 반환한다
  133. /// </summary>
  134. /// <param name="userId">사용자 ID</param>
  135. /// <param name="instCd">근무지기관코드</param>
  136. /// <param name="deptCd">근무지부서코드</param>
  137. /// <returns></returns>
  138. [WebMethod(Description = "사용자 상세정보")]
  139. public UserVO GetUserInfo(string userId, string instCd, string deptCd) {
  140. UserVO user = new UserVO();
  141. try {
  142. using (UserDac dac = new UserDac()) {
  143. Hashtable param = new Hashtable {
  144. { "userId", userId },
  145. { "instCd", instCd },
  146. { "deptCd", deptCd ?? "" }
  147. };
  148. user = dac.GetUserInfo(this.IbatisMapper, param);
  149. if (user == null) {
  150. user = new UserVO();
  151. user.userId = "";
  152. user.userName = "";
  153. user.userDeptCode = "";
  154. user.userDeptName = "";
  155. user.deptEngAbbr = "";
  156. user.jobKindCd = "";
  157. user.jobKindNm = "";
  158. user.instCd = "";
  159. user.userTelNo = "";
  160. user.ioFlag = "";
  161. }
  162. }
  163. return user;
  164. } catch (Exception ex) {
  165. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetUserInfo error: {0}", ex.Message));
  166. throw ex;
  167. }
  168. }
  169. /// <summary>
  170. /// 환자 진료일 조회
  171. /// </summary>
  172. /// <param name="patientNo">환자번호</param>
  173. /// <param name="searchClnDate">검색진료일</param>
  174. /// <param name="searchType">검색조건, (searchType == ">=" 이면 clnDate >= searchClnDate, searchType == "=" 이면 clnDate = searchClnDate) </param>
  175. /// <param name="orddeptcd">진료부서코드</param>
  176. /// <param name="dutinstcd">근무지기관코드</param>
  177. /// <returns></returns>
  178. [WebMethod(Description = "환자 진료일 조회")]
  179. public List<ClnDateForDropdownVO> GetTrmtDateList(string patientNo, string searchClnDate, string searchType, string orddeptcd
  180. , string dutinstcd, string ordType) {
  181. List<ClnDateForDropdownVO> clnDateList;
  182. try {
  183. using (PatientDac dac = new PatientDac()) {
  184. Hashtable param = new Hashtable {
  185. { "instcd", dutinstcd },
  186. { "pid", patientNo },
  187. { "searchClnDate", searchClnDate },
  188. { "searchType", searchType },
  189. { "orddeptcd", orddeptcd },
  190. { "ordType", ordType}
  191. };
  192. clnDateList = (List<ClnDateForDropdownVO>) dac.GetTrmtDateList(this.IbatisMapper, param);
  193. }
  194. return clnDateList;
  195. } catch (Exception ex) {
  196. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetTrmtDateList error: {0}", ex.Message));
  197. throw ex;
  198. }
  199. }
  200. /// <summary>
  201. /// 환자리스트 조회
  202. /// </summary>
  203. /// <param name="srchDd">조회일자 ex) 20200101</param>
  204. /// <param name="ordDeptCd">진료과 코드</param>
  205. /// <param name="doctorId">의사 아이디</param>
  206. /// <param name="pid">환자 등록번호</param>
  207. /// <param name="patientState">동의서 상태 및 환자 상태</param>
  208. /// <param name="instCd">병원 기관코드</param>
  209. /// <param name="wardCd">병동코드</param>
  210. /// <param name="userId">사용자 아이디</param>
  211. /// <param name="myPatient">입원에서 내환자 검색 조건</param>
  212. /// <param name="jobKindCd"></param>
  213. /// <param name="drKind">의사 구분코드 전공의(A), 담당교수(B), 그외 직종(C) 구분코드 </param>
  214. /// <param name="selectFlag">화면 구분 입원 : I, 외래 : O, 응급 : ER, 수술 : OP, 검색 : S</param>
  215. /// <param name="srchYN">검색 화면 여부</param>
  216. /// <returns></returns>
  217. [WebMethod(Description = "환자리스트 조회")]
  218. public List<PatListVO> GetPatientList(String srchDd, String ordDeptCd, String doctorId, String pid, String patientState, String instCd,
  219. String wardCd, String userId, String myPatient, String jobKindCd, String drKind, String selectFlag, String srchYN) {
  220. wardCd = wardCd ?? "";
  221. userId = userId ?? "";
  222. myPatient = myPatient ?? "N";
  223. jobKindCd = jobKindCd ?? "";
  224. drKind = drKind ?? "";
  225. selectFlag = selectFlag.ToUpper();
  226. if (selectFlag.Equals("SR")) {
  227. if (patientState.Equals("A")) {
  228. selectFlag = "I";
  229. //patientState = "A";
  230. } else if (patientState.Equals("0")) {
  231. selectFlag = "O";
  232. } else if (patientState.Equals("1")) {
  233. selectFlag = "E";
  234. //patientState = "A";
  235. }
  236. patientState = "";
  237. }
  238. List<PatListVO> result;
  239. try {
  240. using (PatListDac dac = new PatListDac()) {
  241. Hashtable param = new Hashtable();
  242. param.Add("srchDd", srchDd);
  243. param.Add("ordDeptCd", ordDeptCd);
  244. param.Add("doctorId", doctorId);
  245. param.Add("pid", pid);
  246. param.Add("patientState", patientState);
  247. param.Add("instCd", instCd);
  248. param.Add("selectFlag", selectFlag);
  249. param.Add("srchYN", srchYN);
  250. if (selectFlag.Equals("I")) {
  251. param.Add("wardCd", wardCd);
  252. param.Add("userId", userId);
  253. param.Add("myPatient", myPatient);
  254. }
  255. if (selectFlag.Equals("I") || selectFlag.Equals("E")) {
  256. param.Add("jobKindCd", jobKindCd);
  257. param.Add("drKind", drKind);
  258. }
  259. result = (List<PatListVO>) dac.GetPatList(this.IbatisMapper, param);
  260. }
  261. return result;
  262. } catch (Exception ex) {
  263. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetPatientList error: {0}", ex.Message));
  264. throw ex;
  265. }
  266. }
  267. ///// <summary>
  268. ///// 입원탭 환자리스트 조회
  269. ///// </summary>
  270. ///// <param name="srchdd">조회일자 ex)20160623</param>
  271. ///// <param name="orddeptcd">진료과 및 집도과 ex) 빈값은 전체</param>
  272. ///// <param name="doctorid">진료의 또는 주치의 또는 집도의 ex) 빈값은 전체</param>
  273. ///// <param name="pid">환자등록번호 ex) 빈값은 전체</param>
  274. ///// <param name="wardcd">병동 코드 ex) 3041400000</param>
  275. ///// <param name="patstat">환자 상태구분 (외래 : 진료구분, 입원 : 구분, 수술 : 수술상태, 응급 : 재원구분, 환자찾기 : ID인지 이름인지) ex)빈값은 전체</param>
  276. ///// <param name="jobkindcd"></param>
  277. ///// <param name="dutinstcd">근무지기관코드</param>
  278. ///// <param name="userId">로그인 사용자 ID</param>
  279. ///// <param name="myPatient">내환자 검색 checkbox value, 내환자 검색의 경우 pid 파라미터는 null 로 보내야 한다.ex) Y, N</param>
  280. //[WebMethod(Description = "입원탭 환자리스트 조회")]
  281. //public List<PatListVO> GetInPatList(String srchdd, String orddeptcd, String doctorid, String pid, String wardcd, String patstat, String jobkindcd, String dutinstcd, String userId, String myPatient, String drKind) {
  282. // List<PatListVO> result;
  283. // try {
  284. // using (PatListDac dac = new PatListDac()) {
  285. // var myPatValue = myPatient ?? "N";
  286. // var userIdValue = userId ?? "";
  287. // // 내환자 검색일 경우 입력된 환자 번호를 무시하도록 설정
  288. // if (myPatValue == "Y") {
  289. // pid = "";
  290. // }
  291. // //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetCategoryForDropdown error: {0}", srchdd));
  292. // Hashtable param = new Hashtable {
  293. // { "instcd", dutinstcd },
  294. // { "srchdd", srchdd },
  295. // { "orddeptcd", orddeptcd },
  296. // { "wardcd", wardcd },
  297. // { "patstat", patstat },
  298. // { "pid", pid },
  299. // { "doctorid", doctorid },
  300. // { "selectflag", "I" },
  301. // { "userid", userIdValue },
  302. // { "myPatient", myPatValue },
  303. // { "srchYN", "N" },
  304. // { "drKind", drKind }
  305. // };
  306. // result = (List<PatListVO>) dac.GetPatList(this.IbatisMapper, param);
  307. // }
  308. // return result;
  309. // } catch (Exception ex) {
  310. // CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetInPatList error: {0}", ex.Message));
  311. // throw ex;
  312. // }
  313. //}
  314. ///// <summary>
  315. ///// 외래탭 환자리스트 조회
  316. ///// </summary>
  317. ///// <param name="srchdd">조회일자 ex)20160628 orddd</param>
  318. ///// <param name="orddeptcd">진료과 및 집도과 ex)빈값은 전체, 2010400000</param>
  319. ///// <param name="doctorid">진료의 또는 주치의 또는 집도의 ex)빈값은 전체, 104796 orddrid</param>
  320. ///// <param name="pid">환자등록번호 ex)빈값은 전체</param>
  321. ///// <param name="patstat">환자 상태구분 (외래 : 진료구분, 입원 : 구분, 수술 : 수술상태, 응급 : 재원구분, 환자찾기 : ID인지 이름인지) 빈값은 전체</param>
  322. ///// <param name="dutinstcd">근무지기관코드</param>
  323. ///// <returns>외래 환자 리스트</returns>
  324. //[WebMethod(Description = "외래탭 환자리스트 조회")]
  325. //public List<PatListVO> GetOutPatList(String srchdd, String orddeptcd, String doctorid, String pid, String patstat, String dutinstcd) {
  326. // List<PatListVO> result = null;
  327. // try {
  328. // using (PatListDac dac = new PatListDac()) {
  329. // Hashtable param = new Hashtable {
  330. // { "instcd", dutinstcd },
  331. // { "srchdd", srchdd },
  332. // { "orddeptcd", orddeptcd },
  333. // { "orddrid", doctorid },
  334. // { "pid", pid },
  335. // { "patstat", patstat },
  336. // { "selectflag", "O" },
  337. // { "srchYN", "N" }
  338. // };
  339. // result = (List<PatListVO>) dac.GetPatList(this.IbatisMapper, param);
  340. // }
  341. // return result;
  342. // } catch (Exception ex) {
  343. // CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetOutPatList error: {0}", ex.Message));
  344. // throw ex;
  345. // }
  346. //}
  347. ///// <summary>
  348. ///// 수술탭 환자리스트 조회
  349. ///// </summary>
  350. ///// <param name="srchdd">조회일자 ex)20160623</param>
  351. ///// <param name="orddeptcd">진료과 및 집도과 ex)빈값은 전체</param>
  352. ///// <param name="doctorid">진료의 또는 주치의 또는 집도의 ex)빈값은 전체</param>
  353. ///// <param name="pid">환자등록번호 ex)빈값은 전체</param>
  354. ///// <param name="patstat">환자 상태구분 (외래 : 진료구분, 입원 : 구분, 수술 : 수술상태, 응급 : 재원구분, 환자찾기 : ID인지 이름인지) ex)A</param>
  355. ///// <param name="dutinstcd">근무지기관코드</param>
  356. ///// <returns></returns>
  357. //[WebMethod(Description = "수술탭 환자리스트 조회")]
  358. //public List<PatListVO> GetOpPatList(String srchdd, String orddeptcd, String doctorid, String pid, String patstat, String dutinstcd) {
  359. // List<PatListVO> result;
  360. // try {
  361. // using (PatListDac dac = new PatListDac()) {
  362. // Hashtable param = new Hashtable {
  363. // { "instcd", dutinstcd },
  364. // { "srchdd", srchdd },
  365. // { "opstatcd", patstat },
  366. // { "orddeptcd", orddeptcd },
  367. // { "orddrid", doctorid },
  368. // { "pid", pid },
  369. // { "selectflag", "OP" },
  370. // { "srchYN", "N" }
  371. // };
  372. // result = (List<PatListVO>) dac.GetPatList(this.IbatisMapper, param);
  373. // }
  374. // return result;
  375. // } catch (Exception ex) {
  376. // CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetOpPatList error: {0}", ex.Message));
  377. // throw ex;
  378. // }
  379. //}
  380. ///// <summary>
  381. ///// 응급탭 환자 리스트 조회
  382. ///// </summary>
  383. ///// <param name="srchdd">조회일자 ex) 20160623</param>
  384. ///// <param name="orddeptcd">진료과 및 집도과 ex)빈값은 전체</param>
  385. ///// <param name="doctorid"> 진료의 또는 주치의 또는 집도의 ex)빈값은 전체</param>
  386. ///// <param name="pid">환자등록번호 ex)빈값은 전체</param>
  387. ///// <param name="patstat">환자 상태구분 (외래 : 진료구분, 입원 : 구분, 수술 : 수술상태, 응급 : 재원구분, 환자찾기 : ID인지 이름인지) ex)빈값은 전체</param>
  388. ///// <param name="jobkindcd">직무의 종류와 담당분야가 동일한 직무의군 코드값 아직 정의 되지 않았음. 예)영양직, 의무정보직, 임상병리직'</param>
  389. ///// <param name="dutinstcd">근무지기관코드</param>
  390. ///// <returns></returns>
  391. //[WebMethod(Description = "응급탭 환자 리스트 조회")]
  392. //public List<PatListVO> GetErPatList(String srchdd, String orddeptcd, String doctorid, String pid, String patstat, String jobkindcd, String dutinstcd, String drKind) {
  393. // List<PatListVO> result;
  394. // try {
  395. // using (PatListDac dac = new PatListDac()) {
  396. // CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("srchdd: " + srchdd);
  397. // Hashtable param = new Hashtable {
  398. // { "instcd", dutinstcd },
  399. // { "srchdd", srchdd },
  400. // { "orddeptcd", orddeptcd },
  401. // { "orddrid", doctorid },
  402. // { "patstat", patstat },
  403. // { "pid", pid },
  404. // { "selectflag", "ER" },
  405. // { "srchYN", "N" },
  406. // { "drKind", drKind }
  407. // };
  408. // var text = "";
  409. // IDictionaryEnumerator enum1 = param.GetEnumerator();
  410. // while (enum1.MoveNext()) {
  411. // text += enum1.Key + ", ";
  412. // text += enum1.Value + "\n";
  413. // }
  414. // CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(text);
  415. // result = (List<PatListVO>) dac.GetPatList(this.IbatisMapper, param);
  416. // }
  417. // return result;
  418. // } catch (Exception ex) {
  419. // CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetErPatList error: {0}", ex.Message));
  420. // throw ex;
  421. // }
  422. //}
  423. ///// <summary>
  424. ///// 환자검색 조회 기능
  425. ///// </summary>
  426. ///// <param name="srchdd">조회일자 ex)20160623</param>
  427. ///// <param name="orddeptcd">진료과 및 집도과 ex)빈값은 전체</param>
  428. ///// <param name="doctorid">진료의 또는 주치의 또는 집도의 ex)빈값은 전체</param>
  429. ///// <param name="pid">환자등록번호 ex)빈값은 전체</param>
  430. ///// <param name="ordtype">외래 O / 입원 I / 응급 ER</param>
  431. ///// <param name="dutinstcd">근무지기관코드</param>
  432. ///// <param name="userId">로그인 사용자 ID</param>
  433. ///// <param name="myPatient">내환자 검색 checkbox value, 내환자 검색의 경우 pid 파라미터는 null 로 보내야 한다.ex) Y, N</param>
  434. ///// <returns></returns>
  435. //[WebMethod(Description = "환자검색 조회 기능")]
  436. //public List<PatListVO> GetSrPatList(String srchdd, String orddeptcd, String doctorid, String pid, String ordtype, String dutinstcd, String userId, String myPatient) {
  437. // List<PatListVO> result;
  438. // try {
  439. // using (PatListDac dac = new PatListDac()) {
  440. // var myPatValue = myPatient ?? "N";
  441. // var userIdValue = userId ?? "";
  442. // // 내환자 검색일 경우 입력된 환자 번호를 무시하도록 설정
  443. // if (myPatValue == "Y") {
  444. // pid = "";
  445. // }
  446. // Hashtable param = new Hashtable {
  447. // { "instcd", dutinstcd },
  448. // { "srchdd", srchdd },
  449. // { "orddeptcd", orddeptcd },
  450. // { "wardcd", "" },
  451. // { "medispclid", doctorid },
  452. // { "orddrid", doctorid },
  453. // { "pid", pid },
  454. // { "opstatcd", "A" },
  455. // { "selectflag", ordtype },
  456. // { "patstat", "0" },
  457. // { "myPatient", myPatValue },
  458. // { "userId", userIdValue },
  459. // { "srchYN", "Y" }
  460. // };
  461. // result = (List<PatListVO>) dac.GetPatList(this.IbatisMapper, param);
  462. // }
  463. // return result;
  464. // } catch (Exception ex) {
  465. // CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetSrPatList error: {0}", ex.Message));
  466. // throw ex;
  467. // }
  468. //}
  469. /// <summary>
  470. /// 환자리스트 조회조건 중 진료과 조회
  471. /// </summary>
  472. /// <param name="ordType">내원 종류 ( 탭 종류 ) 외래 : O , 입원 : I , 수술 : OP, 응급 : ER, 환자검색 : SR</param>
  473. /// <param name="instCd">근무지기관코드</param>
  474. [WebMethod(Description = "환자리스트 조회조건 중 진료과 조회")]
  475. public List<DeptListVO> GetDeptList(String ordType, String instCd) {
  476. List<DeptListVO> result;
  477. try {
  478. using (PatListDac dac = new PatListDac()) {
  479. Hashtable param = new Hashtable();
  480. if (instCd == null) {
  481. instCd = "031";
  482. }
  483. param.Add("instCd", instCd);
  484. param.Add("ordType", ordType);
  485. result = (List<DeptListVO>) dac.GetDeptList(this.IbatisMapper, param);
  486. }
  487. return result;
  488. } catch (Exception ex) {
  489. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetDeptList error: {0}", ex.Message));
  490. throw ex;
  491. }
  492. }
  493. /// <summary>
  494. /// 환자리스트 조회조건 중 병동 조회
  495. /// </summary>
  496. /// <param name="dutinstcd">근무지기관코드</param>
  497. /// <returns></returns>
  498. [WebMethod(Description = "환자리스트 조회조건 중 병동 조회")]
  499. public List<DeptListVO> GetWardList(String instCd) {
  500. List<DeptListVO> result;
  501. try {
  502. using (PatListDac dac = new PatListDac()) {
  503. Hashtable param = new Hashtable();
  504. param.Add("instCd", instCd);
  505. result = (List<DeptListVO>) dac.GetWardList(this.IbatisMapper, param);
  506. }
  507. return result;
  508. } catch (Exception ex) {
  509. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetWardList error: {0}", ex.Message));
  510. throw ex;
  511. }
  512. }
  513. /*
  514. * 환자리스트 조회조건 중 의사 조회
  515. *
  516. * srchDd : 조회일자 ex)"20160629"
  517. * ordDeptCd : 진료과 ex)빈값은 전체조회
  518. */
  519. [WebMethod(Description = "환자리스트 조회조건 중 의사 조회")]
  520. public List<DocListVO> GetDoctorList(String srchDd, String ordDeptCd, String instCd) {
  521. List<DocListVO> result;
  522. try {
  523. using (PatListDac dac = new PatListDac()) {
  524. Hashtable param = new Hashtable();
  525. param.Add("instCd", instCd);
  526. param.Add("srchDd", srchDd);
  527. param.Add("ordDeptCd", ordDeptCd);
  528. result = (List<DocListVO>) dac.GetDocList(this.IbatisMapper, param);
  529. }
  530. return result;
  531. } catch (Exception ex) {
  532. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetDoctorList error: {0}", ex.Message));
  533. throw ex;
  534. }
  535. }
  536. [WebMethod(Description = "환자리스트 안전관리 메시지 확인")]
  537. public String checkPatientSafetyMessage(String type, String instCd, String pid, String orddd, int cretNo) {
  538. var msg = String.Empty;
  539. try {
  540. using (PatientDac dac = new PatientDac()) {
  541. Hashtable param = new Hashtable{
  542. { "type", type },
  543. { "instCd", instCd },
  544. { "pid", pid },
  545. { "orddd", orddd },
  546. { "cretNo", cretNo }
  547. };
  548. msg = dac.checkPatientSaftyMessage(this.IbatisMapper, param) ?? String.Empty;
  549. }
  550. }
  551. catch(Exception e) {
  552. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetSrchPatInfo error: {0}", e.Message));
  553. throw e;
  554. }
  555. return msg;
  556. }
  557. /// <summary>
  558. /// 환자리스트 조회조건 중 환자 검색 팝업
  559. /// </summary>
  560. /// <param name="srchcond">조회 구분( 1: 등록번호, 2: 환자명, 3: 주민번호, 4: 환자명+주민번호)</param>
  561. /// <param name="pid">환자 등록번호 ex) 2234596</param>
  562. /// <param name="hngnm">환자이름 ex) 오재은</param>
  563. /// <param name="rrgstno1">주민번호 앞자리 ex) 891117</param>
  564. /// <param name="rrgstno2">주민번호 뒷자리 ex) 1682813</param>
  565. /// <param name="dutinstcd">근무지기관코드</param>
  566. /// <returns></returns>
  567. [WebMethod(Description = "환자리스트 조회조건 중 환자 검색 팝업")]
  568. public List<PatInfoListVO> GetSrchPatInfo(String srchcond, String pid, String hngnm, String rrgstno1, String rrgstno2, String dutinstcd) {
  569. List<PatInfoListVO> result;
  570. try {
  571. using (PatListDac dac = new PatListDac()) {
  572. Hashtable param = new Hashtable();
  573. param.Add("instcd", dutinstcd);
  574. param.Add("srchcond", srchcond);
  575. param.Add("pid", pid);
  576. param.Add("hngnm", hngnm);
  577. param.Add("rrgstno1", rrgstno1);
  578. param.Add("rrgstno2", rrgstno2);
  579. result = (List<PatInfoListVO>) dac.GetSrchPatInfo(this.IbatisMapper, param);
  580. }
  581. return result;
  582. } catch (Exception ex) {
  583. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetSrchPatInfo error: {0}", ex.Message));
  584. throw ex;
  585. }
  586. }
  587. /// <summary>
  588. /// 환자 선택시 수진일자별 진단 데이터 조회.
  589. /// 입원일때 한 수진에 수술이 여러개일 경우 집도과로 체크
  590. /// 외래일때 당일 수진이 여러개일경우 진료과로 체크
  591. /// </summary>
  592. /// <param name="pid">환자 등록번호 ex) 2234596 , 2270516</param>
  593. /// <param name="inDd">외래 : 진료일, 입원: 입원일 ex) 20160205 , 20151201</param>
  594. /// <param name="ordType">내원 구분 (I: 입원, E: 응급, O: 외래) O , I</param>
  595. /// <param name="ordDeptCd">내원 구분 (I: 입원, E: 응급, O: 외래) O , I</param>
  596. /// <param name="cretNo">생성번호</param>
  597. /// <param name="instCd">근무지기관코드</param>
  598. /// <param name="opRsrvNo">수술예약번호</param>
  599. /// <returns></returns>
  600. [WebMethod(Description = "환자 선택시 수진일자별 진단 데이터 조회")]
  601. public List<PatientVO> GetPatientInfo(String pid, String inDd, String ordType, String ordDeptCd, String cretNo, String instCd, String opRsrvNo) {
  602. List<PatientVO> result;
  603. opRsrvNo = opRsrvNo ?? "";
  604. try {
  605. using (PatientDac dac = new PatientDac()) {
  606. Hashtable param = new Hashtable {
  607. { "instCd", instCd },
  608. { "inDd", inDd },
  609. { "pid", pid },
  610. { "ordType", ordType},
  611. { "ordDeptCd", ordDeptCd},
  612. { "cretNo", cretNo },
  613. { "opRsrvNo", opRsrvNo }
  614. };
  615. result = (List<PatientVO>) dac.GetPatientInfo(this.IbatisMapper, param);
  616. }
  617. return result;
  618. } catch (Exception ex) {
  619. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetPatientInfo error: {0}", ex.Message));
  620. throw ex;
  621. }
  622. }
  623. /// <summary>
  624. /// 동의서 SET 조회
  625. /// </summary>
  626. /// <param name="userId">사용자 아이디 107810</param>
  627. /// <param name="instCd">근무지기관코드</param>
  628. [WebMethod(Description = "동의서 SET 조회")]
  629. public List<ConsentFormListVO> GetConsentSetList(string userId, string instCd) {
  630. List<ConsentFormListVO> result;
  631. try {
  632. using (ConsentDac dac = new ConsentDac()) {
  633. Hashtable param = new Hashtable();
  634. param.Add("instCd", instCd);
  635. param.Add("userId", userId);
  636. result = (List<ConsentFormListVO>) dac.GetConsentSetList(this.IbatisMapper, param);
  637. }
  638. return result;
  639. } catch (Exception ex) {
  640. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetConsentSetList error: {0}", ex.Message));
  641. throw ex;
  642. }
  643. }
  644. /// <summary>
  645. /// 사용자 즐겨찾기 추가
  646. /// </summary>
  647. /// <param name="userId">사용자 아이디 107810</param>
  648. /// <param name="formCd">서식코드 </param>
  649. /// <param name="instCd">근무지기관코드</param>
  650. [WebMethod(Description = "사용자 즐겨찾기 추가")]
  651. public SingleReturnData SetUserFormSetList(String userId, String formCd, String instCd) {
  652. SingleReturnData result = new SingleReturnData();
  653. int res = 0;
  654. try {
  655. using (UserDac dac = new UserDac()) {
  656. Hashtable param = new Hashtable();
  657. param.Add("instCd", instCd);
  658. param.Add("userId", userId);
  659. param.Add("formCd", formCd);
  660. // 교육 DB 일때
  661. // 교육 DB 에서는 CEN DB 가 없기 때문에 직접 해당 테이블에 값을 저장
  662. if (cendbHelper.GetSqlMapper().DataSource.Name == "knuhCenDB_ED") {
  663. res = dac.SetUserFormSet(this.IbatisMapper, param);
  664. }
  665. // 운영 DB 일때
  666. // CEN DB 에 작업하여 반영
  667. else {
  668. res = dac.SetUserFormSet(this.cendbMapper, param);
  669. }
  670. }
  671. result.responseData = Convert.ToString(res);
  672. return result;
  673. } catch (Exception ex) {
  674. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm SetUserFormSetList error: {0}", ex.Message));
  675. throw ex;
  676. }
  677. }
  678. /// <summary>
  679. /// 사용자 즐겨찾기 삭제
  680. /// </summary>
  681. /// <param name="userId">사용자 아이디 107810</param>
  682. /// <param name="formCd">서식코드 </param>
  683. /// <param name="instCd">근무지기관코드</param>
  684. [WebMethod(Description = "사용자 즐겨찾기 삭제")]
  685. public SingleReturnData DelUserFormSetList(String userId, String formCd, String instCd) {
  686. SingleReturnData result = new SingleReturnData();
  687. int res = 0;
  688. try {
  689. using (UserDac dac = new UserDac()) {
  690. Hashtable param = new Hashtable();
  691. param.Add("instCd", instCd);
  692. param.Add("userId", userId);
  693. param.Add("formCd", formCd);
  694. if (cendbHelper.GetSqlMapper().DataSource.Name == "knuhCenDB_ED") {
  695. res = dac.DelUserFormSet(this.IbatisMapper, param);
  696. } else {
  697. res = dac.DelUserFormSet(this.cendbMapper, param);
  698. }
  699. }
  700. result.responseData = Convert.ToString(res);
  701. } catch (Exception ex) {
  702. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm DelUserFormSetList error: {0}", ex.Message));
  703. throw ex;
  704. }
  705. return result;
  706. }
  707. [WebMethod(Description = "OCRTAG 중복 확인")]
  708. public int checkOcrDup(string instCd, string ocrtag) {
  709. int cnt = 0;
  710. using(ConsentDac consentDac = new ConsentDac()) {
  711. Hashtable param = new Hashtable();
  712. param.Add("instCd", instCd);
  713. param.Add("ocrTag", ocrtag);
  714. cnt = consentDac.checkOcrtagDup(this.IbatisMapper, param);
  715. }
  716. return cnt;
  717. }
  718. /// <summary>
  719. /// OCRTAG 할당
  720. /// </summary>
  721. /// <param name="instCd">근무지기관코드</param>
  722. /// <returns></returns>
  723. [WebMethod(Description = "OCRTAG 할당")]
  724. public SingleReturnData GetOcrTag(string instCd) {
  725. SingleReturnData result = new SingleReturnData();
  726. string resultOcrTag = "";
  727. try {
  728. // 먼저 OCRCODE 가 중복되어 있는지 확인한다
  729. using (PatientDac dac = new PatientDac()) {
  730. Hashtable param = new Hashtable();
  731. param.Add("instCd", instCd);
  732. resultOcrTag = dac.GetOcrTag(this.IbatisMapper, param);
  733. }
  734. // OCRTAG 중복 검사
  735. using (ConsentDac consentDac = new ConsentDac()) {
  736. Hashtable param = new Hashtable();
  737. param.Add("instCd", instCd);
  738. param.Add("ocrTag", resultOcrTag);
  739. int cnt = consentDac.checkOcrtagDup(this.IbatisMapper, param);
  740. if (cnt > 0) {
  741. resultOcrTag = "";
  742. }
  743. }
  744. result.responseData = resultOcrTag;
  745. return result;
  746. } catch (Exception ex) {
  747. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetOcrTag error: {0}", ex.Message));
  748. throw ex;
  749. }
  750. }
  751. /// <summary>
  752. /// 사용자의 서명이미지 조회
  753. /// </summary>
  754. /// <param name="userId">사용자 아이디 103043</param>
  755. /// <param name="instCd">근무지기관코드</param>
  756. [WebMethod(Description = "사용자의 서명이미지 조회")]
  757. public UserSignImageVO GetSignImage(string userId, string instCd) {
  758. UserSignImageVO vo = new UserSignImageVO();
  759. try {
  760. string base64stringimg = string.Empty;
  761. using (UserDac dac = new UserDac()) {
  762. userId = userId.ToUpper();
  763. Hashtable param = new Hashtable();
  764. param.Add("userId", userId);
  765. param.Add("instCd", instCd);
  766. IList<UserSignImageVO> vos = dac.GetUserSignImage(this.IbatisMapper, param);
  767. foreach (UserSignImageVO item in vos) {
  768. vo = item;
  769. break;
  770. }
  771. if (vos.Count == 0) {
  772. vo.SignImage = new Byte[0];
  773. }
  774. }
  775. return vo;
  776. } catch (Exception ex) {
  777. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetSignImage error: {0}", ex.Message));
  778. throw ex;
  779. }
  780. }
  781. /// <summary>
  782. /// 주,부 진단명 리스트 조회(진단명 팝업)
  783. /// </summary>
  784. /// <param name="pid">등록번호 </param>
  785. /// <param name="orddd">진료일, 입원일 </param>
  786. /// <param name="dutinstcd">근무지기관코드</param>
  787. [WebMethod(Description = "주,부 진단명 리스트 조회(진단명 팝업)")]
  788. public List<string> GetDiagNameList(String pid, String orddd, String dutinstcd) {
  789. List<string> result;
  790. try {
  791. using (PatientDac dac = new PatientDac()) {
  792. Hashtable param = new Hashtable();
  793. if (dutinstcd == null) {
  794. dutinstcd = "031";
  795. }
  796. param.Add("instcd", dutinstcd);
  797. param.Add("orddd", orddd);
  798. param.Add("pid", pid);
  799. result = (List<string>) dac.GetDiagList(this.IbatisMapper, param);
  800. }
  801. return result;
  802. } catch (Exception ex) {
  803. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetDiagNameList error: {0}", ex.Message));
  804. throw ex;
  805. }
  806. }
  807. public List<string> getOpNameList(String pid, string dutinstcd) {
  808. List<string> result = null;
  809. try {
  810. //using (OperationNameDAC opDac = new OperationNameDAC())
  811. {
  812. Hashtable args = new Hashtable();
  813. //Hashtable param = new Hashtable();
  814. args.Add("pid", pid);
  815. args.Add("dutinstcd", dutinstcd);
  816. //result = (List<string>)opDac.getOpNameList(this.IbatisMapper, args);
  817. }
  818. return result;
  819. } catch (Exception e) {
  820. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm getOpNameList error: {0}", e.Message));
  821. throw e;
  822. }
  823. }
  824. /// <summary>
  825. /// 파일이름 조회
  826. /// </summary>
  827. /// <param name=" pid">등록번호 1640515</param>
  828. /// <param name=" ordtype">내원구분 I</param>
  829. /// <param name=" orddd">내월일자 20151130</param>
  830. /// <param name=" dschdd">퇴원일자 99991231</param>
  831. /// <param name=" cretno">이력번호 1</param>
  832. /// <param name=" filesize">파일크기 없어도됨</param>
  833. /// <param name=" formcd">서식코드 1300010289</param>
  834. /// <param name=" pageno">페이지번호 6</param>
  835. /// <param name=" ocrtag">OCR코드 2016071989074</param>
  836. /// <param name=" userid">사용자아이디 105042</param>
  837. /// <param name = "dutinstcd" >근무지기관코드</ param >
  838. [WebMethod(Description = "파일이름 조회")]
  839. 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) {
  840. try {
  841. using (PatientDac dac = new PatientDac()) {
  842. Hashtable param = new Hashtable();
  843. param.Add("instcd", dutinstcd);
  844. param.Add("pid", pid);
  845. param.Add("ordtype", ordtype);
  846. param.Add("orddd", orddd);
  847. param.Add("dschdd", dschdd);
  848. param.Add("cretno", cretno);
  849. param.Add("filesize", filesize);
  850. param.Add("formcd", formcd);
  851. param.Add("pageno", pageno);
  852. param.Add("ocrtag", ocrtag);
  853. param.Add("userid", userid);
  854. param.Add("orddeptcd", orddeptcd);
  855. return dac.GetFileName(this.IbatisMapper, param);
  856. //string tempPath = dac.GetFileName(this.IbatisMapper, param);
  857. //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm GetFileName : {0}", Server.MapPath("./DataTempImage/") + DateTime.Now.Ticks.ToString().Substring(8, 10)));
  858. //return Server.MapPath("./DataTempImage/") + DateTime.Now.Ticks.ToString().Substring(8, 10);
  859. }
  860. } catch (Exception ex) {
  861. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetFileName error: {0}", ex.Message));
  862. throw ex;
  863. }
  864. }
  865. /// <summary>
  866. /// setFileName으로 등록된 데이터 삭제하는 로직
  867. /// </summary>
  868. /// <param name="pid">등록번호 1640515</param>
  869. /// <param name="ordtype">내원구분 I</param>
  870. /// <param name="orddd">내월일자 20151130</param>
  871. /// <param name="dschdd">퇴원일자 99991231</param>
  872. /// <param name="cretno">이력번호 1</param>
  873. /// <param name="formcd">서식코드 1300010289</param>
  874. /// <param name="ocrtag">OCR코드 2016071989074</param>
  875. /// <param name="userid">사용자아이디 105042</param>
  876. /// <param name="username">사용자명 홍길동</param>
  877. /// <param name="consentmstrid">동의서 생성 아이디 1573</param>
  878. /// <param name="hostype">병원구분 111</param>
  879. /// <param name="orddeptcd">진료과 코드 </param>
  880. /// <param name="dutinstcd">근무지기관코드</param>
  881. [WebMethod(Description = "setFileName으로 등록된 데이터 삭제하는 함수")]
  882. 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) {
  883. try {
  884. using (PatientDac dac = new PatientDac()) {
  885. Hashtable param = new Hashtable();
  886. param.Add("instcd", dutinstcd);
  887. param.Add("pid", pid);
  888. param.Add("ordtype", ordtype);
  889. param.Add("orddd", orddd);
  890. param.Add("dschdd", dschdd);
  891. param.Add("cretno", cretno);
  892. param.Add("formcd", formcd);
  893. param.Add("ocrtag", ocrtag);
  894. param.Add("userid", userid);
  895. param.Add("username", username);
  896. param.Add("consentmstrid", consentmstrid);
  897. param.Add("hostype", hostype);
  898. param.Add("orddeptcd", orddeptcd);
  899. dac.delEformData(this.IbatisMapper, param);
  900. }
  901. } catch (Exception ex) {
  902. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm delEformData error: {0}", ex.Message));
  903. throw ex;
  904. }
  905. }
  906. /// <summary>
  907. /// 모바일 Default Tap(외래, 입원..) 설정
  908. /// </summary>
  909. /// <param name="userId">사용자 아이디</param>
  910. /// <param name="status">외래 O 입원 I 응급 E 수술 OP 검색 SR </param>
  911. /// <param name="instCd">근무지기관코드</param>
  912. [WebMethod(Description = "모바일 Default Tap(외래, 입원..) 설정")]
  913. public SingleReturnData UpdateUserSetup(string userId, string status, string instCd) {
  914. SingleReturnData result = new SingleReturnData();
  915. int res = 0;
  916. try {
  917. using (PatientDac dac = new PatientDac()) {
  918. Hashtable param = new Hashtable();
  919. param.Add("userId", userId);
  920. param.Add("status", status);
  921. param.Add("instCd", instCd);
  922. res = dac.UpdateUserSetup(this.IbatisMapper, param);
  923. }
  924. result.responseData = Convert.ToString(res);
  925. return result;
  926. } catch (Exception ex) {
  927. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm UpdateUserSetup error: {0}", ex.Message));
  928. throw ex;
  929. }
  930. }
  931. /// <summary>
  932. /// 모바일 주치의별 미작성 리스트 가져오기
  933. /// </summary>
  934. /// <param name="userid">사용자 아이디</param>
  935. /// <param name="status">동의서 상태(UNFINISHED, TEMP ....)</param>
  936. /// <param name="fromdd"></param>
  937. /// <param name="todd"></param>
  938. /// <param name="dutinstcd">근무지기관코드</param>
  939. /// <returns></returns>
  940. [WebMethod(Description = "모바일 주치의별 미작성 리스트 가져오기")]
  941. public List<UnFinishedListVO> GetUnfinishedListPerDoctor(string userid, string status, string fromdd, string todd, string dutinstcd) {
  942. try {
  943. using (ConsentDac dac = new ConsentDac()) {
  944. Hashtable param = new Hashtable {
  945. { "userid", userid },
  946. { "status", status },
  947. { "fromdd", fromdd },
  948. { "todd", todd },
  949. { "instcd", dutinstcd }
  950. };
  951. return (List<UnFinishedListVO>) dac.GetUnfinishedListPerDoctor(this.IbatisMapper, param);
  952. }
  953. } catch (Exception ex) {
  954. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetUnfinishedListPerDoctor error: {0}", ex.Message));
  955. throw ex;
  956. }
  957. }
  958. /// <summary>
  959. /// 모바일 사용자 로그인 API
  960. /// </summary>
  961. /// <param name="userid"></param>
  962. /// <param name="password"></param>
  963. /// <param name="dutinstcd"></param>
  964. /// <returns></returns>
  965. [WebMethod(Description = "모바일 사용자 로그인 API")]
  966. public List<UserLoginDeptList> doLogin(string userid, string pwd, string dutinstcd, String certSucc) {
  967. MobileLoginResult result;
  968. try {
  969. using (UserDac dac = new UserDac()) {
  970. Hashtable param = new Hashtable();
  971. int n;
  972. if (!int.TryParse(userid, out n)) {
  973. userid = userid.ToUpper();
  974. }
  975. param.Add("userid", userid);
  976. result = dac.doLogin(this.IbatisMapper, param);
  977. if (result == null) {
  978. return null;
  979. }
  980. if (certSucc == "false") {
  981. if (result.pwd != pwd) {
  982. return null;
  983. }
  984. }
  985. string syscd = (dutinstcd == "031") ? "HIS031" : "HIS032";
  986. Hashtable param2 = new Hashtable();
  987. param2.Add("userid", result.userid);
  988. param2.Add("syscd", syscd);
  989. return (List<UserLoginDeptList>) dac.getUserdeptList(this.IbatisMapper, param2);
  990. }
  991. } catch (Exception e) {
  992. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(
  993. string.Format("CLIP.eForm doLogin ERROR : {0}", e.ToString()));
  994. throw e;
  995. }
  996. }
  997. /// <summary>
  998. /// 모바일 사용자 정보요청 API
  999. /// </summary>
  1000. /// <param name="userid"></param>
  1001. /// <param name="dutplceinstcd"></param>
  1002. /// <param name="dutplcecd"></param>
  1003. /// <returns></returns>
  1004. [WebMethod(Description = "모바일 사용자 정보요청 API")]
  1005. public MobileUserInfo GetMobileUserInfo(string userid, string dutplceinstcd, string dutplcecd) {
  1006. MobileUserInfo result = null;
  1007. try {
  1008. using (UserDac dac = new UserDac()) {
  1009. Hashtable param = new Hashtable();
  1010. param.Add("userid", userid);
  1011. param.Add("dutplceinstcd", dutplceinstcd);
  1012. param.Add("dutplcecd", dutplcecd);
  1013. result = dac.getMobileUserInfo(this.IbatisMapper, param);
  1014. }
  1015. return result;
  1016. } catch (Exception e) {
  1017. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(
  1018. string.Format("CLIP.eForm GetMobileUserInfo ERROR : {0}", e.ToString()));
  1019. throw e;
  1020. }
  1021. }
  1022. [WebMethod(Description = "경북대학교병원, 출력 가능한 수진이력을 가진 환자인지 조회")]
  1023. public int checkPrintablePatient(string instcd, string pid, string orddd, string cretno) {
  1024. int count = 0;
  1025. try {
  1026. using (PatientDac dac = new PatientDac()) {
  1027. Hashtable param = new Hashtable
  1028. {
  1029. {"instcd", instcd},
  1030. {"pid", pid},
  1031. {"orddd", orddd },
  1032. {"cretno", cretno }
  1033. };
  1034. count = dac.checkPrintablePatient(this.IbatisMapper, param);
  1035. }
  1036. } catch (Exception e) {
  1037. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(
  1038. string.Format("CLIP.eForm checkPrintable ERROR : {0}", e.ToString()));
  1039. }
  1040. return count;
  1041. }
  1042. [WebMethod(Description = "펜 설정 검색")]
  1043. public string getPenOptions(string instcd) {
  1044. string otps = string.Empty;
  1045. try {
  1046. using (ConsentDac dac = new ConsentDac()) {
  1047. Hashtable param = new Hashtable();
  1048. param.Add("instcd", instcd);
  1049. otps = dac.getPenOptions(this.IbatisMapper, param);
  1050. }
  1051. } catch (Exception e) {
  1052. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(
  1053. string.Format("CLIP.eForm getPenOptions ERROR : {0}", e.ToString()));
  1054. }
  1055. return otps;
  1056. }
  1057. [WebMethod(Description = "확대 배율 검색")]
  1058. public string getZoomRate(string instcd) {
  1059. string otps = string.Empty;
  1060. try {
  1061. using (ConsentDac dac = new ConsentDac()) {
  1062. Hashtable param = new Hashtable();
  1063. param.Add("instcd", instcd);
  1064. otps = dac.getZoomRate(this.IbatisMapper, param);
  1065. }
  1066. } catch (Exception e) {
  1067. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(
  1068. string.Format("CLIP.eForm getPenOptions ERROR : {0}", e.ToString()));
  1069. }
  1070. return otps;
  1071. }
  1072. [WebMethod(Description = "프린트 제어 메시지 검색")]
  1073. public string getPrintControlMsg(string instcd, string ordtype) {
  1074. string ctrlMsg = string.Empty;
  1075. try {
  1076. using (ConsentDac dac = new ConsentDac()) {
  1077. Hashtable param = new Hashtable();
  1078. param.Add("instcd", instcd);
  1079. param.Add("ordtype", ordtype);
  1080. ctrlMsg = dac.getPrintControlMsg(this.IbatisMapper, param);
  1081. }
  1082. } catch (Exception e) {
  1083. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(
  1084. string.Format("CLIP.eForm getPrintControlMsg ERROR : {0}", e.ToString()));
  1085. }
  1086. return ctrlMsg;
  1087. }
  1088. [WebMethod(Description = "프린트 제어 메시지 검색")]
  1089. public string getPrintOnly(string instcd, string formcd) {
  1090. string ctrlMsg = string.Empty;
  1091. try {
  1092. using (ConsentDac dac = new ConsentDac()) {
  1093. Hashtable param = new Hashtable();
  1094. param.Add("instcd", instcd);
  1095. param.Add("formcd", formcd);
  1096. ctrlMsg = dac.getPrintOnly(this.IbatisMapper, param);
  1097. }
  1098. } catch (Exception e) {
  1099. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(
  1100. string.Format("CLIP.eForm getPrintOnly ERROR : {0}", e.ToString()));
  1101. }
  1102. return ctrlMsg;
  1103. }
  1104. [WebMethod(Description = "멀티출력 가능 서식 카운트")]
  1105. public int getMultiprintable(string instcd, string formcd) {
  1106. int count = 0;
  1107. try {
  1108. using (ConsentDac dac = new ConsentDac()) {
  1109. Hashtable param = new Hashtable();
  1110. param.Add("instcd", instcd);
  1111. param.Add("formcd", formcd);
  1112. count = dac.getMultiprintable(this.IbatisMapper, param);
  1113. }
  1114. } catch (Exception e) {
  1115. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(
  1116. string.Format("CLIP.eForm getMultiprintable ERROR : {0}", e.ToString()));
  1117. }
  1118. return count;
  1119. }
  1120. [WebMethod(Description = "기준자료검색")]
  1121. public int checkHardcd(string instcd, string hardcdno, string trgtcd) {
  1122. int count = 0;
  1123. try {
  1124. using (PatientDac dac = new PatientDac()) {
  1125. Hashtable param = new Hashtable
  1126. {
  1127. {"instcd", instcd},
  1128. {"hardcdno", hardcdno},
  1129. {"trgtcd", trgtcd }
  1130. };
  1131. count = dac.checkHardcd(this.IbatisMapper, param);
  1132. }
  1133. } catch (Exception e) {
  1134. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(
  1135. string.Format("CLIP.eForm checkPrintable ERROR : {0}", e.ToString()));
  1136. }
  1137. return count;
  1138. }
  1139. /// <summary>
  1140. /// 세션타임을 가져온다
  1141. /// </summary>
  1142. /// <returns></returns>
  1143. [WebMethod(Description = "모바일 세션 시간을 가져옴")]
  1144. public SingleReturnData GetBaseData(String instCd) {
  1145. SingleReturnData result = new SingleReturnData();
  1146. try {
  1147. using (UserDac dac = new UserDac()) {
  1148. Hashtable param = new Hashtable();
  1149. param.Add("instCd", instCd);
  1150. result.responseData = dac.GetBaseData(this.IbatisMapper, param);
  1151. }
  1152. } catch (Exception e) {
  1153. //result.responseData = "30";
  1154. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm checkPrintable ERROR : {0}", e.ToString()));
  1155. }
  1156. return result;
  1157. }
  1158. #region 사용자 서명이미지 저장 코드
  1159. /// <summary>
  1160. /// 사용자에 대한 서명 이미지를 저장한다.
  1161. /// </summary>
  1162. /// <param name="instCd"></param>
  1163. /// <param name="userId"></param>
  1164. /// <param name="signSeq"></param>
  1165. /// <param name="inptId"></param>
  1166. /// <param name="signImage">base64로 변환된 사인이미지 데이터</param>
  1167. /// <returns></returns>
  1168. [WebMethod(Description = "서명 이미지 저장")]
  1169. public String setSignImage(string instCd, string userId, string signSeq, string inptId, string signImage)
  1170. {
  1171. //ISqlMapper mapper = IbatisMapper;
  1172. ISqlMapper mapper = this.cendbMapper;
  1173. ISqlMapper hospitalMapper = this.IbatisMapper;
  1174. //ISqlMapper cendbMapper = this.cendbMapper;
  1175. UserSignDataVo signData = null;
  1176. byte[] decodedImage = Convert.FromBase64String(signImage);
  1177. //string decodedImage = Encoding.UTF8.GetString(Convert.FromBase64String(signImage));
  1178. string result = "0";
  1179. try
  1180. {
  1181. using (UserDac dac = new UserDac())
  1182. {
  1183. String userName = String.Empty;
  1184. {
  1185. Hashtable temp = new Hashtable();
  1186. temp.Add("userId", userId);
  1187. userName = dac.getUserName(hospitalMapper, temp);
  1188. }
  1189. Hashtable param = new Hashtable();
  1190. //받아온 사용자의 사인데이터를 조회
  1191. param.Add("instCd", instCd);
  1192. param.Add("userId", userId);
  1193. param.Add("userName", userName);
  1194. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(String.Format("test"));
  1195. signData = dac.getUserSignDataInfo(mapper, param);
  1196. if (signData == null)
  1197. {
  1198. signData = new UserSignDataVo();
  1199. signData.userId = userId;
  1200. signData.signImgeSeqNo = 0;
  1201. signData.instCd = instCd;
  1202. signData.signImgeFromDd = DateTime.Now.ToString("yyyyMMdd");
  1203. signData.signData = decodedImage;
  1204. }
  1205. int signSeqInt = Int32.Parse(signSeq);
  1206. //사인데이터가 있을 경우
  1207. //if (signData != null)
  1208. if(signSeqInt >= 0)
  1209. {
  1210. string today = DateTime.Now.ToString("yyyyMMdd");
  1211. string yesterday = DateTime.Now.AddDays(-1).ToString("yyyyMMdd");
  1212. //해당 사인데이터가 오늘 저장된 것이 아니라면 오늘날짜로 새로 저장하고 이전 데이터의 유효기간을 마감시킨다.
  1213. if (signData.signImgeSeqNo == 0 || !signData.signImgeFromDd.Equals(today))
  1214. {
  1215. insSignImage(instCd, userId, signData.signImgeSeqNo + 1, decodedImage, inptId, dac, this.cendbMapper);
  1216. if (signData.signImgeSeqNo != 0)
  1217. {
  1218. setSignToDd(instCd, userId, signData.signImgeSeqNo, yesterday, "N", inptId, dac, this.cendbMapper);
  1219. }
  1220. }
  1221. else
  1222. {
  1223. // 사인데이터가 오늘 저장된 것이라면 사인데이터를 업데이트 해준다.
  1224. param = new Hashtable();
  1225. param.Add("instCd", instCd);
  1226. param.Add("userId", userId);
  1227. param.Add("curSeqNo", signData.signImgeSeqNo);
  1228. param.Add("signData", decodedImage);
  1229. param.Add("inptUser", inptId);
  1230. dac.setUserSignData(this.cendbMapper, param);
  1231. }
  1232. }
  1233. else
  1234. {
  1235. //사인데이터가 없으면 그대로 저장
  1236. insSignImage(instCd,
  1237. userId,
  1238. int.TryParse(signSeq, out int res) ? res : 1,
  1239. decodedImage,
  1240. inptId,
  1241. dac,
  1242. mapper);
  1243. }
  1244. }
  1245. result = "1";
  1246. return result;
  1247. }
  1248. catch (Exception ex)
  1249. {
  1250. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm setSignImage error: {0}", ex.Message));
  1251. throw ex;
  1252. }
  1253. }
  1254. /// <summary>
  1255. /// 서명이미지를 생성한다.
  1256. /// </summary>
  1257. /// <param name="instCd"></param>
  1258. /// <param name="userId"></param>
  1259. /// <param name="nextSeqNo"></param>
  1260. /// <param name="signImage"></param>
  1261. /// <param name="inptId"></param>
  1262. /// <param name="dac"></param>
  1263. /// <param name="mapper"></param>
  1264. private void insSignImage(string instCd, string userId, int nextSeqNo, byte[] signImage, string inptId, UserDac dac, ISqlMapper mapper)
  1265. {
  1266. Hashtable param = new Hashtable();
  1267. param.Add("instCd", instCd);
  1268. param.Add("userId", userId);
  1269. param.Add("nextSeqNo", nextSeqNo);
  1270. param.Add("signData", signImage);
  1271. param.Add("inputUserId", inptId);
  1272. dac.insSignImage(mapper, param);
  1273. }
  1274. /// <summary>
  1275. /// 사용자 사인데이터의 ToDd를 설정한다
  1276. /// </summary>
  1277. /// <param name="instCd"></param>
  1278. /// <param name="userId"></param>
  1279. /// <param name="curSeqNo"></param>
  1280. /// <param name="toDd"></param>
  1281. /// <param name="repryn"></param>
  1282. /// <param name="inptUser"></param>
  1283. /// <param name="dac"></param>
  1284. /// <param name="mapper"></param>
  1285. private void setSignToDd(string instCd, string userId, int curSeqNo, string toDd, string repryn, string inptUser, UserDac dac, ISqlMapper mapper)
  1286. {
  1287. Hashtable param = new Hashtable();
  1288. param.Add("instCd", instCd);
  1289. param.Add("userId", userId);
  1290. param.Add("curSeqNo", curSeqNo);
  1291. param.Add("yesterDay", toDd);
  1292. param.Add("repryn", repryn);
  1293. param.Add("inptUser", inptUser);
  1294. dac.setUserSignToDd(mapper, param);
  1295. }
  1296. /// <summary>
  1297. /// 사용자에 대한 서명정보 조회
  1298. /// </summary>
  1299. /// <param name="instCd"></param>
  1300. /// <param name="userId"></param>
  1301. /// <returns></returns>
  1302. [WebMethod(Description = "서명 이미지 조회")]
  1303. public UserSignDataVo getUserSignDataInfo(string instCd, string userId)
  1304. {
  1305. UserSignDataVo result = null;
  1306. UserDac dac = new UserDac();
  1307. Hashtable param = new Hashtable();
  1308. param.Add("instCd", instCd);
  1309. param.Add("userId", userId);
  1310. result = dac.getUserSignDataInfo(IbatisMapper, param);
  1311. if(result == null)
  1312. {
  1313. CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("data: null"));
  1314. Hashtable param2 = new Hashtable();
  1315. param2.Add("userId", userId);
  1316. result = new UserSignDataVo();
  1317. result.userId = userId;
  1318. result.signImgeSeqNo = 0;
  1319. result.instCd = instCd;
  1320. result.signImgeFromDd = DateTime.Now.ToString("yyyyMMdd");
  1321. result.signData = null;
  1322. result.userNm = dac.getUserName(this.IbatisMapper, param2);
  1323. }
  1324. return result;
  1325. }
  1326. [WebMethod(Description = "파라미터 필드 메시지 조회")]
  1327. public SingleReturnData getEmrDataString(string flag, string instcd, string pid, string indd, string cretno, string formCd) {
  1328. SingleReturnData result = new SingleReturnData();
  1329. using (PatientDac dac = new PatientDac()) {
  1330. Hashtable param = new Hashtable();
  1331. param.Add("flag", flag);
  1332. param.Add("instcd", instcd);
  1333. param.Add("pid", pid);
  1334. param.Add("indd", indd);
  1335. param.Add("cretno", cretno);
  1336. param.Add("formCd", formCd);
  1337. var retValue = dac.getEmrDataString(this.IbatisMapper, param);
  1338. if(retValue == null || retValue.Equals(String.Empty)) {
  1339. result.responseData = String.Empty;
  1340. }
  1341. else {
  1342. result.responseData = retValue;
  1343. }
  1344. }
  1345. return result;
  1346. }
  1347. #endregion
  1348. }
  1349. }