1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130 |
- #region Copyright © 2015 CLIPSOFT Co.,Ltd. All Rights Reserved.
- //
- // All rights are reserved. Reproduction or transmission in whole or in part,
- // in any form or by any means, electronic, mechanical or otherwise, is
- // prohibited without the prior written consent of the copyright owner.
- //
- // Filename: ConsentSvc.asmx.cs
- //
- #endregion
- using System;
- using System.IO;
- using System.Text;
- using System.Xml;
- using System.Collections.Generic;
- using System.Web.Services;
- using System.Collections;
- using IBatisNet.DataMapper;
- using CLIP.eForm.Server.Data;
- using CLIP.eForm.Server.VO;
- using CLIP.eForm.Consent.Entity;
- using CLIP.eForm.Consent.Dac;
- using System.DirectoryServices;
- using System.Web.Script.Services;
- using System.IO.Compression;
- namespace CLIP.eForm.Consent.WebService {
- /// <summary>
- /// 전자 동의서 관련 웹서비스
- /// </summary>
- /// <remarks>
- /// <p>[설계자]</p>
- /// <p> 클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)</p>
- /// <p>[원본 작성자]</p>
- /// <p> 클립소프트 기술부 이창훈 (chlee@clipsoft.co.kr)</p>
- /// <p>[수정 작성자]</p>
- /// <p> 클립소프트 기술부 이인희</p>
- /// <p>----------------------------------------------------------------------------------------</p>
- /// <p>[HISTORY]</p>
- /// <p> 2016-06-15 : 최초작성</p>
- /// <p>----------------------------------------------------------------------------------------</p>
- /// </remarks>
- /// <summary>
- /// ConsentSvc의 요약 설명입니다.
- /// </summary>
- [WebService(Namespace = "http://tempuri.org/")]
- [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
- [System.ComponentModel.ToolboxItem(false)]
- // ASP.NET AJAX를 사용하여 스크립트에서 이 웹 서비스를 호출하려면 다음 줄의 주석 처리를 제거합니다.
- // [System.Web.Script.Services.ScriptService]
- public class ConsentSvc : System.Web.Services.WebService {
- private IBatisHelper _ibatisHelper;
- private static string tempImageDelStatus = string.Empty;
- public ConsentSvc() {
- _ibatisHelper = new IBatisHelper("ConsentSvcOracleMap.config");
- }
- protected override void Dispose(bool disposing) {
- if (IbatisSession != null && IbatisSession.Transaction != null) {
- IbatisSession.CommitTransaction();
- IbatisSession.CloseConnection();
- }
- if (IbatisMapper != null)
- IbatisMapper.CloseConnection();
- base.Dispose(disposing);
- }
- /// <summary>
- /// 현재 연결된 IBatis Connection을 반환
- /// </summary>
- public ISqlMapper IbatisMapper {
- get {
- if (_ibatisHelper == null) {
- return null;
- } else {
- return _ibatisHelper.GetSqlMapper();
- }
- }
- }
- /// <summary>
- /// 현재 연결된 ISqlMapSession 을 반환
- /// </summary>
- public ISqlMapSession IbatisSession {
- get {
- if (_ibatisHelper == null) {
- return null;
- } else {
- return _ibatisHelper.GetMapSession();
- }
- }
- }
- [WebMethod]
- public bool CheckWebService() {
- return true;
- }
- /// <summary>
- /// 경북대학교병원 출력 로그에 기록되지 않아야 할 목록 조회
- /// </summary>
- /// <param name="dutinstcd"></param>
- /// <returns></returns>
- [WebMethod(Description = "Type 6 인 동의서 조회")]
- public List<String> getOcrType6Forms(string dutinstcd) {
- using (SaveConsentDac dac = new SaveConsentDac()) {
- Hashtable param = new Hashtable();
- param.Add("instcd", dutinstcd);
- return (List<String>) dac.getOcrType6Forms(this.IbatisMapper, param);
- }
- }
- [WebMethod]
- public bool CheckDatabaseConnection() {
- // TODO: 데이터 베이스 커넥션 테스트 호출 필요
- return false;
- }
- /// <summary>
- /// 동의서 카테고리 조회
- /// </summary>
- [WebMethod(Description = "동의서 카테고리 조회")]
- public List<CategoryForDropdownVO> GetCategoryForDropdown() {
- List<CategoryForDropdownVO> result;
- try {
- using (FormCategoryDac dac = new FormCategoryDac()) {
- Hashtable param = new Hashtable();
- result = (List<CategoryForDropdownVO>) dac.GetCategoryForDropdown(this.IbatisMapper, param);
- }
- } catch (Exception ex) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetCategoryForDropdown error: {0}", ex.Message));
- throw ex;
- }
- return result;
- }
- /// <summary>
- /// 환자, 상태에 따른 동의서 목록 검색
- /// </summary>
- /// <param name="pid">환자등록번호</param>
- /// <param name="userId">사용자 아이디, 작성자별 조회시 pid는 입력하지 않고 userId만 보내줘야함</param>
- /// <param name="startDt">데이터생성일자 조회 시작일</param>
- /// <param name="endDt">조회 마지막 일자 (현재 일자를 넣음)</param>
- /// <param name="consentState">동의서 상태</param>
- /// <param name="instCd">근무지기관코드</param>
- /// <returns></returns>
- [WebMethod(Description = "환자/상태에 따른 동의서 목록 검색")]
- public List<ConsentVO> GetConsentList(string pid, string userId, string startDt, string endDt, string consentState, string instCd) {
- List<ConsentVO> result;
- try {
- // 임시저장 조회 시 미작성이 없으면 미작성 상태도 추가
- if (!string.IsNullOrEmpty(consentState)) {
- bool _hasTemp = false;
- bool _hasUnfinished = false;
- string[] _stateArr = consentState.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
- foreach (string s in _stateArr) {
- if (s.Equals("TEMP")) {
- _hasTemp = true;
- } else if (s.Equals("UNFINISHED")) {
- _hasUnfinished = true;
- }
- }
- if (_hasTemp && !_hasUnfinished) {
- consentState += ",'UNFINISHED'";
- }
- }
- using (ConsentDac dac = new ConsentDac()) {
- Hashtable param = new Hashtable {
- { "pid", pid },
- { "userId", userId },
- { "startDt", startDt },
- { "endDt", endDt },
- { "consentState", consentState },
- { "instCd", instCd }
- };
- result = (List<ConsentVO>) dac.GetConsentList(this.IbatisMapper, param);
- }
- return result;
- } catch (Exception ex) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetConsentList error: {0}", ex.Message));
- throw ex;
- }
- }
- /// <summary>
- /// 환자, 상태에 따른 동의서 목록 검색
- /// </summary>
- /// <param name="srchDd">환자 조회에 들어가는 날짜, 검사 탭일때는 fromDt</param>
- /// <param name="pid">환자등록번호</param>
- /// <param name="userId">사용자 아이디, 작성자별 조회시 pid는 입력하지 않고 userId만 보내줘야함</param>
- /// <param name="startDt">데이터생성일자 조회 시작일</param>
- /// <param name="endDt">조회 마지막 일자 (현재 일자를 넣음)</param>
- /// <param name="consentState">동의서 상태</param>
- /// <param name="instCd">근무지기관코드</param>
- /// <param name="doctorId">의사 아이디</param>
- /// <param name="ordDeptCd">진료과 코드</param>
- /// <param name="patientState">환자 동의서 상태, ordType가 S 이면 patientState가 입원, 외래, 응급으로 구분한다</param>
- /// <param name="ordType">입원(I), 외래(O), 응급(ER), 수술(OP), 검사(EX), 검색(S) 구분 코드</param>
- /// <param name="myPatient">ordType가 입원일때 간호사, 의사 내환자 선택여부</param>
- /// <param name="wardCd">입원 일때 병동코드</param>
- /// <param name="drKind">로그인 사용자 직종 구분 코드 A : 전문의, B : 주치의(교수), C : 그 외 직종</param>
- /// <param name="srchYN">검색탭 인지 구분</param>
- /// <param name="toDd">검사탭 일때 시작일</param>
- /// <param name="mainDr">검사탭 일때 판독의 이름</param>
- /// <param name="mainDrChecked">검사탭 일때 판독의, 예정 판독의 구분 Y : 예정 판독의, N : 판독의</param>
- /// <param name="supportBaseCd">검사탭 일때 지원부서 베이스 코드</param>
- /// <param name="supportDeptCd">검사탭 일때 지원부서 하위 코드</param>
- /// <returns></returns>
- [WebMethod(Description = "날짜별 확인, 임시 동의서 리스트")]
- public List<ConsentVO> GetConsentDateList(string srchDd, string pid, string userId, string startDt, string endDt, string consentState, string instCd, string doctorId, string ordDeptCd, string patientState,
- string ordType, string myPatient, string wardCd, string drKind, string srchYN,
- string toDd, string mainDr, string mainDrChecked, string supportBaseCd, string supportDeptCd) {
- List<ConsentVO> result = null;
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("srchDd -- > " + srchDd);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("pid -- > " + pid);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("userId -- > " + userId);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("startDt -- > " + startDt);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("endDt -- > " + endDt);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("consentState -- > " + consentState);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("instCd -- > " + instCd);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("doctorId -- > " + doctorId);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("ordDeptCd -- > " + ordDeptCd);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("patientState -- > " + patientState);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("ordType -- > " + ordType);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("myPatient -- > " + myPatient);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("wardCd -- > " + wardCd);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("drKind -- > " + drKind);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("srchYN -- > " + srchYN);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("toDd -- > " + toDd);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("mainDr -- > " + mainDr);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("mainDrChecked -- > " + mainDrChecked);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("supportBaseCd -- > " + supportBaseCd);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("supportDeptCd -- > " + supportDeptCd);
- try {
- // 임시저장 조회 시 미작성이 없으면 미작성 상태도 추가
- if (!string.IsNullOrEmpty(consentState)) {
- bool _hasTemp = false;
- bool _hasUnfinished = false;
- string[] _stateArr = consentState.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
- foreach (string s in _stateArr) {
- if (s.Equals("TEMP")) {
- _hasTemp = true;
- } else if (s.Equals("UNFINISHED")) {
- _hasUnfinished = true;
- }
- }
- if (_hasTemp && !_hasUnfinished) {
- consentState += ",'UNFINISHED'";
- }
- }
- if (ordType == "S") {
- ordType = patientState;
- }
- // 병동 일때
- var myPatientFlag = myPatient ?? "N";
- wardCd = wardCd ?? "";
- userId = userId ?? "";
- // 검색탭에서 쓰임
- srchYN = srchYN ?? "N";
- // 검사 일때
- toDd = toDd ?? "";
- mainDr = mainDr ?? "";
- mainDrChecked = mainDrChecked ?? "";
- supportBaseCd = supportBaseCd ?? "";
- supportDeptCd = supportDeptCd ?? "";
- using (ConsentDac dac = new ConsentDac()) {
- Hashtable param = new Hashtable();
- param.Add("srchDd", srchDd);
- param.Add("pid", pid);
- param.Add("userId", userId);
- param.Add("startDt", startDt);
- param.Add("endDt", endDt);
- param.Add("consentState", consentState);
- param.Add("instCd", instCd);
- param.Add("doctorId", doctorId);
- param.Add("ordDeptCd", ordDeptCd);
- param.Add("patientState", patientState);
- param.Add("ordType", ordType);
- param.Add("myPatient", myPatientFlag);
- param.Add("wardCd", wardCd);
- param.Add("srchYN", srchYN);
- param.Add("drKind", drKind);
- param.Add("isMainD", mainDrChecked);
- param.Add("mainDrId", mainDr);
- param.Add("baseCd", supportBaseCd);
- param.Add("supportDeptCd", supportDeptCd);
- param.Add("toDt", toDd);
- param.Add("fromDt", srchDd);
- result = (List<ConsentVO>) dac.GetConsentDateList(this.IbatisMapper, param);
- }
- return result;
- } catch (Exception ex) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetConsentDateList error: {0}", ex.Message));
- throw ex;
- }
- }
- /// <summary>
- /// 환자 목록에서 환자 선택시 환자 처방연동 서식 리스트
- /// </summary>
- /// <param name="pid">환자 등록번호</param>
- /// <param name="ordDd">진료 일자</param>
- /// <returns></returns>
- [WebMethod(Description = "환자 처방연동서식")]
- public List<ConsentVO> GetPrescriptionConsentList(string pid, string ordDd) {
- List<ConsentVO> result;
- try {
- using (ConsentDac dac = new ConsentDac()) {
- Hashtable param = new Hashtable();
- param.Add("pid", pid);
- param.Add("ordDd", ordDd);
- result = (List<ConsentVO>) dac.GetPrescriptionConsentList(this.IbatisMapper, param);
- }
- return result;
- } catch (Exception ex) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetPrescriptionConsentList error: {0}", ex.Message));
- throw ex;
- }
- }
- /// <summary>
- /// 동의서 찾기
- /// </summary>
- /// <param name="categoryId">카테고리 ID 전체 : 빈값</param>
- /// <param name="keyWord">검색할 키워드</param>
- /// <param name="instCd">근무지기관코드, 101, 031</param>
- /// <param name="toDay">오늘 일자, 20190101</param>
- /// <returns></returns>
- [WebMethod(Description = "동의서 찾기(조회)")]
- public List<ConsentVO> GetConsentBySearch(string categoryId, string keyWord, string instCd, string toDay) {
- List<ConsentVO> result;
- try {
- using (ConsentDac dac = new ConsentDac()) {
- keyWord = keyWord ?? "";
- if (keyWord != "") {
- keyWord = string.Format("%{0}%", keyWord);
- }
- Hashtable param = new Hashtable();
- param.Add("categoryId", categoryId);
- param.Add("keyWord", keyWord.ToUpper());
- param.Add("instCd", instCd);
- param.Add("toDay", toDay);
- result = (List<ConsentVO>) dac.GetConsentBySearch(this.IbatisMapper, param);
- }
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(result);
- return result;
- } catch (Exception ex) {
- System.Diagnostics.Trace.WriteLine(string.Format("CLIP.eForm GetConsentBySearch error: {0}", ex.Message));
- throw ex;
- }
- }
- /// <summary>
- /// 동의서 SET 조회
- /// </summary>
- /// <param name="userId">사용자 아이디 107810</param>
- /// <param name="instCd">근무지기관코드</param>
- /// <param name="toDay">오늘 날짜</param>
- [WebMethod(Description = "동의서 SET 조회")]
- public List<ConsentVO> GetConsentSetList(string userId, string instCd, string toDay) {
- List<ConsentVO> result;
- try {
- using (ConsentDac dac = new ConsentDac()) {
- Hashtable param = new Hashtable();
- param.Add("instCd", instCd);
- param.Add("userId", userId);
- param.Add("toDay", toDay);
- result = (List<ConsentVO>) 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;
- }
- }
- /// <summary>
- /// 동의서 찾기
- /// </summary>
- /// <param name="calcscorCd">수가코드</param>
- /// <returns></returns>
- //[WebMethod(Description = "동의서 찾기(수가코드)")]
- //public List<ConsentBySearchVO> GetConsentByCalcscorcd(string calcscorCd) {
- // List<ConsentBySearchVO> result;
- // try {
- // using (ConsentDac dac = new ConsentDac()) {
- // Hashtable param = new Hashtable();
- // param.Add("calcscorcd", calcscorCd);
- // result = (List<ConsentBySearchVO>) dac.GetConsentByCalcscorcd(this.IbatisMapper, param);
- // }
- // return result;
- // } catch (Exception ex) {
- // System.Diagnostics.Trace.WriteLine(string.Format("CLIP.eForm GetConsentByCalcscorcd error: {0}", ex.Message));
- // throw ex;
- // }
- //}
- /// <summary>
- /// 동의서 찾기
- /// </summary>
- /// <param name="formCd">서식코드</param>
- /// <param name="instCd">근무지기관코드</param>
- /// <returns>ConsentBySearchVO 객체 List</returns>
- [WebMethod(Description = "동의서 찾기(서식코드)")]
- public List<ConsentVO> GetConsentByFormcd(string formCd, string instCd, string today) {
- List<ConsentVO> result;
- try {
- using (ConsentDac dac = new ConsentDac()) {
- Hashtable param = new Hashtable();
- string formCdArr = "";
- if(formCd.Length == 0) {
- return null;
- }
- string[] cdArr = formCd.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
- for (int i = 0; i < cdArr.Length; i++) {
- formCdArr += string.Format("'{0}',", cdArr[i].Trim());
- }
- formCdArr = formCdArr.Remove(formCdArr.Length - 1);
- param.Add("formcdarr", formCdArr);
- param.Add("instCd", instCd);
- param.Add("today", today);
- result = (List<ConsentVO>) dac.getConsentByFormcd(this.IbatisMapper, param);
- }
- return result;
- } catch (Exception ex) {
- System.Diagnostics.Trace.WriteLine(string.Format("CLIP.eForm GetConsentByFormcd error: {0}", ex.Message));
- throw ex;
- }
- }
- /// <summary>
- /// 동의서 재인증 여부
- /// </summary>
- /// <param name="pid">환자 등록번호</param>
- /// <param name="ordDd">진료 일자</param>
- /// <param name="cretNo">수진 일련번호</param>
- /// <param name="ordType">내원 경로 입원 : I, 외래 : O, 응급 : ER, 수술 : OP, 검사 : EX</param>
- /// <param name="recDd">동의서 작성 일자</param>
- /// <param name="userId">사용자 아이디</param>
- [WebMethod(Description = "동의서 재인증 여부")]
- public SingleReturnData ReUseCertifyConsentFlag(string pid, string ordDd, string cretNo, string ordType, string recDd, string userId) {
- SingleReturnData rts = new SingleReturnData();
- try {
- using (ConsentDac dac = new ConsentDac()) {
- Hashtable param = new Hashtable();
- param.Add("vInstcd", "101");
- param.Add("vPid", pid);
- param.Add("vOrddd", ordDd);
- param.Add("vCretno", cretNo);
- param.Add("vOrdtype", ordType);
- param.Add("vRecdd", recDd);
- param.Add("vUserid", userId);
- string result = dac.ReUseCertifyConsentFlag(this.IbatisMapper, param);
- rts.responseData = result;
- }
- } catch (Exception ex) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm ReUseCertifyConsentFlag error: {0}", ex.Message));
- throw ex;
- }
- return rts;
- }
- /// <summary>
- /// 일괄인증 허용 사용자 여부
- /// </summary>
- /// <param name="instcd"></param>
- /// <param name="userid"></param>
- /// <returns>OK 일때 일괄인증 수행, 그외의 값은 일괄인증 허가되지 않음</returns>
- [WebMethod(Description = "일괄인증 허용 사용자 여부")]
- public SingleReturnData getSaveAllFlag(string instcd, string userid) {
- //string retValue = string.Empty;
- SingleReturnData retValue = new SingleReturnData();
- String result = "";
- try {
- using (ConsentDac dac = new ConsentDac()) {
- Hashtable param = new Hashtable();
- param.Add("instcd", "101");
- param.Add("userid", userid);
- result = dac.getSaveAllFlag(this.IbatisMapper, param);
- retValue.responseData = result;
- }
- }catch(Exception e) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm getSaveAllFlag error: {0}", e.Message));
- }
- return retValue;
- }
- /// <summary>
- /// CONSENT_MST_RID를 갖고 저장된 동의서 이미지를 조회
- /// </summary>
- /// <param name="consentMstRid">동의서 마스터 데이터 Rid</param>
- [WebMethod(Description = "동의서 저장된 이미지 내역 조회")]
- public List<ConsentImageVO> GetConsentImage(string consentMstRid) {
- List<ConsentImageVO> result;
- try {
- using (ConsentDac dac = new ConsentDac()) {
- string remotePath = "";
- Dictionary<String, String> remoteData = remoteInfo();
- Hashtable param = new Hashtable();
- int consentMstRidInt = 0;
- int.TryParse(consentMstRid, out consentMstRidInt);
- param.Add("consent-mst-rid", consentMstRidInt);
- result = (List<ConsentImageVO>) dac.GetConsentImage(this.IbatisMapper, param);
- remotePath = result[0].imagePath;
- // 계정을 choiadmin 으로 가장한다
- ClipSoft.Utility.ImpersonationUtility util = new ClipSoft.Utility.ImpersonationUtility();
- var imResult = util.ImpersonationStart(remotePath, remoteData["NETDRV_USERID_ADMIN"], remoteData["NETDRV_PASSWORD_ADMIN"]);
- // for debug
- DirectoryInfo destDi = new DirectoryInfo(Server.MapPath("DataTempImage"));
- var destDirStr = destDi.ToString();
- DirectoryInfo origDi = new DirectoryInfo(remotePath);
- // 해당 경로에 디렉토리가 없다면 생성하여 준다
- if (!destDi.Exists) {
- destDi.Create();
- }
- foreach (ConsentImageVO img in result) {
- var origFullPath = String.Format(@"{0}\{1}", origDi, img.imageFilename);
- var destFullPath = String.Format(@"{0}\{1}{2}", destDirStr, img.imageFilename, ".jpg");
- try {
- // 파일이 존재하면 덮어 쓴다.
- File.Copy(origFullPath, destFullPath, true);
- } catch (Exception e) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("file copy error", e);
- }
- img.imagePath = "DataTempImage";
- img.imageFilename = img.imageFilename + ".jpg";
- }
- util.ImpersonationEnd();
- }
- // ?? 왜 로컬에 있는 tempfile 들을 삭제할까?
- //int iResult = DeleteTempFile();
- return result;
- } catch (Exception ex) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetConsentImage error: {0}", ex.Message));
- throw ex;
- }
- }
- [WebMethod(Description = "동의서 저장된 음성 녹음 파일 갯수 확인")]
- public SingleReturnData GetConsentAudioCount(string consentMstRid) {
- SingleReturnData rts = new SingleReturnData();
- try {
- using (ConsentDac dac = new ConsentDac()) {
- Hashtable param = new Hashtable();
- param.Add("consentMstRid", consentMstRid);
- int result = 0;
- result = (int) dac.GetConsentAudioCount(this.IbatisMapper, param);
- rts.responseData = Convert.ToString(result);
- }
- } catch (Exception ex) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetConsentAudio error: {0}", ex.Message));
- throw ex;
- }
- return rts;
- }
- [WebMethod(Description = "동의서 저장된 음성 녹음 파일 내역 조회")]
- public List<ConsentImageVO> GetConsentAudio(string consentMstRid) {
- List<ConsentImageVO> result;
- try {
- using (ConsentDac dac = new ConsentDac()) {
- string remotePath = "";
- Dictionary<String, String> remoteData = remoteInfo();
- Hashtable param = new Hashtable();
- int consentMstRidInt = 0;
- int.TryParse(consentMstRid, out consentMstRidInt);
- param.Add("consentMstRid", consentMstRid);
- result = (List<ConsentImageVO>) dac.getConsentAudio(this.IbatisMapper, param);
- if(result.Count > 0) {
- remotePath = result[0].imagePath;
- ClipSoft.Utility.ImpersonationUtility util = new ClipSoft.Utility.ImpersonationUtility();
- var imResult = util.ImpersonationStart(remotePath, remoteData["NETDRV_USERID_ADMIN"], remoteData["NETDRV_PASSWORD_ADMIN"]);
- DirectoryInfo destDi = new DirectoryInfo(Server.MapPath("DataTempImage"));
- var destDirStr = destDi.ToString();
- DirectoryInfo origDi = new DirectoryInfo(remotePath);
- // 해당 경로에 디렉토리가 없다면 생성하여 준다
- if (!destDi.Exists) {
- destDi.Create();
- }
- foreach (ConsentImageVO img in result) {
- var origFullPath = String.Format(@"{0}\{1}", origDi, img.imageFilename);
- var destFullPath = String.Format(@"{0}\{1}{2}", destDirStr, img.imageFilename, ".mp4");
- try {
- File.Copy(origFullPath, destFullPath, true);
- } catch (Exception e) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("file copy error", e);
- }
- img.imagePath = "DataTempImage";
- img.imageFilename = img.imageFilename + ".mp4";
- }
- util.ImpersonationEnd();
- }
- }
- return result;
- } catch (Exception ex) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetConsentAudio error: {0}", ex.Message));
- throw ex;
- }
- }
- /// <summary>
- /// 임시저장 동의서 삭제
- /// </summary>
- /// <param name="userId"></param>
- /// <param name="consentMstRid"></param>
- /// <param name="reasonForUseN"></param>
- [WebMethod(Description = "임시저장 동의서 삭제")]
- public SingleReturnData saveDelete(string userId, string consentMstRid, string reasonForUseN) {
- SingleReturnData rts = new SingleReturnData();
- int result = 0;
- string ocrTag = "";
- try {
- if (this.IbatisSession.IsTransactionStart == false) {
- this.IbatisSession.BeginTransaction();
- }
- using (SaveConsentDac dac = new SaveConsentDac()) {
- Hashtable param = new Hashtable();
- param.Add("userId", userId);
- param.Add("consentMstRid", consentMstRid);
- param.Add("reasonForUseN", reasonForUseN);
- ocrTag = dac.UpdateConsentMstForDelete(this.IbatisMapper, param);
- if (!string.IsNullOrEmpty(ocrTag)) {
- param.Add("ocrTag", ocrTag);
- result = dac.UpdateMrfhocrprntStatCd(this.IbatisMapper, param);
- }
- rts.responseData = Convert.ToString(result);
- }
- if (this.IbatisSession != null) this.IbatisSession.CommitTransaction();
- } catch (Exception ex) {
- if (this.IbatisSession != null) this.IbatisSession.RollBackTransaction();
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm saveDelete ERROR : [{0}]", ex.ToString()));
- throw ex;
- }
- return rts;
- }
- /// <summary>
- /// 임시저장, 확인저장
- /// </summary>
- /// <param name="userId">로그인 사용자ID</param>
- /// <param name="userDeptCd">로그인 사용자 부서 코드</param>
- /// <param name="pid">환자 등록번호</param>
- /// <param name="formId">서식 ID</param>
- /// <param name="formCd">서식 코드</param>
- /// <param name="patientDeptCd">환자가 내원한, 속해있는 부서 코드</param>
- /// <param name="formXml">서식 정보</param>
- /// <param name="dataXml">사용자가 작성한 서식 내용</param>
- /// <param name="consentMstRid">동의서 마스터 데이터 Rid</param>
- /// <param name="reWriteconsentMstRid">재 작성 대상 동의서 마스터 데이터 Rid</param>
- /// <param name="deviceType">장비 유형 (WIN, AND, IOS, PRT 중1)</param>
- /// <param name="deviceMacAddr">장비 고유 식별자</param>
- /// <param name="ordType">내원 구분 입원 : I, 외래 : O, 수술 : OP, 응급 : ER</param>
- /// <param name="instCd">근무지 기관코드</param>
- /// <param name="inDd">내원 일자 입원 : inDd, 외래 : ordDd</param>
- /// <param name="ward">병동</param>
- /// <param name="roomCd">병실</param>
- /// <param name="ocrTag">ocrTag</param>
- /// <param name="cretNo">생성번호</param>
- /// <param name="mainDrId">환자를 담당하는 의사(담당교수, 주치의, 담당의사 등)</param>
- /// <param name="formPageCnt">동의서 총 장수</param>
- /// <param name="actionKind">임시저장 : T, 인증저장 : C</param>
- /// <param name="opRsrvNo">수술번호</param>
- /// <param name="consentState">동의서 상태</param>
- /// <param name="orderNo">처방번호</param> 20190822 원형만 유지하되 당장 사용하지 않음
- /// <param name="orderName">처방 이름</param> 20190822 원형만 유지하되 당장 사용하지 않음
- /// <param name="orderCd">처방 코드?</param> 20190822 원형만 유지하되 당장 사용하지 않음
- /// <param name="audioFileJson">음성녹음 바이너리 데이터</param>
- /// <param name="audioFileSize">음성녹음 파일 사이즈</param>
- /// <param name="imageFileJson">이미지 바이너리 데이터</param>
- /// <param name="fileSize">이미지 파일 사이즈</param>
- /// <returns></returns>
- [WebMethod(Description = "동의서 임시저장")]
- public SingleReturnData SaveTempData(string userId, string userDeptCd, string pid, string formId, string formCd, string patientDeptCd, string formXml, string dataXml,
- int consentMstRid, int reWriteConsentMstRid, string deviceType, string deviceMacAddr, string ordType, string instCd, string inDd, string dSchDd,
- string ward, string roomCd, string ocrTag, int cretNo, string mainDrId, string formPageCnt, string actionKind, string opRsrvNo, string consentState,
- int orderNo, string orderName, string orderCd, string audioFileJson, string audioFileSize, string imageFileJson, string fileSize) {
- SingleReturnData result = new SingleReturnData();
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(String.Format("userId -- > [{0}]", userId));
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("userDeptCd -- > " + userDeptCd);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("pid -- > " + pid);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("formId -- > " + formId);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("formCd -- > " + formCd);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("patientDeptCd -- > " + patientDeptCd);
- ////CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("formXml -- > " + formXml);
- ////CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("dataXml -- > " + dataXml);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("consentMstRid -- > " + consentMstRid);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("reWriteConsentMstRid -- > " + reWriteConsentMstRid);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("deviceType -- > " + deviceType);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("deviceMacAddr -- > " + deviceMacAddr);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("ordType -- > " + ordType);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("instCd -- > " + instCd);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("inDd -- > " + inDd);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("ward -- > " + ward);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("roomCd -- > " + roomCd);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("ocrTag -- > " + ocrTag);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("cretNo -- > " + cretNo);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("mainDrId -- > " + mainDrId);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("formPageCnt -- > " + formPageCnt);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("actionKind -- > " + actionKind);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("opRsrvNo -- > " + opRsrvNo);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("consentState -- > " + consentState);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("orderNo -- > " + orderNo);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("orderName -- > " + orderName);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error("orderCd -- > " + orderCd);
- consentMstRid = SaveData(userId, userDeptCd, pid, formId, formCd, patientDeptCd, formXml, dataXml,
- consentMstRid, reWriteConsentMstRid, deviceType, deviceMacAddr, ordType, instCd, inDd, dSchDd,
- ward, roomCd, ocrTag, cretNo, mainDrId, formPageCnt, actionKind, opRsrvNo, consentState,
- orderNo, orderName, orderCd, audioFileJson, audioFileSize, imageFileJson, fileSize);
- result.responseData = Convert.ToString(consentMstRid);
- return result;
- }
- public int SaveData(string userId, string userDeptCd, string pid, string formId, string formCd, string patientDeptCd, string formXml, string dataXml,
- int consentMstRid, int reWriteConsentMstRid, string deviceType, string deviceMacAddr, string ordType, string instCd, string inDd, string dSchDd,
- string ward, string roomCd, string ocrTag, int cretNo, string mainDrId, string formPageCnt, string actionKind, string opRsrvNo, string consentState,
- int orderNo, string orderName, string orderCd, string audioFileJson, string audioFileSize, string imageFileJson, string fileSize) {
-
- bool isNewConsentMasterCase = false;
- if (consentMstRid < 1) {
- isNewConsentMasterCase = true;
- }
- if (this.IbatisSession.IsTransactionStart == false) {
- this.IbatisSession.BeginTransaction();
- }
- try {
- using (SaveConsentDac dac = new SaveConsentDac()) {
- int updateResult = 0;
- int deleteResult = 0;
- Hashtable imrParam = new Hashtable();
- imrParam.Add("ocrTag", "'" + ocrTag + "%'");
- int imrCount = (int) dac.ImrCount(this.IbatisMapper, imrParam);
- ImrData imrData = new ImrData();
- if (imrCount > 0) {
- imrData = (ImrData) dac.ImrData(this.IbatisMapper, imrParam);
- }
- Hashtable paramHashTable = GetParamHashTable(userId, userDeptCd, pid, formId, formCd, patientDeptCd, formXml, dataXml,
- consentMstRid, reWriteConsentMstRid, deviceType, deviceMacAddr, ordType, instCd, inDd,
- ward, roomCd, ocrTag, cretNo, mainDrId, formPageCnt, actionKind, opRsrvNo, consentState,
- orderNo, orderName, orderCd, null, null);
- //reasonForUseN
- paramHashTable.Add("macAddress", deviceMacAddr);
- consentMstRid = (int) paramHashTable["consentMstRid"];
- if (isNewConsentMasterCase == true) {
- dac.InsertConsentMst(this.IbatisMapper, paramHashTable);
- dac.InsertConsentData(this.IbatisMapper, paramHashTable);
- } else {
- dac.UpdateConsentMst(this.IbatisMapper, paramHashTable);
- dac.UpdateConsentData(this.IbatisMapper, paramHashTable);
- }
- if (!string.IsNullOrEmpty(audioFileJson)) {
- audioUpLoad(dac, paramHashTable, userId, consentMstRid, formId, audioFileJson, audioFileSize, ocrTag, pid);
- }
- if (!string.IsNullOrEmpty(imageFileJson)) {
- imageUpload(dac, paramHashTable, userId, pid, ordType, inDd, dSchDd, cretNo, ocrTag, consentMstRid, consentState, formCd, formId, dataXml, imageFileJson, instCd, patientDeptCd, fileSize);
- }
- if (imrCount > 0) {
- String[] strAr = imrData.fileName.Split(new char[] { '_' });
- imrData.fileName = strAr[0] + "_" + strAr[1];
- imrParam.Add("fileName", "'" + imrData.fileName + "%'");
- imrParam.Add("inputDate", imrData.inputDate);
- imrParam.Add("userId", imrData.userId);
- updateResult = dac.ImrScanFileUpdate(this.IbatisMapper, imrParam);
- if (updateResult > 0) {
- deleteResult = dac.ImrScanFileDelete(this.IbatisMapper, imrParam);
- }
- if (imrCount != deleteResult) {
- throw new Exception();
- }
- }
- Hashtable ocrParam = new Hashtable {
- { "instcd", instCd },
- { "ocrtag", ocrTag },
- { "pid", pid },
- { "ordtype", ordType },
- { "orddd", inDd },
- { "cretno", cretNo },
- { "orddrid", mainDrId },
- { "orddeptcd", patientDeptCd },
- { "formcd", formCd },
- { "fstprntdeptcd", userDeptCd },
- { "fstprntid", userId },
- { "updtdeptcd", userDeptCd },
- { "updtuserid", userId },
- { "updtdt", DateTime.Now.ToString("yyyyMMddHHmmss")},
- { "pagecnt", formPageCnt },
- //{ "updtresncnts", reasonForUseN },
- { "actkind", actionKind },
- { "clienttype", "M" }
- };
- dac.InsertPrintData(this.IbatisMapper, ocrParam);
- if (this.IbatisSession != null) this.IbatisSession.CommitTransaction();
- }
- } catch (Exception ex) {
- if (this.IbatisSession != null) this.IbatisSession.RollBackTransaction();
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm SaveData ERROR : [{0}]", ex.ToString()));
- throw ex;
- }
- return consentMstRid;
- }
- private void audioUpLoad(SaveConsentDac dac, Hashtable paramHashTable, string userId, int consentMstRid, string formId, string audioFileJson, string audioFileSize, string ocrTag, string pid) {
- Dictionary<String, String> remoteData = remoteInfo();
- try {
- string[] fileSizeAr = audioFileSize.Split(new char[] { ',' });
- int consentImageRid = this.GetSequence("CONSENT_AUDIO");
- string sPath = string.Empty;
- string sFileName = string.Empty;
- Dictionary<string, object> jsonRoot = null;
- jsonRoot = fastJSON.JSON.Parse(audioFileJson) as Dictionary<string, object>;
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("fileSize -- > " + audioFileSize);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("audioFileJson -- > " + audioFileJson);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("jsonRoot -- > " + jsonRoot);
- if (jsonRoot != null && jsonRoot.Count > 0) {
- Hashtable audioHashTable = null;
- int nowCnt = 1;
- int audioCnt = 1;
- foreach (KeyValuePair<string, object> jr in jsonRoot) {
- audioHashTable = new Hashtable();
- audioHashTable.Add("consentMstRid", consentMstRid);
- if (nowCnt > 1) {
- consentImageRid = this.GetSequence("CONSENT_AUDIO");
- }
- audioHashTable.Add("consentImageRid", consentImageRid);
- audioHashTable.Add("userId", userId);
- audioHashTable.Add("formId", formId);
- if (jr.Value != null && !string.IsNullOrEmpty(jr.Value.ToString())) {
- sPath = "";
- sFileName = "";
- string[] filePath = jr.Value.ToString().Split('/');
- for (int i = 0; i < filePath.Length; i++) {
- if (i == 0) {
- sPath = filePath[i];
- } else if ((i + 1) == filePath.Length) {
- sFileName = filePath[i];
- } else {
- sPath += "/" + filePath[i];
- }
- }
- var date = DateTime.Now.ToString("yyyyMM");
- var uniqDatetime = DateTime.Now.ToString("yyyyMMddhhmmss");
- string uploadFileName = "audio_" + uniqDatetime + "_" + ocrTag + "_" + audioCnt;
- string sUploadPath = uploadFileName.Substring(4, 4);
- string sUploadFileName = uploadFileName.Substring(uploadFileName.LastIndexOf("\\") + 1);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("uploadFileName -- > " + uploadFileName);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("sUploadPath -- > " + sUploadPath);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("sUploadFileName -- > " + sUploadFileName);
- audioCnt++;
- //var remotePath = remoteData["IMAGEPATH"] + "\\temp_" + remoteData["PATH_IMGDATA"] + "\\" + date + "\\" + pid;
- var remotePath = remoteData["IMAGEPATH"] + "\\" + remoteData["PATH_IMGDATA"] + "\\" + date + "\\" + pid;
- ClipSoft.Utility.ImpersonationUtility util = new ClipSoft.Utility.ImpersonationUtility();
- var imResult = util.ImpersonationStart(remotePath, remoteData["NETDRV_USERID_ADMIN"], remoteData["NETDRV_PASSWORD_ADMIN"]);
- DirectoryInfo destDi = new DirectoryInfo(remotePath);
- string destDirStr = destDi.Name;
- var destFullname = String.Format(@"{0}\{1}", remotePath, sUploadFileName);
- var localFile = Server.MapPath(string.Format(@"./UPLOAD/{0}/{1}", sPath, sFileName));
- if (!destDi.Exists) {
- destDi.Create();
- }
- try {
- File.Copy(localFile, destFullname, true);
- } catch (Exception ex) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm audioUpLoad fileCopy ERROR : [{0}]", ex.ToString()));
- throw ex;
- }
- util.ImpersonationEnd();
- audioHashTable.Add("audioPath", remotePath);
- audioHashTable.Add("audioFilename", sUploadFileName);
- audioHashTable.Add("completeYn", paramHashTable["completeYn"]);
- dac.InsertConsentAudio(this.IbatisMapper, audioHashTable);
- }
-
- }
- nowCnt++;
- }
- } catch (Exception ex) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm audioUpLoad ERROR : [{0}]", ex.ToString()));
- throw ex;
- }
- }
- private Hashtable GetParamHashTable(string userId, string userDeptCd, string pid, string formId, string formCd, string patientDeptCd, string formXml, string dataXml,
- int consentMstRid, int reWriteConsentMstRid, string deviceType, string deviceMacAddr, string ordType, string instCd, string inDd,
- string ward, string roomCd, string ocrTag, int cretNo, string mainDrId, string formPageCnt, string actionKind, string opRsrvNo, string consentState,
- int orderNo, string orderName, string orderCd, string certResult, string certTarget) {
- Hashtable paramHashTable = new Hashtable();
- paramHashTable.Add("userId", userId);
- if (consentMstRid < 1) {
- consentMstRid = this.GetSequence("CONSENT_MST");
- }
- paramHashTable.Add("consentMstRid", consentMstRid);
- paramHashTable.Add("patientCode", pid);
- paramHashTable.Add("clnDeptCd", patientDeptCd);
- paramHashTable.Add("vistType", ordType);
- paramHashTable.Add("hosType", instCd);
- paramHashTable.Add("clnDate", inDd);
- paramHashTable.Add("ward", ward);
- paramHashTable.Add("roomcd", roomCd);
- paramHashTable.Add("orderNo", orderNo);
- paramHashTable.Add("orderName", orderName);
- paramHashTable.Add("orderCd", orderCd);
- paramHashTable.Add("ocrCode", ocrTag);
- paramHashTable.Add("cretno", cretNo);
- paramHashTable.Add("createUserName", userId);
- paramHashTable.Add("modifyUserName", userId);
- paramHashTable.Add("formRid", formId);
- paramHashTable.Add("formCd", formCd);
- paramHashTable.Add("consentState", consentState);
- paramHashTable.Add("certTarget", certTarget); // TODO 원무 pass
- paramHashTable.Add("certResult", certResult); // TODO 원무 pass
- paramHashTable.Add("mainDrId", mainDrId);
- paramHashTable.Add("opRsrvNo", opRsrvNo ?? string.Empty);
- string completeYn = "N"; // 완료 여부
- switch (consentState) {
- case "ELECTR_CMP":
- case "CERTIFY_CMP":
- completeYn = "Y";
- break;
- default:
- break;
- }
- paramHashTable.Add("completeYn", completeYn);
- string completeDateTimeToChars = string.Empty;
- if (completeYn.Equals("Y")) {
- completeDateTimeToChars = "TO_CHAR(SYSDATE,'YYYY-MM-DD hh24:mi:ss')";
- paramHashTable.Add("completeDateTimeToChars", completeDateTimeToChars);
- } else {
- paramHashTable.Add("completeDateTimeToChars", "''");
- }
- string rewriteYn = "N"; // 재 작성 여부
- if (reWriteConsentMstRid > 1) {
- rewriteYn = "Y";
- }
- paramHashTable.Add("rewriteYn", rewriteYn);
- paramHashTable.Add("rewriteConsentMstRid", reWriteConsentMstRid);
- int consentDataRid = this.GetSequence("CONSENT_DATA");
- paramHashTable.Add("consentDataRid", consentDataRid);
- paramHashTable.Add("useYn", "Y");
- Encoding encoding = Encoding.GetEncoding("UTF-8");
- byte[] formBytesConent = null;
- if (!string.IsNullOrEmpty(formXml)) {
- formBytesConent = encoding.GetBytes(formXml);
- }
- byte[] dataBytesConent = null;
- if (!string.IsNullOrEmpty(dataXml)) {
- dataBytesConent = encoding.GetBytes(dataXml);
- }
- paramHashTable.Add("formXml", formBytesConent);
- paramHashTable.Add("dataXml", dataBytesConent);
- paramHashTable.Add("deviceType", deviceType);
- paramHashTable.Add("deviceMacAddr", deviceMacAddr);
- paramHashTable.Add("pageCnt", formPageCnt);
- //paramHashTable.Add("reasonForUseN", reasonForUseN);
- return paramHashTable;
- }
- /// <summary>
- /// 일괄인증저장
- /// </summary>
- /// <param name="userId">사용자 아이디</param>
- /// <param name="userName">사용자 이름</param>
- /// <param name="macAddress">macAddress</param>
- /// <param name="json">일괄인증저장 되어야할 데이터 json string |%%|로 붙어서 나옴</param>
- [WebMethod(Description = "일괄 인증저장")]
- public SingleReturnData SaveAutoCompleteAll(string userId, string userName, string macAddress, string json) {
- SingleReturnData result = new SingleReturnData();
- string success = "false";
- int updateResult = 0;
- try {
- if (!string.IsNullOrEmpty(json)) {
- using (SaveConsentDac dac = new SaveConsentDac()) {
- if (this.IbatisSession.IsTransactionStart == false) {
- this.IbatisSession.BeginTransaction();
- }
- string[] separatingStrings = { "|%%|" };
- string[] jsonAr = json.Split(separatingStrings, System.StringSplitOptions.RemoveEmptyEntries);
- for (int i = 0; i < jsonAr.Length; i++) {
- string jsonData = jsonAr[i];
- Dictionary<string, object> jsonRoot = fastJSON.JSON.Parse(jsonData) as Dictionary<string, object>; ;
- if (jsonRoot != null && jsonRoot.Count > 0) {
- Hashtable dataTable = new Hashtable();
- string idx = jsonRoot["idx"].ToString();
- string consentMstRid = jsonRoot["consentMstRid"].ToString();
- string pid = jsonRoot["pid"].ToString();
- string ocrTag = jsonRoot["ocrTag"].ToString();
- string deptCd = jsonRoot["deptCd"].ToString();
- dataTable.Add("userId", userId);
- dataTable.Add("userName", userName);
- dataTable.Add("idx", idx);
- dataTable.Add("consentMstRid", consentMstRid);
- dataTable.Add("consentState", "CERTIFY_CMP");
- dataTable.Add("pid", pid);
- dataTable.Add("ocrTag", ocrTag);
- dataTable.Add("deptCd", deptCd);
- dataTable.Add("updtdt", DateTime.Now.ToString("yyyyMMddHHmmss"));
- dataTable.Add("macAddress", macAddress);
- updateResult = dac.SaveAutoCompleteAll(this.IbatisMapper, dataTable);
-
- if (updateResult < 0) {
- new Exception();
- }
- }
- }
- }
- success = "true";
- if (this.IbatisSession != null) this.IbatisSession.CommitTransaction();
- }
- } catch (Exception ex) {
- success = "false";
- if (this.IbatisSession != null) this.IbatisSession.RollBackTransaction();
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm SaveAutoCompleteAll ERROR : [{0}]", ex.ToString()));
- }
- //if (!string.IsNullOrEmpty(json)) {
- //Dictionary<string, string> jsonRoot = null;
- //jsonRoot = fastJSON.JSON.Parse(json) as Dictionary<string, string>;
- // if (jsonRoot != null && jsonRoot.Count > 0) {
- // Hashtable imageHashTable = new Hashtable();
- // foreach (KeyValuePair<string, string> jr in jsonRoot) {
- // int i = 0;
- // }
- // }
- //}
- result.responseData = success;
- return result;
- }
- [WebMethod(Description = "테스트")]
- public ImrData imrTest() {
- int imrCount = 0;
- ImrData imrData = new ImrData();
- try {
- using (SaveConsentDac dac = new SaveConsentDac()) {
- Hashtable imrParam = new Hashtable();
- //var pValue = ocr + "%;
- imrParam.Add("ocrTag", "'2019121952292%'");
- imrParam.Add("inputDate", "20191219 10:11:53");
- imrParam.Add("userId", "E00004");
- imrData = (ImrData) dac.ImrData(this.IbatisMapper, imrParam);
- String[] strAr = imrData.fileName.Split(new char[] { '_' });
- imrData.fileName = strAr[0] + "_" + strAr[1];
- imrParam.Add("fileName", "'" + imrData.fileName + "%'");
- int result = dac.ImrScanFileDelete(this.IbatisMapper, imrParam);
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("result -- > " + result);
- }
- } catch (Exception ex) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm SaveDataAll ERROR : [{0}]", ex.ToString()));
- }
- return imrData;
- }
- /// <summary>
- /// 임시저장, 확인저장
- /// </summary>
- /// <param name="userId">로그인 사용자ID</param>
- /// <param name="userDeptCd">로그인 사용자 부서 코드</param>
- /// <param name="pid">환자 등록번호</param>
- /// <param name="formId">서식 ID</param>
- /// <param name="formCd">서식 코드</param>
- /// <param name="patientDeptCd">환자가 내원한, 속해있는 부서 코드</param>
- /// <param name="formXml">서식 정보</param>
- /// <param name="dataXml">사용자가 작성한 서식 내용</param>
- /// <param name="consentMstRid">동의서 마스터 데이터 Rid</param>
- /// <param name="reWriteconsentMstRid">재 작성 대상 동의서 마스터 데이터 Rid</param>
- /// <param name="deviceType">장비 유형 (WIN, AND, IOS, PRT 중1)</param>
- /// <param name="deviceMacAddr">장비 고유 식별자</param>
- /// <param name="ordType">내원 구분 입원 : I, 외래 : O, 수술 : OP, 응급 : ER</param>
- /// <param name="instCd">근무지 기관코드</param>
- /// <param name="inDd">내원 일자 입원 : inDd, 외래 : ordDd</param>
- /// <param name="ward">병동</param>
- /// <param name="roomCd">병실</param>
- /// <param name="ocrTag">ocrTag</param>
- /// <param name="cretNo">생성번호</param>
- /// <param name="mainDrId">환자를 담당하는 의사(담당교수, 주치의, 담당의사 등)</param>
- /// <param name="formPageCnt">동의서 총 장수</param>
- /// <param name="actionKind">임시저장 : T, 인증저장 : C</param>
- /// <param name="opRsrvNo">수술번호</param>
- /// <param name="consentState">동의서 상태</param>
- /// <param name="orderNo">처방번호</param> 20190822 원형만 유지하되 당장 사용하지 않음
- /// <param name="orderName">처방 이름</param> 20190822 원형만 유지하되 당장 사용하지 않음
- /// <param name="orderCd">처방 코드?</param> 20190822 원형만 유지하되 당장 사용하지 않음
- /// <param name="imageFileJson">이미지 파일 정보(전자동의서 서버)</param>
- /// <param name="fileSize">이미지 파일 사이즈(전자동의서 서버)</param>
- /// <param name="audioFileJson">오디오 파일 정보(전자동의서 서버)</param>
- /// <param name="audioFileSize">오디오 파일 사이즈</param>
- [WebMethod(Description = "동의서 서명 완료")]
- public SingleReturnData SaveCompleteAll(string userId, string userDeptCd, string pid, string formId, string formCd, string patientDeptCd, string formXml, string dataXml,
- int consentMstRid, int reWriteConsentMstRid, string deviceType, string deviceMacAddr, string ordType, string instCd, string inDd, string dSchDd,
- string ward, string roomCd, string ocrTag, int cretNo, string mainDrId, string formPageCnt, string actionKind, string opRsrvNo, string consentState,
- int orderNo, string orderName, string orderCd, string imageFileJson, string fileSize, string certResult, string certTarget,
- string audioFileJson, string audioFileSize) {
- SingleReturnData result = new SingleReturnData();
- consentMstRid = SaveDataAll(userId, userDeptCd, pid, formId, formCd, patientDeptCd, formXml, dataXml,
- consentMstRid, reWriteConsentMstRid, deviceType, deviceMacAddr, ordType, instCd, inDd, dSchDd,
- ward, roomCd, ocrTag, cretNo, mainDrId, formPageCnt, actionKind, opRsrvNo, consentState,
- orderNo, orderName, orderCd, imageFileJson, fileSize, certResult, certTarget, audioFileJson, audioFileSize, out int rslt);
- result.responseData = Convert.ToString(rslt);
- return result;
- }
- public int SaveDataAll(string userId, string userDeptCd, string pid, string formId, string formCd, string patientDeptCd, string formXml, string dataXml,
- int consentMstRid, int reWriteConsentMstRid, string deviceType, string deviceMacAddr, string ordType, string instCd, string inDd, string dSchDd,
- string ward, string roomCd, string ocrTag, int cretNo, string mainDrId, string formPageCnt, string actionKind, string opRsrvNo, string consentState,
- int orderNo, string orderName, string orderCd, string imageFileJson, string fileSize, string certResult, string certTarget, string audioFileJson, string audioFileSize, out int result) {
- bool isNewConsentMasterCase = false;
- if (consentMstRid < 1) {
- isNewConsentMasterCase = true;
- }
- if (this.IbatisSession.IsTransactionStart == false) {
- this.IbatisSession.BeginTransaction();
- }
- try {
- using (SaveConsentDac dac = new SaveConsentDac()) {
- int updateResult = 0;
- int deleteResult = 0;
- Hashtable imrParam = new Hashtable();
- imrParam.Add("ocrTag", "'" + ocrTag + "%'");
- int imrCount = (int) dac.ImrCount(this.IbatisMapper, imrParam);
- ImrData imrData = new ImrData();
- if (imrCount > 0) {
- imrData = (ImrData) dac.ImrData(this.IbatisMapper, imrParam);
- }
- Hashtable paramHashTable = GetParamHashTable(userId, userDeptCd, pid, formId, formCd, patientDeptCd, formXml, dataXml,
- consentMstRid, reWriteConsentMstRid, deviceType, deviceMacAddr, ordType, instCd, inDd,
- ward, roomCd, ocrTag, cretNo, mainDrId, formPageCnt, actionKind, opRsrvNo, consentState,
- orderNo, orderName, orderCd, certResult, certTarget);
- paramHashTable.Add("macAddress", deviceMacAddr);
- consentMstRid = (int) paramHashTable["consentMstRid"];
- result = consentMstRid;
- if (isNewConsentMasterCase == true) {
- dac.InsertConsentMst(this.IbatisMapper, paramHashTable);
- dac.InsertConsentData(this.IbatisMapper, paramHashTable);
- imageUpload(dac, paramHashTable, userId, pid, ordType, inDd, dSchDd, cretNo, ocrTag, consentMstRid, consentState, formCd, formId, dataXml, imageFileJson, instCd, patientDeptCd, fileSize);
- } else {
- if (consentState == "CERTIFY_CMP" && reWriteConsentMstRid > 0) {
- int newConsentMstRid = this.GetSequence("CONSENT_MST");
- paramHashTable["rewriteConsentMstRid"] = newConsentMstRid;
- dac.ReWriteUpdateConsentMst(this.IbatisMapper, paramHashTable);
- consentMstRid = newConsentMstRid;
- paramHashTable["consentMstRid"] = consentMstRid;
- paramHashTable["rewriteYn"] = "N";
- paramHashTable["useYn"] = "Y";
- paramHashTable["rewriteConsentMstRid"] = 0;
- dac.InsertConsentMst(this.IbatisMapper, paramHashTable);
- dac.InsertConsentData(this.IbatisMapper, paramHashTable);
- imageUpload(dac, paramHashTable, userId, pid, ordType, inDd, dSchDd, cretNo, ocrTag, consentMstRid, consentState, formCd, formId, dataXml, imageFileJson, instCd, patientDeptCd, fileSize);
- } else {
- dac.UpdateConsentMst(this.IbatisMapper, paramHashTable);
- dac.UpdateConsentData(this.IbatisMapper, paramHashTable);
- imageUpload(dac, paramHashTable, userId, pid, ordType, inDd, dSchDd, cretNo, ocrTag, consentMstRid, consentState, formCd, formId, dataXml, imageFileJson, instCd, patientDeptCd, fileSize);
- }
- }
- if (!string.IsNullOrEmpty(audioFileJson)) {
- audioUpLoad(dac, paramHashTable, userId, consentMstRid, formId, audioFileJson, audioFileSize, ocrTag, pid);
- }
- if (imrCount > 0) {
- String[] strAr = imrData.fileName.Split(new char[] { '_' });
- imrData.fileName = strAr[0] + "_" + strAr[1];
- imrParam.Add("fileName", "'" + imrData.fileName + "%'");
- imrParam.Add("inputDate", imrData.inputDate);
- imrParam.Add("userId", imrData.userId);
- updateResult = dac.ImrScanFileUpdate(this.IbatisMapper, imrParam);
- if (updateResult > 0) {
- deleteResult = dac.ImrScanFileDelete(this.IbatisMapper, imrParam);
- }
- if (imrCount != deleteResult) {
- throw new Exception();
- }
- }
- Hashtable ocrParam = new Hashtable {
- { "instcd", instCd },
- { "ocrtag", ocrTag },
- { "pid", pid },
- { "ordtype", ordType },
- { "orddd", inDd },
- { "cretno", cretNo },
- { "orddrid", mainDrId },
- { "orddeptcd", patientDeptCd },
- { "formcd", formCd },
- { "fstprntdeptcd", userDeptCd },
- { "fstprntid", userId },
- { "updtdeptcd", userDeptCd },
- { "updtuserid", userId },
- { "updtdt", DateTime.Now.ToString("yyyyMMddHHmmss")},
- { "pagecnt", formPageCnt },
- //{ "updtresncnts", reasonForUseN },
- { "actkind", actionKind },
- { "clienttype", "M" }
- };
- dac.InsertPrintData(this.IbatisMapper, ocrParam, isNewConsentMasterCase);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("formCd -- > " + formCd);
- if (formCd == "1200005463" || formCd == "1800014564") {
- SavePatientConsentInfo(formCd, pid, ocrTag, userId, dataXml);
- }
- if (this.IbatisSession != null) this.IbatisSession.CommitTransaction();
- }
- } catch (Exception ex) {
- if (this.IbatisSession != null) this.IbatisSession.RollBackTransaction();
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm SaveDataAll ERROR : [{0}]", ex.ToString()));
- result = -1;
- throw ex;
- }
- return result;
- }
- private void imageUpload(SaveConsentDac dac, Hashtable paramHashTable, string userId, string pid, string ordType, string inDd, string dSchDd, int cretNo, string ocrTag,
- int consentMstRid, string consentState, string formCd, string formId, string dataXml, string imageFileJson, string instCd, string deptCd, string fileSize) {
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("imageUpload");
- // 서명 저장일 경우 emrindxm 테이블에 저장
- if (!string.IsNullOrEmpty(consentState) && (consentState.Equals("ELECTR_CMP") || consentState.Equals("CERTIFY_CMP"))) {
- // 진료과 코드
- string clnDeptCode = paramHashTable["clnDeptCd"] == null ? string.Empty : paramHashTable["clnDeptCd"].ToString();
- Dictionary<String, String> remoteData = remoteInfo();
- string[] fileSizeAr = fileSize.Split(new char[] { ',' });
- try {
- int consentImageRid = this.GetSequence("CONSENT_IMAGE");
- int firstImageRid = consentImageRid;
- string sPath = string.Empty;
- string sFileName = string.Empty;
- //string newFileFullName = string.Empty;
- if (!string.IsNullOrEmpty(imageFileJson)) {
- Dictionary<string, object> jsonRoot = null;
- jsonRoot = fastJSON.JSON.Parse(imageFileJson) as Dictionary<string, object>;
- if (jsonRoot != null && jsonRoot.Count > 0) {
- Hashtable imageHashTable = new Hashtable();
- int nowCnt = 1;
- int pageNum = 1;
- int fileSizeCnt = 0;
- var date = DateTime.Now.ToString("yyyyMM");
- var uniqDatetime = DateTime.Now.ToString("yyyyMMddhhmmss");
- foreach (KeyValuePair<string, object> jr in jsonRoot) {
- imageHashTable = new Hashtable();
- imageHashTable.Add("consentMstRid", consentMstRid);
- if (nowCnt > 1) {
- consentImageRid = this.GetSequence("CONSENT_IMAGE");
- }
- imageHashTable.Add("consentImageRid", consentImageRid);
- imageHashTable.Add("userId", userId);
- imageHashTable.Add("formRid", formId);
- if (jr.Value != null && !string.IsNullOrEmpty(jr.Value.ToString())) {
- sPath = "";
- sFileName = "";
- string[] filePath = jr.Value.ToString().Split('/');
- for (int i = 0; i < filePath.Length; i++) {
- if (i == 0) {
- sPath = filePath[i];
- } else if ((i + 1) == filePath.Length) {
- sFileName = filePath[i];
- } else {
- sPath += "/" + filePath[i];
- }
- }
- }
- string uploadFileName = uniqDatetime + "_" + ocrTag + "_" + pageNum;
- //int idx = uploadFileName.LastIndexOf(".");
- string sUploadPath = uploadFileName.Substring(4, 4);
- string sUploadFileName = uploadFileName.Substring(uploadFileName.LastIndexOf("\\") + 1);
- authProcess(pid, cretNo, inDd, deptCd, ordType, ocrTag, consentMstRid, userId, pageNum, formCd, sUploadFileName, remoteData["IMAGE_SEQ"], fileSizeAr[fileSizeCnt].Trim());
- fileSizeCnt++;
- pageNum++;
- // 운영 배포 테스트를 위한 temp 경로 삭제
- // 실제 운영 테스트 시 100번 환자로만 진행 필요
- var remotePath = remoteData["IMAGEPATH"] + "\\" + remoteData["PATH_IMGDATA"] + "\\" + date + "\\" + pid;
- //var remotePath = remoteData["IMAGEPATH"] + "\\temp_" + remoteData["PATH_IMGDATA"] + "\\" + date + "\\" + pid;
- //var destDirectory = remotePath.Substring(2);
- ClipSoft.Utility.ImpersonationUtility util = new ClipSoft.Utility.ImpersonationUtility();
- //var imResult = util.ImpersonationStart(remotePath, remoteData["NETDRV_USERID_ADMIN"], remoteData["NETDRV_PASSWORD_ADMIN"]);
- var imResult = util.ImpersonationStart(remotePath, remoteData["NETDRV_USERID_ADMIN"], remoteData["NETDRV_PASSWORD_ADMIN"]);
-
- DirectoryInfo destDi = new DirectoryInfo(remotePath);
- string destDirStr = destDi.Name;
- var destFullname = String.Format(@"{0}\{1}", remotePath, sUploadFileName);
- var localFile = Server.MapPath(string.Format(@"./UPLOAD/{0}/{1}", sPath, sFileName));
- if (!destDi.Exists) {
- destDi.Create();
- }
- try {
- File.Copy(localFile, destFullname, true);
- } catch (Exception ex) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm imageUpload fileCopy ERROR : [{0}]", ex.ToString()));
- throw ex;
- }
- util.ImpersonationEnd();
- imageHashTable.Add("imagePath", remotePath);
- imageHashTable.Add("imageFilename", sUploadFileName);
- imageHashTable.Add("completeYn", paramHashTable["completeYn"]);
- dac.InsertConsentImage(this.IbatisMapper, imageHashTable);
- }
- nowCnt++;
- }
-
- }
- paramHashTable.Add("consentImageRid", firstImageRid);
- // TODO 원무 인증 저장 pass
- // 원무 저장시 해당 정보 저장 or skip 확인 해 볼 것
- // 사인정보 저장
- dac.InsertConsentImageSign(this.IbatisMapper, paramHashTable);
- } catch (Exception ex) {
- //using (HospitalSvc hospitalWebService = new HospitalSvc()) {
- // hospitalWebService.delEformData(patientCode, visitType,
- // clnDate.Replace("-", ""), Dschdd, string.Format("{0}", cretno),
- // formCd, ocrcode, userId, createUserName, string.Format("{0}", consentMstRid), hosType,
- // clnDeptCode, dutinstcd);
- //}
- //if (this.IbatisSession != null) this.IbatisSession.RollBackTransaction();
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm imageUpload ERROR : [{0}]", ex.ToString()));
- throw ex;
- }
- }
- }
- private void authProcess(string pid, int cretNo, string ordDd, string deptCd, string ordType, string ocrTag,
- int consentMstRid, string userId, int pageNum, string formCd, string fileName, string imageSvrSeq, string fileSize) {
- int seq = 0;
- int seqNo = 0;
- try {
- using (ConsentDac consentDac = new ConsentDac()) {
- Hashtable param = new Hashtable();
- param.Add("pid", pid);
- param.Add("cretNo", cretNo);
- param.Add("ordDd", ordDd);
- param.Add("deptCd", deptCd);
- param.Add("ordType", ordType);
- param.Add("userId", userId);
- //param.Add("pageNo", pageNum);
- param.Add("formCd", formCd);
- param.Add("imgServer", imageSvrSeq);
- param.Add("fileSize", Convert.ToInt32(fileSize));
- var date = DateTime.Now.ToString("yyyyMM");
- string mstRid = Convert.ToString(consentMstRid);
- param.Add("ocrTag", ocrTag + "^" + mstRid);
- param.Add("fileName", date + "\\" + pid + "\\" + fileName);
- // 외래면 0 아니면 1
- if (ordType.Equals("O")) {
- param.Add("inOut", 0);
- } else {
- param.Add("inOut", 1);
- }
- if (cretNo == 0 || ordDd.Equals("") || deptCd.Equals("") || ordType.Equals("")) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Warn("cretNo -- > " + cretNo);
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Warn("ordDd -- > " + ordDd);
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Warn("deptCd -- > " + deptCd);
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Warn("ordType -- > " + ordType);
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Warn("ocrTag -- > " + ocrTag);
- throw new Exception();
- }
- seq = Convert.ToInt32(consentDac.getTreatTSeq(this.IbatisMapper, param));
- param.Add("seq", seq);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Warn("seq -- > " + seq);
- if (seq == 0) {
- seq = Convert.ToInt32(consentDac.getTreatTNewSeq(this.IbatisMapper, param));
- seq = seq + 1;
- param.Remove("seq");
- param.Add("seq", seq);
- consentDac.insertScanGroup(this.IbatisMapper, param);
- }
- seqNo = consentDac.getScanFileMaxSeq(this.IbatisMapper, param);
- seqNo = seqNo + 1;
- param.Add("seqNo", seqNo);
- consentDac.insertScanFile(this.IbatisMapper, param);
- }
- } catch (Exception ex) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm authProcess ERROR : [{0}]", ex.ToString()));
- throw ex;
- }
- }
- private Dictionary<String, String> remoteInfo() {
- Dictionary<String, String> data = new Dictionary<string, string>();
- try {
- using (CommonCodeDac codeDac = new CommonCodeDac()) {
- IList<ImageServerPropsVO> imageServerProps;
- Hashtable opts = new Hashtable();
- imageServerProps = codeDac.GetImageServerProps(this.IbatisMapper, opts);
- foreach (var prop in imageServerProps) {
- if (prop.imageSeq != "") {
- data.Add("IMAGE_SEQ", prop.imageSeq);
- }
- data.Add(prop.keyName, prop.keyValue);
- }
- }
- List<string> users = new List<string>();
- var path = string.Format("WinNT://{0},computer", Environment.MachineName);
- using (var computerEntry = new DirectoryEntry(path)) {
- foreach(DirectoryEntry childEntry in computerEntry.Children) {
- if (childEntry.SchemaClassName == "User") {
- users.Add(childEntry.Name);
- }
- }
- }
- //if (users.Contains("imr") == true) {
- // CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("&&&&&&");
- // var entry = new DirectoryEntry(path);
- // DirectoryEntries childEntry2 = entry.Children;
- // DirectoryEntry user = childEntry2.Find("imr");
- // CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("user.Name -- > " + user.Name);
- // childEntry2.Remove(user);
- // user.CommitChanges();
- //}
- if (users.Contains("imr") == false) {
- DirectoryEntry localMachine = new DirectoryEntry("WinNT://" + Environment.MachineName);
- DirectoryEntry newUser = localMachine.Children.Add(data["NETDRV_USERID_ADMIN"], "user");
- newUser.Invoke("SetPassword", new object[] { data["NETDRV_PASSWORD_ADMIN"] });
- newUser.Invoke("Put", new object[] { "Description", "Test user" });
- newUser.CommitChanges();
- newUser.Close();
- }
- } catch (Exception ex) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm remoteInfo ERROR : [{0}]", ex.ToString()));
- throw ex;
- }
- return data;
- }
- [WebMethod(Description = "신규서식이 아닌 서식을 불러온다")]
- public string GetConsentFormXml(int consentMstRid) {
- byte[] result = { 0 };
- String formXml = "";
- //SingleReturnData result = new SingleReturnData();
- try {
- using (ConsentDac consentDac = new ConsentDac()) {
- Hashtable param = new Hashtable();
- param.Add("consentMstRid", consentMstRid);
- formXml = consentDac.getConsentFormXml(this.IbatisMapper, param);
- UTF8Encoding encoder = new UTF8Encoding();
- Decoder utf8Decode = encoder.GetDecoder();
- byte[] toEcodeByte = Convert.FromBase64String(formXml);
- int charCount = utf8Decode.GetCharCount(toEcodeByte, 0, toEcodeByte.Length);
- char[] decodedChar = new char[charCount];
- utf8Decode.GetChars(toEcodeByte, 0, toEcodeByte.Length, decodedChar, 0);
- formXml = Unzip(toEcodeByte);
- }
- } catch (Exception ex) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm GetConsentFormXml ERROR : [{0}]", ex.ToString()));
- }
- return formXml;
- }
- public byte[] Zip(string str) {
- var bytes = Encoding.UTF8.GetBytes(str);
- using (var msi = new MemoryStream(bytes))
- using (var mso = new MemoryStream()) {
- using (var gs = new GZipStream(mso, CompressionMode.Compress)) {
- CopyTo(msi, gs);
- }
- return mso.ToArray();
- }
- }
- public string Unzip(byte[] bytes) {
- using (var msi = new MemoryStream(bytes))
- using (var mso = new MemoryStream()) {
- using (var gs = new GZipStream(msi, CompressionMode.Decompress)) {
- CopyTo(gs, mso);
- }
- return Encoding.UTF8.GetString(mso.ToArray());
- }
- }
- public void CopyTo(Stream src, Stream dest) {
- byte[] bytes = new byte[4096];
- int cnt;
-
- while ((cnt = src.Read(bytes, 0, bytes.Length)) != 0) {
- dest.Write(bytes, 0, cnt);
- }
- }
- /// <summary>
- /// 전자 동의서를 완료저장 한다.
- /// </summary>
- /// <param name="userId">로그인 사용자ID</param>
- /// <param name="patientCode">환자 등록번호</param>
- /// <param name="clnDeptCode">진료과 코드</param>
- /// <param name="formRid">(작성대상)서식 Rid</param>
- /// <param name="formCd">서식코드</param>
- /// <param name="consentMstRid">동의서 마스터 데이터 Rid</param>
- /// <param name="rewriteConsentMstRid">재 작성 대상 동의서 마스터 데이터 Rid</param>
- /// <param name="formXml">동의서 EPT Xml</param>
- /// <param name="dataXml">동의서 Data(필드들) Xml</param>
- /// <param name="deviceType">장비 유형 (WIN, AND, IOS, PRT 중1)</param>
- /// <param name="deviceIdentNo">장비 고유 식별자</param>
- /// <param name="vistType">내원구분</param>
- /// <param name="hosType">병원 구분</param>
- /// <param name="clnDate">병원 구분이 "I" 일 경우 입원일자/병원 구분이 "O"일 경우 진료일자</param>
- /// <param name="ward">병동 코드</param>
- /// <param name="roomcd">병실 코드</param>
- /// <param name="orderNo">처방번호</param>
- /// <param name="orderCd">처방코드</param>
- /// <param name="orderName">처방명</param>
- /// <param name="createUserName">작성자명</param>
- /// <param name="modifyUserName">수정자명</param>
- /// <param name="imageFileJson">이미지 파일 정보(전자동의서 서버)</param>
- /// <param name="certTarget">이미지 파일 공인인증 대상정보</param>
- /// <param name="certResult">이미지 파일 공인인증 처리정보</param>
- /// <param name="dschdd">퇴원일자</param>
- /// <param name="consentState">상태</param>
- /// <param name="mainDrId">주치의 아이디</param>
- /// <param name="userDeptCd">사용자 부서 코드</param>
- /// <param name="pageCnt">동의서 매수</param>
- /// <param name="actKind">동작코드(T: 임시 저장, C: 인증 저장, P: 출력, CP: 삭제)</param>
- /// <param name="clientType">Client구분 (P: PC, M: 모바일)</param>
- //[WebMethod(Description = "동의서 서명 완료")]
- //public int SaveCompleteAll(string userId, string patientCode, string clnDeptCode, int formRid, string formCd,
- // int consentMstRid, int rewriteConsentMstRid, string formXml, string dataXml,
- // string deviceType, string deviceIdentNo, string vistType, string hosType, string clnDate,
- // string ward, string roomcd, int orderNo, string orderName, string orderCd, string ocrCode, int cretno,
- // string createUserName, string modifyUserName, string imageFileJson, string certTarget, string certResult,
- // string dschdd, string consentState, string mainDrId,
- // string userDeptCd, string pageCnt, string actKind, string clientType, string opRsrvNo) {
- // string paramLog = "";
- // paramLog += "clnDept[" + userId + "]patientCode[" + patientCode + "]clnDeptCode[" + clnDeptCode + "]formRid[" + formRid + "]";
- // paramLog += "formCd[" + formCd + "]consentMstRid[" + consentMstRid + "]rewriteConsentMstRid[" + rewriteConsentMstRid + "]";
- // paramLog += "deviceType[" + deviceType + "]vistType[" + vistType + "]hosType[" + hosType + "]";
- // paramLog += "clnDate[" + clnDate + "]ward[" + ward + "]roomcd[" + roomcd + "]orderNo[" + orderNo + "]";
- // paramLog += "orderName[" + orderName + "]orderCd[" + orderCd + "]ocrCode[" + ocrCode + "]cretno[" + cretno + "]";
- // paramLog += "createUserName[" + createUserName + "]modifyUserName[" + modifyUserName + "]imageFileJson[" + imageFileJson + "]certTarget[" + certTarget + "]";
- // paramLog += "dschdd[" + dschdd + "]consentState[" + consentState + "]mainDrId[" + mainDrId + "]";
- // paramLog += "dataXml[" + dataXml + "]formXml[" + formXml + "]certResult[" + certResult + "]";
- // //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("CLIP.eForm SaveCompleteAll param : " + paramLog);
- // //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("json : " + imageFileJson);
- // int reissueConsentMstRid = 0;
- // string paperYn = "N";
- // string reasonForUseN = string.Empty;
- // rewriteConsentMstRid = 0;
- // consentMstRid = SaveDataAll(userId, patientCode, clnDeptCode, formRid, formCd,
- // consentMstRid, rewriteConsentMstRid, reissueConsentMstRid, consentState, paperYn, formXml, dataXml,
- // deviceType, deviceIdentNo, vistType, hosType, clnDate,
- // ward, roomcd, reasonForUseN, orderNo, orderName, orderCd, ocrCode, cretno,
- // createUserName, modifyUserName, imageFileJson, certTarget, certResult, dschdd, mainDrId,
- // userDeptCd, pageCnt, actKind, clientType, opRsrvNo);
- // return consentMstRid;
- //}
- /// <summary>
- /// 동의서 삭제/폐기 데이터를 저장 한다.
- /// </summary>
- /// <param name="userId">로그인 사용자ID</param>
- /// <param name="consentMstRidInt">The consent MST rid int.</param>
- /// <param name="patientCode">환자 등록번호</param>
- /// <param name="clnDeptCode">진료과 코드</param>
- /// <param name="ward">병동 코드</param>
- /// <param name="roomcd">The roomcd.</param>
- /// <param name="formRid">(작성대상)서식 Rid</param>
- /// <param name="formCd">서식 코드</param>
- /// <param name="rewriteConsentMstRid">재 작성 대상 동의서 마스터 데이터 Rid</param>
- /// <param name="reissueConsentMstRid">삭제/폐기 대상 동의서 마스터 데이터 Rid</param>
- /// <param name="consentState">동의서 상태</param>
- /// <param name="deviceIdentNo">장비 고유 식별자</param>
- /// <param name="vistType">진료 형태</param>
- /// <param name="hosType">기관 코드</param>
- /// <param name="clnDate">진료일</param>
- /// <param name="reasonForUseN">삭제/폐기 사유</param>
- /// <param name="ocrCode">OCR Tag</param>
- /// <param name="cretno">생성번호</param>
- /// <param name="userDeptCd">사용자 부서 코드</param>
- /// <param name="pageCnt">동의서 매수</param>
- /// <param name="actKind">동작코드(T: 임시 저장, C: 인증 저장, P: 출력, CP: 삭제)</param>
- /// <param name="clientType">Client구분 (P: PC, M: 모바일)</param>
- /// <returns></returns>
- //[WebMethod(Description = "동의서 삭제/폐기 데이터를 저장")]
- //public int SaveDelete(string userId, int consentMstRidInt, string patientCode, string clnDeptCode,
- // string ward, string roomcd, int formRid, string formCd, int rewriteConsentMstRid, int reissueConsentMstRid,
- // string consentState, string deviceIdentNo, string vistType, string hosType, string clnDate, string reasonForUseN,
- // string ocrCode, int cretno,
- // string userDeptCd, string pageCnt, string actKind, string clientType) {
- // string paperYn = "N";
- // consentMstRidInt = SaveData(userId, patientCode, clnDeptCode, formRid, formCd,
- // consentMstRidInt, rewriteConsentMstRid, reissueConsentMstRid, consentState, paperYn, null, null,
- // null, deviceIdentNo, vistType, hosType, clnDate,
- // ward, roomcd, reasonForUseN, 0, null, null, ocrCode, cretno,
- // null, null, null, null, null, null,
- // userDeptCd, pageCnt, actKind, clientType, "");
- // return consentMstRidInt;
- //}
- /// <summary>
- /// 프린트 출력 후 데이터를 저장 한다.
- /// </summary>
- /// <param name="userId">로그인 사용자ID</param>
- /// <param name="patientCode">환자 등록번호</param>
- /// <param name="clnDeptCode">진료과 코드</param>
- /// <param name="formRid">(작성대상)서식 Rid</param>
- /// <param name="formCd">서식코드</param>
- /// <param name="consentMstRid">동의서 마스터 데이터 Rid</param>
- /// <param name="reissueConsentMstRid">The reissue consent MST rid.</param>
- /// <param name="formXml">동의서 EPT Xml</param>
- /// <param name="dataXml">동의서 Data(필드들) Xml</param>
- /// <param name="deviceType">장비 유형 (WIN, AND, IOS, PRT 중1)</param>
- /// <param name="deviceIdentNo">장비 고유 식별자</param>
- /// <param name="vistType">내원구분</param>
- /// <param name="hosType">병원 구분</param>
- /// <param name="clnDate">병원 구분이 "I" 일 경우 입원일자/병원 구분이 "O"일 경우 진료일자</param>
- /// <param name="ward">병동 코드</param>
- /// <param name="roomcd">병실 코드</param>
- /// <param name="orderNo">처방번호</param>
- /// <param name="orderName">처방명</param>
- /// <param name="orderCd">처방코드</param>
- /// <param name="ocrCode">OCR코드</param>
- /// <param name="cretno">생성번호</param>
- /// <param name="createUserName">작성자명</param>
- /// <param name="modifyUserName">수정자명</param>
- /// <param name="mainDrId">주치의 아이디</param>
- /// <param name="userDeptCd">사용자 부서 코드</param>
- /// <param name="pageCnt">출력 매수</param>
- /// <param name="actKind">동작 방법</param>
- /// <param name="clientType">Client 타입</param>
- /// <param name="opRsrvNo">수술예약번호</param>
- /// <returns></returns>
- [WebMethod(Description = "동의서 프린트 출력 후 데이터를 저장")]
- public int SavePrintOut(string userId, string patientCode, string clnDeptCode, int formRid, string formCd,
- int consentMstRid, int reissueConsentMstRid, string formXml, string dataXml,
- string deviceType, string deviceIdentNo, string vistType, string hosType, string clnDate,
- string ward, string roomcd, int orderNo, string orderName, string orderCd, string ocrCode, int cretno,
- string createUserName, string modifyUserName, string mainDrId,
- string userDeptCd, string pageCnt, string actKind, string clientType, string opRsrvNo) {
- string consentState = "PAPER_OUT";
- string paperYn = "Y";
- consentMstRid = SavePrintData(userId, patientCode, clnDeptCode, formRid, formCd,
- consentMstRid, 0, reissueConsentMstRid, consentState, paperYn, formXml, dataXml,
- deviceType, deviceIdentNo, vistType, hosType, clnDate,
- ward, roomcd, null, orderNo, orderName, orderCd, ocrCode, cretno,
- createUserName, modifyUserName, null, null, null, mainDrId,
- userDeptCd, pageCnt, actKind, clientType, opRsrvNo);
- return consentMstRid;
- }
- /// <summary>
- /// 동의서의 기왕력 데이터 저장
- /// </summary>
- /// <param name="patientCode">환자 등록번호</param>
- /// <param name="clnDate">진료일</param>
- /// <param name="bp">고/저혈압</param>
- /// <param name="dm">당뇨병</param>
- /// <param name="heart">심장질환</param>
- /// <param name="kidney">신장질환</param>
- /// <param name="respiration">호흡기질환</param>
- /// <param name="hx">과거병력</param>
- /// <param name="allergy">알레르기</param>
- /// <param name="drug">복용약물</param>
- /// <param name="smoking">흡연상태</param>
- /// <param name="idio">특이체질</param>
- /// <param name="nacrotics">마약사고</param>
- /// <param name="airway">기도이상 유무</param>
- /// <param name="hemorrhage">출혈소인</param>
- /// <param name="status_etc">기타</param>
- /// <param name="userId">로그인 사용자ID</param>
- /// <returns></returns>
- [WebMethod(Description = "동의서의 기왕력 데이터 저장")]
- public string SaveMedicalHistory(string patientCode, string clnDate,
- string bp, string dm, string heart, string kidney, string respiration,
- string hx, string allergy, string drug, string smoking,
- string idio, string nacrotics, string airway, string hemorrhage, string status_etc,
- string userId) {
- try {
- using (SaveConsentDac dac = new SaveConsentDac()) {
- Hashtable paramHashTable = new Hashtable();
- paramHashTable.Add("patientCode", patientCode);
- paramHashTable.Add("clnDate", clnDate);
- paramHashTable.Add("bp", bp);
- paramHashTable.Add("dm", dm);
- paramHashTable.Add("heart", heart);
- paramHashTable.Add("kidney", kidney);
- paramHashTable.Add("respiration", respiration);
- paramHashTable.Add("hx", hx);
- paramHashTable.Add("allergy", allergy);
- paramHashTable.Add("drug", drug);
- paramHashTable.Add("smoking", smoking);
- paramHashTable.Add("idio", idio);
- paramHashTable.Add("nacrotics", nacrotics);
- paramHashTable.Add("airway", airway);
- paramHashTable.Add("hemorrhage", hemorrhage);
- paramHashTable.Add("status_etc", status_etc);
- paramHashTable.Add("userId", userId);
- dac.SetMediHistory(this.IbatisMapper, paramHashTable);
- }
- } catch (Exception ex) {
- if (this.IbatisSession != null) this.IbatisSession.RollBackTransaction();
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm SaveMedicalHistory ERROR : [{0}]", ex.ToString()));
- throw ex;
- } finally {
- }
- return patientCode;
- }
- /// <summary>
- /// 동의서 서명 완료일 경우 이미지 데이터 저장
- /// </summary>
- /// <param name="consentState">동의서 상태</param>
- /// <param name="imageFileName">이미지파일명(경로포함)</param>
- /// <param name="consentMstRid">동의서 마스터 데이터 Rid</param>
- /// <param name="userId">등록자ID</param>
- /// <param name="formRid">동의서 FORM ID</param>
- /// <returns>저장된 consent image rid</returns>
- [WebMethod(Description = "동의서 서명 완료일 경우 이미지 데이터 저장")]
- public int SaveImageUploadInfo(string consentState, string imageFileName, int consentMstRid, string userId, int formRid) {
- int consentImageRid = 0;
- if (!string.IsNullOrEmpty(consentState) && consentState == "ELECTR_CMP") {
- using (SaveConsentDac dac = new SaveConsentDac()) {
- Hashtable imageHashTable = new Hashtable();
- imageHashTable.Add("consentMstRid", consentMstRid);
- consentImageRid = this.GetSequence("CONSENT_IMAGE");
- imageHashTable.Add("consentImageRid", consentImageRid);
- imageHashTable.Add("userId", userId);
- imageHashTable.Add("formRid", formRid);
- imageHashTable.Add("imagePath", imageFileName.Substring(0, imageFileName.LastIndexOf("\\")));
- imageHashTable.Add("imageFilename", imageFileName.Substring(imageFileName.LastIndexOf("\\") + 1));
- imageHashTable.Add("completeYn", "Y"); //paramHashTable["completeYn"]
- dac.InsertConsentImage(this.IbatisMapper, imageHashTable);
- }
- }
- return consentImageRid;
- }
- /// <summary>
- /// 서명완료된 이미지의 hash 정보 저장
- /// </summary>
- /// <param name="consentState">동의서 상태</param>
- /// <param name="consentMstRid">동의서 마스터 데이터 Rid</param>
- /// <param name="consentImageRid">이미지 데이터 Rid</param>
- /// <param name="userId">등록자ID</param>
- /// <param name="certTarget">hash 정보</param>
- /// <param name="sCertResult">공인인증서명 결과</param>
- [WebMethod(Description = "서명완료된 이미지의 hash 정보 저장")]
- public void SaveImageSignInfo(string consentState, int consentMstRid, int consentImageRid, string userId, string certTarget, string sCertResult) {
- string paramLog = "";
- paramLog += "consentState[" + consentState + "]consentMstRid[" + consentMstRid + "]consentImageRid[" + consentImageRid + "]userId[" + userId + "]";
- paramLog += "certTarget[" + certTarget + "]sCertResult[" + sCertResult + "]";
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("CLIP.eForm SaveTempData param : " + paramLog);
- if (!string.IsNullOrEmpty(consentState) && consentState == "ELECTR_CMP") {
- using (SaveConsentDac dac = new SaveConsentDac()) {
- Hashtable imageHashTable = new Hashtable();
- imageHashTable.Add("consentMstRid", consentMstRid);
- imageHashTable.Add("consentImageRid", consentImageRid);
- imageHashTable.Add("certTarget", certTarget);
- imageHashTable.Add("certResult", sCertResult);
- imageHashTable.Add("userId", userId);
- dac.InsertConsentImageSign(this.IbatisMapper, imageHashTable);
- imageHashTable.Add("consentState", "CERTIFY_CMP");
- dac.UpdateConsentMstStatus(this.IbatisMapper, imageHashTable);
- }
- }
- }
- /// <summary>
- /// Saves the data.
- /// </summary>
- /// <param name="userId">The user identifier.</param>
- /// <param name="patientCode">The patient code.</param>
- /// <param name="clnDeptCode">The CLN dept code.</param>
- /// <param name="formRid">The form rid.</param>
- /// <param name="formCd">The form cd.</param>
- /// <param name="consentMstRid">The consent MST rid.</param>
- /// <param name="rewriteConsentMstRid">The rewrite consent MST rid.</param>
- /// <param name="reissueConsentMstRid">The reissue consent MST rid.</param>
- /// <param name="consentState">State of the consent.</param>
- /// <param name="paperYn">The paper yn.</param>
- /// <param name="formXml">The form XML.</param>
- /// <param name="dataXml">The data XML.</param>
- /// <param name="deviceType">Type of the device.</param>
- /// <param name="deviceIdentNo">The device ident no.</param>
- /// <param name="vistType">Type of the vist.</param>
- /// <param name="hosType">Type of the hos.</param>
- /// <param name="clnDate">The CLN date.</param>
- /// <param name="ward">The ward.</param>
- /// <param name="roomcd">The roomcd.</param>
- /// <param name="reasonForUseN">The reason for use n.</param>
- /// <param name="orderNo">The order no.</param>
- /// <param name="orderName">Name of the order.</param>
- /// <param name="orderCd">The order cd.</param>
- /// <param name="ocrCode">The ocr code.</param>
- /// <param name="cretno">The cretno.</param>
- /// <param name="createUserName">Name of the create user.</param>
- /// <param name="modifyUserName">Name of the modify user.</param>
- /// <param name="imageFileName">Name of the image file.</param>
- /// <param name="certTarget">The cert target.</param>
- /// <param name="certResult">The cert result.</param>
- /// <param name="mainDrId">The main dr identifier.</param>
- /// <param name="userDeptCd">The user dept cd.</param>
- /// <param name="pageCnt">The page count.</param>
- /// <param name="actKind">Kind of the act.</param>
- /// <param name="clientType">Type of the client.</param>
- /// <param name="opRsrvNo">The op RSRV no.</param>
- /// <returns></returns>
- //private int SaveData(string userId, string patientCode, string clnDeptCode, int formRid, string formCd,
- // int consentMstRid, int rewriteConsentMstRid, int reissueConsentMstRid, string consentState, string paperYn, string formXml, string dataXml,
- // string deviceType, string deviceIdentNo, string vistType, string hosType, string clnDate,
- // string ward, string roomcd, string reasonForUseN, int orderNo, string orderName, string orderCd, string ocrCode, int cretno,
- // string createUserName, string modifyUserName, string imageFileName, string certTarget, string certResult,
- // string mainDrId, string userDeptCd, string pageCnt, string actKind, string clientType, string opRsrvNo) {
- // bool isNewConsentMasterCase = false;
- // if (consentMstRid < 1) {
- // isNewConsentMasterCase = true;
- // }
- // if (this.IbatisSession.IsTransactionStart == false) {
- // this.IbatisSession.BeginTransaction();
- // }
- // try {
- // using (SaveConsentDac dac = new SaveConsentDac()) {
- // Hashtable paramHashTable = GetParamHashTable(userId, patientCode, clnDeptCode, formRid, formCd, consentMstRid, rewriteConsentMstRid,
- // reissueConsentMstRid, consentState, paperYn, formXml, dataXml, deviceType, deviceIdentNo,
- // vistType, hosType, clnDate, ward, roomcd, reasonForUseN,
- // orderNo, orderName, orderCd, ocrCode, cretno, createUserName, modifyUserName,
- // certTarget, certResult, mainDrId, opRsrvNo);
- // consentMstRid = (int) paramHashTable["consentMstRid"];
- // //새로 작성하는 경우
- // if (isNewConsentMasterCase) {
- // dac.InsertConsentMst(this.IbatisMapper, paramHashTable);
- // dac.InsertConsentData(this.IbatisMapper, paramHashTable);
- // } else { //새로 작성 아닌 경우
- // if (reissueConsentMstRid > 0) {
- // if (string.IsNullOrEmpty(reasonForUseN)) {
- // //종이->종이 재발행
- // int newConsentMstRid = this.GetSequence("CONSENT_MST");
- // paramHashTable["consentMstRid"] = newConsentMstRid;
- // consentMstRid = newConsentMstRid;
- // dac.InsertConsentMst(this.IbatisMapper, paramHashTable);
- // dac.InsertConsentData(this.IbatisMapper, paramHashTable);
- // } else { // 삭제
- // dac.UpdateConsentMstForDelete(this.IbatisMapper, paramHashTable);
- // }
- // } else { //임시저장 또는 저장인 경우
- // dac.UpdateConsentMst(this.IbatisMapper, paramHashTable);
- // dac.InsertConsentData(this.IbatisMapper, paramHashTable);
- // }
- // }
- // // OCR 테이블 연계
- // Hashtable ocrParam = new Hashtable {
- // { "instcd", hosType },
- // { "ocrtag", ocrCode },
- // { "pid", patientCode },
- // { "ordtype", vistType },
- // { "orddd", clnDate },
- // { "cretno", cretno },
- // { "orddrid", mainDrId },
- // { "orddeptcd", clnDeptCode },
- // { "formcd", formCd },
- // { "fstprntdeptcd", userDeptCd },
- // { "fstprntid", userId },
- // { "updtdeptcd", userDeptCd },
- // { "updtuserid", userId },
- // { "updtdt", DateTime.Now.ToString("yyyyMMddHHmmss")},
- // { "pagecnt", pageCnt },
- // { "updtresncnts", reasonForUseN },
- // { "actkind", actKind },
- // { "clienttype", clientType }
- // };
- // dac.InsertPrintData(this.IbatisMapper, ocrParam);
- // if (this.IbatisSession != null) this.IbatisSession.CommitTransaction();
- // }
- // } catch (Exception ex) {
- // if (this.IbatisSession != null) this.IbatisSession.RollBackTransaction();
- // CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm SaveData ERROR : [{0}]", ex.ToString()));
- // throw ex;
- // } finally {
- // }
- // return consentMstRid;
- //}
- //private int SaveDataAll(string userId, string patientCode, string clnDeptCode, int formRid, string formCd,
- // int consentMstRid, int rewriteConsentMstRid, int reissueConsentMstRid, string consentState, string paperYn, string formXml, string dataXml,
- // string deviceType, string deviceIdentNo, string vistType, string hosType, string clnDate,
- // string ward, string roomcd, string reasonForUseN, int orderNo, string orderName, string orderCd, string ocrCode, int cretno,
- // string createUserName, string modifyUserName, string imageFileJson, string certTarget,
- // string certResult, string dschdd, string mainDrId,
- // string userDeptCd, string pageCnt, string actKind, string clientType, string opRsrvNo) {
- // bool isNewConsentMasterCase = false;
- // if (consentMstRid < 1) {
- // isNewConsentMasterCase = true;
- // }
- // try {
- // using (SaveConsentDac dac = new SaveConsentDac()) {
- // Hashtable paramHashTable = GetParamHashTable(userId, patientCode, clnDeptCode, formRid, formCd, consentMstRid, rewriteConsentMstRid,
- // reissueConsentMstRid, consentState, paperYn, formXml, dataXml, deviceType, deviceIdentNo,
- // vistType, hosType, clnDate, ward, roomcd, reasonForUseN,
- // orderNo, orderName, orderCd, ocrCode, cretno, createUserName, modifyUserName,
- // certTarget, certResult, mainDrId, opRsrvNo);
- // consentMstRid = (int) paramHashTable["consentMstRid"];
- // //새로 작성하는 경우
- // if (isNewConsentMasterCase) {
- // dac.InsertConsentMst(this.IbatisMapper, paramHashTable);
- // dac.InsertConsentData(this.IbatisMapper, paramHashTable);
- // imageUpload(dac, paramHashTable, userId
- // , patientCode, vistType, clnDate, dschdd, cretno, ocrCode
- // , consentMstRid, consentState, formCd, formRid, dataXml, imageFileJson, certTarget, certResult, hosType, createUserName, hosType);
- // }
- // //새로 작성 아닌 경우
- // else {
- // if (reissueConsentMstRid > 0) {
- // if (string.IsNullOrEmpty(reasonForUseN)) {
- // //종이->종이 재발행
- // int newConsentMstRid = this.GetSequence("CONSENT_MST");
- // paramHashTable["consentMstRid"] = newConsentMstRid;
- // consentMstRid = newConsentMstRid;
- // dac.InsertConsentMst(this.IbatisMapper, paramHashTable);
- // dac.InsertConsentData(this.IbatisMapper, paramHashTable);
- // imageUpload(dac, paramHashTable, userId
- // , patientCode, vistType, clnDate, dschdd, cretno, ocrCode
- // , consentMstRid, consentState, formCd, formRid, dataXml, imageFileJson, certTarget, certResult, hosType, createUserName, hosType);
- // } else {
- // dac.UpdateConsentMstForDelete(this.IbatisMapper, paramHashTable);
- // }
- // }
- // //임시저장 또는 저장인 경우
- // else {
- // dac.UpdateConsentMst(this.IbatisMapper, paramHashTable);
- // dac.InsertConsentData(this.IbatisMapper, paramHashTable);
- // imageUpload(dac, paramHashTable, userId
- // , patientCode, vistType, clnDate, dschdd, cretno, ocrCode
- // , consentMstRid, consentState, formCd, formRid, dataXml, imageFileJson, certTarget, certResult, hosType, createUserName, hosType);
- // }
- // }
- // // OCR 테이블 연계
- // Hashtable ocrParam = new Hashtable {
- // { "instcd", hosType },
- // { "ocrtag", ocrCode },
- // { "pid", patientCode },
- // { "ordtype", vistType },
- // { "orddd", clnDate },
- // { "cretno", cretno },
- // { "orddrid", mainDrId },
- // { "orddeptcd", clnDeptCode },
- // { "formcd", formCd },
- // { "fstprntdeptcd", userDeptCd },
- // { "fstprntid", userId },
- // { "updtdeptcd", userDeptCd },
- // { "updtuserid", userId },
- // { "updtdt", DateTime.Now.ToString("yyyyMMddHHmmss")},
- // { "pagecnt", pageCnt },
- // { "updtresncnts", reasonForUseN },
- // { "actkind", actKind },
- // { "clienttype", clientType }
- // };
- // dac.InsertPrintData(this.IbatisMapper, ocrParam);
- // // 원무 동의서 연동
- // SavePatientConsentInfo(formCd
- // , patientCode
- // , ocrCode
- // , hosType
- // , clnDate
- // , cretno.ToString()
- // , vistType
- // , clnDeptCode
- // , mainDrId
- // , userId
- // , dataXml);
- // }
- // } catch (Exception ex) {
- // if (this.IbatisSession != null) this.IbatisSession.RollBackTransaction();
- // CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm SaveDataAll ERROR : [{0}]", ex.ToString()));
- // throw ex;
- // } finally {
- // }
- // return consentMstRid;
- //}
- //private void imageUpload(SaveConsentDac dac
- // , Hashtable paramHashTable
- // , string userId
- // , string patientCode
- // , string visitType
- // , string clnDate
- // , string Dschdd
- // , int cretno
- // , string ocrcode
- // , int consentMstRid
- // , string consentState
- // , string formCd
- // , int formRid
- // , string dataXml
- // , string imageFileJson
- // , string certTarget
- // , string certResult
- // , string hosType
- // , string createUserName
- // , string dutinstcd
- // ) {
- // // 서명 저장일 경우 emrindxm 테이블에 저장
- // if (!string.IsNullOrEmpty(consentState) && (consentState.Equals("ELECTR_CMP") || consentState.Equals("CERTIFY_CMP"))) {
- // string clnDeptCode = paramHashTable["clnDeptCd"] == null ? string.Empty : paramHashTable["clnDeptCd"].ToString();
- // try {
- // int consentImageRid = this.GetSequence("CONSENT_IMAGE");
- // int firstImageRid = consentImageRid;
- // string sPath = string.Empty;
- // string sFileName = string.Empty;
- // string newFileFullName = string.Empty;
- // if (!string.IsNullOrEmpty(imageFileJson)) {
- // Dictionary<string, object> jsonRoot = null;
- // jsonRoot = fastJSON.JSON.Parse(imageFileJson) as Dictionary<string, object>;
- // if (jsonRoot != null && jsonRoot.Count > 0) {
- // Hashtable imageHashTable = new Hashtable();
- // int nowCnt = 1;
- // foreach (KeyValuePair<string, object> jr in jsonRoot) {
- // imageHashTable = new Hashtable();
- // imageHashTable.Add("consentMstRid", consentMstRid);
- // if (nowCnt > 1) consentImageRid = this.GetSequence("CONSENT_IMAGE");
- // imageHashTable.Add("consentImageRid", consentImageRid);
- // imageHashTable.Add("userId", userId);
- // imageHashTable.Add("formRid", formRid);
- // if (jr.Value != null && !string.IsNullOrEmpty(jr.Value.ToString())) {
- // sPath = "";
- // sFileName = "";
- // string[] filepath = jr.Value.ToString().Split('/');
- // for (int i = 0; i < filepath.Length; i++) {
- // if (i == 0) {
- // sPath = filepath[i];
- // } else if ((i + 1) == filepath.Length) {
- // sFileName = filepath[i];
- // } else {
- // sPath += "/" + filepath[i];
- // }
- // }
- // newFileFullName = string.Empty;
- // using (HospitalSvc hospitalWebService = new HospitalSvc()) {
- // newFileFullName = hospitalWebService.GetFileName(patientCode, visitType,
- // clnDate.Replace("-", ""), Dschdd, string.Format("{0}", cretno),
- // "500", formCd, nowCnt.ToString(),
- // ocrcode, userId, clnDeptCode, dutinstcd);
- // }
- // string uploadFileName = newFileFullName + ".jpg";
- // int idx = uploadFileName.LastIndexOf(".");
- // string sUploadPath = uploadFileName.Substring(idx - 4, 4);
- // string sUploadFileName = uploadFileName.Substring(uploadFileName.LastIndexOf("\\") + 1);
- // var remotePath = imageServerProps.remotePath;
- // //var destDrive = remotePath.Substring(0, 2);
- // var destDirectory = remotePath.Substring(2);
- // var targetDrive = "";
- // var virtualDir = "";
- // // 경로를 확인하여 가상 디렉토리 경로를 설정한다
- // if (imageServerProps != null) {
- // targetDrive = imageServerProps.remotePath.Substring(0, 1);
- // switch (targetDrive) {
- // case "W":
- // virtualDir = "his032";
- // break;
- // case "Z":
- // virtualDir = "his031";
- // break;
- // }
- // }
- // // 계정을 choiadmin 으로 가장한다
- // ClipSoft.Utility.ImpersonationUtility util = new ClipSoft.Utility.ImpersonationUtility();
- // var imResult = util.ImpersonationStart(string.Empty, "choiadmin", "choiadmin");
- // CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("Impersonation Start, " + imResult);
- // // IIS 가상 디렉토리 경로를 가져온다
- // DirectoryInfo di = new DirectoryInfo(Server.MapPath(virtualDir));
- // var destDirStr = String.Format(@"{0}\{1}\{2}",
- // di.ToString(),
- // remotePath.Substring(remotePath.IndexOf("ACTIVE_ENC") + @"ACTIVE_ENC\".Length),
- // sUploadPath);
- // // for debug
- // //var destDirStr = String.Format(@"{0}\{1}\{2}\{3}\",
- // // di.ToString(),
- // // remotePath.Substring(remotePath.IndexOf("ACTIVE_ENC") + @"ACTIVE_ENC\".Length),
- // // "consentTest",
- // // sUploadPath);
- // DirectoryInfo destDi = new DirectoryInfo(destDirStr);
- // //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("destDirStr: " + destDirStr + ", exists: " + destDi.Exists);
- // var destFullname = String.Format(@"{0}\{1}", destDirStr, sUploadFileName);
- // var localFile = Server.MapPath(string.Format(@"./UPLOAD/{0}/{1}", sPath, sFileName));
- // //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("local: " + localFile + ", remote: " + destFullname);
- // if (!destDi.Exists) {
- // destDi.Create();
- // }
- // try {
- // File.Copy(localFile, destFullname);
- // } catch (Exception e) {
- // CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(e);
- // }
- // util.ImpersonationEnd();
- // CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("Impersonation end");
- // imageHashTable.Add("imagePath", sUploadPath);
- // imageHashTable.Add("imageFilename", sUploadFileName);
- // imageHashTable.Add("completeYn", paramHashTable["completeYn"]);
- // dac.InsertConsentImage(this.IbatisMapper, imageHashTable);
- // }
- // nowCnt++;
- // } // end of foreach
- // }
- // }
- // paramHashTable.Add("consentImageRid", firstImageRid);
- // // TODO 원무 인증 저장 pass
- // // 원무 저장시 해당 정보 저장 or skip 확인 해 볼 것
- // // 사인정보 저장
- // dac.InsertConsentImageSign(this.IbatisMapper, paramHashTable);
- // } catch (Exception ex) {
- // using (HospitalSvc hospitalWebService = new HospitalSvc()) {
- // hospitalWebService.delEformData(patientCode, visitType,
- // clnDate.Replace("-", ""), Dschdd, string.Format("{0}", cretno),
- // formCd, ocrcode, userId, createUserName, string.Format("{0}", consentMstRid), hosType,
- // clnDeptCode, dutinstcd);
- // }
- // if (this.IbatisSession != null) this.IbatisSession.RollBackTransaction();
- // CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm imageUpload ERROR : [{0}]", ex.ToString()));
- // throw ex;
- // }
- // }
- //}
- private bool checkOcrType6Form(string dutinstcd, string formCd) {
- List<String> forms = getOcrType6Forms(dutinstcd);
- int pos = forms.FindIndex(x => x.StartsWith(formCd));
- return (pos > 0) ? true : false;
- }
- private int SavePrintData(string userId, string patientCode, string clnDeptCode, int formRid, string formCd,
- int consentMstRid, int rewriteConsentMstRid, int reissueConsentMstRid, string consentState, string paperYn, string formXml, string dataXml,
- string deviceType, string deviceIdentNo, string vistType, string hosType, string clnDate,
- string ward, string roomcd, string reasonForUseN, int orderNo, string orderName, string orderCd, string ocrCode, int cretno,
- string createUserName, string modifyUserName, string imageFileName, string certTarget,
- string certResult, string mainDrId,
- string userDeptCd, string pageCnt, string actKind, string clientType, string opRsrvNo) {
- bool isNewConsentMasterCase = false;
- if (consentMstRid < 1) {
- isNewConsentMasterCase = true;
- }
- // OCR TYPE 6 는 기록하지 않는다
- if (checkOcrType6Form(hosType, formCd)) {
- return -1;
- }
- try {
- using (SaveConsentDac dac = new SaveConsentDac()) {
- Hashtable paramHashTable = GetParamHashTable(userId, patientCode, clnDeptCode, formRid, formCd, consentMstRid, rewriteConsentMstRid,
- reissueConsentMstRid, consentState, paperYn, formXml, dataXml, deviceType, deviceIdentNo,
- vistType, hosType, clnDate, ward, roomcd, reasonForUseN,
- orderNo, orderName, orderCd, ocrCode, cretno, createUserName, modifyUserName,
- certTarget, certResult, mainDrId, opRsrvNo);
- consentMstRid = (int) paramHashTable["consentMstRid"];
- //새로 출력하는 경우
- if (isNewConsentMasterCase) {
- dac.InsertConsentMst(this.IbatisMapper, paramHashTable);
- }
- //새로 작성 아닌 경우
- else {
- if (reissueConsentMstRid > 0)
- dac.UpdateConsentMstForReissue(this.IbatisMapper, paramHashTable);
- else
- dac.UpdateConsentMst(this.IbatisMapper, paramHashTable);
- }
- // OCR 테이블 연계
- Hashtable ocrParam = new Hashtable {
- { "instcd", hosType },
- { "ocrtag", ocrCode },
- { "pid", patientCode },
- { "ordtype", vistType },
- { "orddd", clnDate },
- { "cretno", cretno },
- { "orddrid", mainDrId },
- { "orddeptcd", clnDeptCode },
- { "formcd", formCd },
- { "fstprntdeptcd", userDeptCd },
- { "fstprntid", userId },
- { "updtdeptcd", userDeptCd },
- { "updtuserid", userId },
- { "updtdt", DateTime.Now.ToString("yyyyMMddHHmmss")},
- { "pagecnt", pageCnt },
- { "updtresncnts", reasonForUseN },
- { "actkind", actKind },
- { "clienttype", clientType }
- };
- dac.InsertPrintData(this.IbatisMapper, ocrParam);
- }
- } catch (Exception ex) {
- if (this.IbatisSession != null) this.IbatisSession.RollBackTransaction();
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm SaveData ERROR : [{0}]", ex.ToString()));
- throw ex;
- } finally {
- }
- return consentMstRid;
- }
- public static int ExecuteCommand(string command, int timeout) {
- var processInfo = new System.Diagnostics.ProcessStartInfo("cmd.exe", "/C " + command) {
- RedirectStandardOutput = true,
- CreateNoWindow = true,
- UseShellExecute = false,
- //WorkingDirectory = "C:\\",
- //WorkingDirectory = ".\\",
- };
- var process = System.Diagnostics.Process.Start(processInfo);
- process.WaitForExit(20000);
- //string txt = process.StandardOutput.ReadToEnd();
- //Console.WriteLine(txt);
- var exitCode = process.ExitCode;
- process.Close();
- return exitCode;
- }
- private static Dictionary<string, string> DataXmlToDictionary(string dataXml) {
- Dictionary<string, string> outputDataDic;
- XmlDocument xmlDocument = new XmlDocument();
- xmlDocument.LoadXml(dataXml);
- outputDataDic = new Dictionary<string, string>();
- XmlNode rootNode = xmlDocument.SelectSingleNode("form-data");
- foreach (XmlNode childNode in rootNode.ChildNodes) {
- string fieldName = string.Empty;
- string fieldValue = string.Empty;
- XmlElement outFieldElement = childNode as XmlElement;
- if (outFieldElement != null) {
- fieldName = outFieldElement.Name;
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("DataXmlToDictionary 0 : {0}/{1}", outFieldElement.ChildNodes.Count, fieldName));
- if (outFieldElement.ChildNodes.Count == 1 && outFieldElement.ChildNodes[0] is XmlCDataSection) {
- fieldValue = ((XmlCDataSection) outFieldElement.ChildNodes[0]).InnerText;
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("DataXmlToDictionary 1 : {0}/{1}", fieldName, fieldValue));
- if (outputDataDic.ContainsKey(fieldName)) {
- outputDataDic[fieldName] = fieldValue;
- } else {
- outputDataDic.Add(fieldName, fieldValue);
- }
- } else if (outFieldElement.ChildNodes.Count > 1) {
- foreach (XmlNode childNode2 in childNode.ChildNodes) {
- string fieldName2 = string.Empty;
- string fieldValue2 = string.Empty;
- XmlElement outFieldElement2 = childNode2 as XmlElement;
- fieldName2 = outFieldElement2.Name;
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("DataXmlToDictionary : {0}", fieldName2));
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("DataXmlToDictionary : {0}", outFieldElement2.ChildNodes.Count));
- if (outFieldElement2.ChildNodes.Count > 0 && outFieldElement2.ChildNodes[0] is XmlCDataSection) {
- fieldValue2 = ((XmlCDataSection) outFieldElement2.ChildNodes[0]).InnerText;
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("DataXmlToDictionary 2 : {0}/{1}", fieldName2, fieldValue2));
- }
- if (outputDataDic.ContainsKey(fieldName2)) {
- outputDataDic[fieldName2] = fieldValue2;
- } else {
- outputDataDic.Add(fieldName2, fieldValue2);
- }
- }
- }
- }
- }
- return outputDataDic;
- }
- /// <summary>
- /// EFORM_CODE에 정의하는 시퀀스(채번)을 구한다.
- /// </summary>
- /// <param name="sSubCd"></param>
- /// <returns></returns>
- private int GetSequence(string sSubCd) {
- int nSeq = -1;
- try {
- using (CommonCodeDac dac = new CommonCodeDac()) {
- Code param = new Code();
- param.sub_cd = sSubCd;
- nSeq = dac.GetSequence(this.IbatisMapper, param);
- if (nSeq == 0) {
- dac.InsertSequence(this.IbatisMapper, param);
- nSeq = 1;
- } else {
- param.ud1_num = ++nSeq;
- dac.UpdateSequence(this.IbatisMapper, param);
- }
- }
- } catch (Exception ex) {
- if (this.IbatisSession != null) this.IbatisSession.RollBackTransaction();
- throw ex;
- }
- return nSeq;
- }
- #region GetParamHashTable
- private Hashtable GetParamHashTable(string userId, // 사용자 Id
- string patientCode, // 환자 등록번호
- string clnDeptCode, // 진료과 코드
- int formRid, // (작성대상)서식 Rid
- string formCd, // 서식코드 === CONSENT_DATA_CHOICE에서 입력여부 판단할 파라미터
- int consentMstRid, // 동의서 마스터 데이터 Rid
- int rewriteConsentMstRid, // 재 작성 대상 동의서 마스터 데이터 Rid
- int reissueConsentMstRid, // 재 발행 대상 동의서 마스터 데이터 Rid
- string consentState, // 동의서 상태 (TEMP, PAPER_OUT, ELECTR_CMP, CERTIFY_CMP)
- string paperYn, // 인쇄 발행 여부
- string formXml, // 동의서 EPT Xml
- string dataXml, // 동의서 Data(필드들) Xml
- string deviceType, // 장비 유형 (WIN, AND, IOS, PRT 중1)
- string deviceIdentNo, // 장비 고유식별 번호
- string vistType, // 내원 구분
- string hosType, // 병원 구분
- string clnDate, // 내원구분에 따른 입원일자/진료일자
- string ward, // 병동 코드
- string roomcd, // 병실 코드
- string reasonForUseN, // 출력된 동의서 폐기 사유
- int orderNo, // 처방번호
- string orderName, // 처방명
- string orderCd, // 처방코드
- string ocrCode, // OCR 코드
- int cretno, // 생성번호
- string createUserName, // 작성자명
- string modifyUserName, // 수정자명
- string certTarget, // 서명데이터 원본
- string certResult, // 서명데이터 결과값
- string mainDrId, // 주치의 아이디
- string opRsrvNo // 수술 예약 번호
- ) {
- Hashtable paramHashTable = new Hashtable();
- paramHashTable.Add("userId", userId);
- if (consentMstRid < 1) {
- // insert case
- consentMstRid = this.GetSequence("CONSENT_MST");
- }
- paramHashTable.Add("consentMstRid", consentMstRid);
- paramHashTable.Add("patientCode", patientCode);
- paramHashTable.Add("clnDeptCd", clnDeptCode);
- paramHashTable.Add("vistType", vistType);
- paramHashTable.Add("hosType", hosType);
- paramHashTable.Add("clnDate", clnDate);
- paramHashTable.Add("ward", ward);
- paramHashTable.Add("roomcd", roomcd);
- paramHashTable.Add("orderNo", orderNo);
- paramHashTable.Add("orderName", orderName);
- paramHashTable.Add("orderCd", orderCd);
- paramHashTable.Add("ocrCode", ocrCode);
- paramHashTable.Add("cretno", cretno);
- paramHashTable.Add("createUserName", createUserName);
- paramHashTable.Add("modifyUserName", modifyUserName);
- paramHashTable.Add("formRid", formRid);
- paramHashTable.Add("formCd", formCd);
- paramHashTable.Add("consentState", consentState);
- paramHashTable.Add("certTarget", certTarget); // TODO 원무 pass
- paramHashTable.Add("certResult", certResult); // TODO 원무 pass
- paramHashTable.Add("mainDrId", mainDrId);
- paramHashTable.Add("opRsrvNo", opRsrvNo ?? string.Empty);
- Encoding encoding = Encoding.GetEncoding("UTF-8");
- //if (certResult != null)
- //{
- // paramHashTable.Add("certResult", encoding.GetBytes(certResult));
- //}
- string completeYn = "N"; // 완료 여부
- switch (consentState) {
- case "ELECTR_CMP":
- case "CERTIFY_CMP":
- completeYn = "Y";
- break;
- default:
- break;
- }
- paramHashTable.Add("completeYn", completeYn);
- string completeDateTimeToChars = string.Empty;
- if (completeYn.Equals("Y")) {
- completeDateTimeToChars = "TO_CHAR(SYSDATE,'YYYY-MM-DD hh24:mi:ss')";
- paramHashTable.Add("completeDateTimeToChars", completeDateTimeToChars);
- } else {
- paramHashTable.Add("completeDateTimeToChars", "''");
- }
- paramHashTable.Add("paperYn", paperYn);
- string rewriteYn = "N"; // 재 작성 여부
- if (rewriteConsentMstRid > 1) {
- rewriteYn = "Y";
- }
- paramHashTable.Add("rewriteYn", rewriteYn);
- paramHashTable.Add("rewriteConsentMstRid", rewriteConsentMstRid);
- string reissueYn = "N"; // 재 발행(종이) 여부
- if (reissueConsentMstRid > 1) {
- reissueYn = "Y";
- }
- paramHashTable.Add("reissueYn", reissueYn);
- paramHashTable.Add("reissueConsentMstRid", reissueConsentMstRid);
- int consentDataRid = this.GetSequence("CONSENT_DATA");
- paramHashTable.Add("consentDataRid", consentDataRid);
- paramHashTable.Add("useYn", "Y");
- encoding = Encoding.GetEncoding("UTF-8");
- byte[] formBytesConent = null;
- if (!string.IsNullOrEmpty(formXml)) {
- formBytesConent = encoding.GetBytes(formXml);
- }
- byte[] dataBytesConent = null;
- if (!string.IsNullOrEmpty(dataXml)) {
- dataBytesConent = encoding.GetBytes(dataXml);
- }
- paramHashTable.Add("formXml", formBytesConent);
- paramHashTable.Add("dataXml", dataBytesConent);
- paramHashTable.Add("deviceType", deviceType);
- paramHashTable.Add("deviceIdentNo", deviceIdentNo);
- paramHashTable.Add("reasonForUseN", reasonForUseN);
- return paramHashTable;
- }
- #endregion
- //임시파일 삭제 (1일전 파일은 삭제)
- //public int DeleteTempFile(string targetDate)
- public int DeleteTempFile() {
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("DeleteTempFile DateTime.Now.AddDays(-1) : {0}", DateTime.Now.AddDays(-1).ToString())); // 2016-11-06 오후 8:19:56
- if (tempImageDelStatus.Equals(DateTime.Now.AddDays(-1).ToString().Substring(0, 10).Replace("-", ""))) {
- return 1;
- }
- try {
- string sSeverImgPath = Server.MapPath("./DataTempImage/");
- DirectoryInfo di = new System.IO.DirectoryInfo(sSeverImgPath);
- if (Directory.Exists(sSeverImgPath)) {
- string[] filePaths = Directory.GetFiles(sSeverImgPath);
- foreach (string fileName in filePaths) {
- FileInfo fileInfo = new FileInfo(fileName);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("DeleteTempFile fileInfo.CreationTime : {0}", fileInfo.CreationTime.ToString()));
- if (fileInfo.CreationTime < DateTime.Now.AddDays(-1)) {
- fileInfo.Delete();
- }
- }
- }
- tempImageDelStatus = DateTime.Now.AddDays(-1).ToString().Substring(0, 10).Replace("-", "");
- return 1;
- } catch {
- return -1;
- }
- }
- /// <summary>
- /// 동의서 로드 전 consent_mst_rid에 해당하는 동의서가 상위 상태값이 있는지 체크
- /// </summary>
- /// <param name="consentmstrid"></param>
- /// <param name="consent_state"></param>
- /// <returns></returns>
- [WebMethod(Description = "동의서 상위 상태값이 있는지 체크")]
- public int CheckConsentState(int consentmstrid, string consent_state) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("rid: {0}, state: {1}", consentmstrid, consent_state));
- try {
- int result = -1;
- int StateNo = 0;
- String CurState;
- using (ConsentDac dac = new ConsentDac()) {
- Hashtable param = new Hashtable();
- param.Add("consentmstrid", consentmstrid);
- CurState = dac.GetConsentStateCheck(this.IbatisMapper, param);
- }
- if (CurState == null) {
- return result;
- } else if (CurState.Equals("UNFINISHED")) {
- StateNo = 1;
- } else if (CurState.Equals("TEMP")) {
- StateNo = 2;
- } else if (CurState.Equals("VERBAL")) {
- StateNo = 3;
- } else if (CurState.Equals("PAPER_OUT")) {
- StateNo = 4;
- } else if (CurState.Equals("ELECTR_CMP")) {
- StateNo = 5;
- } else if (CurState.Equals("CERTIFY_CMP")) {
- StateNo = 6;
- }
- if (consent_state == null/* || string.IsNullOrEmpty(consent_state)*/) {
- return result;
- } else if (consent_state.Equals("UNFINISHED")) {
- result = 1;
- } else if (consent_state.Equals("TEMP")) {
- result = 2;
- } else if (consent_state.Equals("VERBAL")) {
- result = 3;
- } else if (consent_state.Equals("PAPER_OUT")) {
- result = 4;
- } else if (consent_state.Equals("ELECTR_CMP")) {
- result = 5;
- } else if (consent_state.Equals("CERTIFY_CMP")) {
- return result;
- }
- if (result < StateNo)//로드하려는 동의서의 상태보다 현재 저장된 상태가 더 높은 상태일 경우
- {
- return 1;
- } else//로드하려는 동의서보다 현재 저장된 상태가 낮은상태일 경우 또는 같을경우
- {
- return 0;
- }
- } catch {
- return -1;
- }
- }
- /// <summary>
- /// 개인정보 동의서 일때만 해당 메서드를 사용함 (formCd가 1200005463, 1800014564 인것만)
- /// </summary>
- private void SavePatientConsentInfo(string formCd, string pid, string ocrTag, string userId, string dataXml) {
- try {
- // 동의서 내부 데이터 추출
- UTF8Encoding encoder = new UTF8Encoding();
- Decoder utf8Decode = encoder.GetDecoder();
- byte[] toEcodeByte = Convert.FromBase64String(dataXml);
- int charCount = utf8Decode.GetCharCount(toEcodeByte, 0, toEcodeByte.Length);
- char[] decodedChar = new char[charCount];
- utf8Decode.GetChars(toEcodeByte, 0, toEcodeByte.Length, decodedChar, 0);
- dataXml = Unzip(toEcodeByte);
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("dataXml -- > " + dataXml);
- Dictionary<string, string> pamDic = DataXmlToDictionary(dataXml);
-
- string savPrivacy1 = pamDic.ContainsKey("sav_privacy1") ? pamDic["sav_privacy1"].ToString() : ""; // 개인정보 서식의 메인 동의, 미동의 데이터
- string savPrivacy2 = pamDic.ContainsKey("sav_privacy2") ? pamDic["sav_privacy2"].ToString() : ""; // 개인정보 서식의 첫 번째 동의, 미동의 데이터 (사후서비스제공)
- string savPrivacy3 = pamDic.ContainsKey("sav_privacy3") ? pamDic["sav_privacy3"].ToString() : ""; // 개인정보 서식의 두 번째 동의, 미동의 데이터 (모바일안내)
- string savPrivacy4 = pamDic.ContainsKey("sav_privacy4") ? pamDic["sav_privacy4"].ToString() : ""; // 개인정보 서식의 세 번째 동의, 미동의 데이터 (행사안내)
- string savPrivacy5 = pamDic.ContainsKey("sav_privacy5") ? pamDic["sav_privacy5"].ToString() : ""; // 개인정보 서식의 네 번째 동의, 미동의 데이터 (협력병원)
- string patientNm = pamDic.ContainsKey("savSG_PatientNm") ? pamDic["savSG_PatientNm"].ToString() : ""; // 환자 이름
- string patientSign = pamDic.ContainsKey("savSG_PatientSign") ? pamDic["savSG_PatientSign"].ToString() : ""; // 환자 서명
- string agentNm = pamDic.ContainsKey("savSG_AgentNm") ? pamDic["savSG_AgentNm"].ToString() : ""; // 동의권자 이름
- string agnentSign = pamDic.ContainsKey("savSG_AgentSign") ? pamDic["savSG_AgentSign"].ToString() : ""; // 동의권자 서명
- string agentRelation = pamDic.ContainsKey("savSG_AgentRelation") ? pamDic["savSG_AgentRelation"].ToString() : "1"; // 환자와의 관계 드롭박스
- string agentETC = pamDic.ContainsKey("savSG_AgentETC") ? pamDic["savSG_AgentETC"].ToString() : ""; // 환자와의 관계 글상자(기타 입력란)
- string agentReason = pamDic.ContainsKey("savSG_AgentReason") ? pamDic["savSG_AgentReason"].ToString() : ""; // 동의권자서명이유 상위컨트롤(라디오박스)
- string agentPhone = pamDic.ContainsKey("savSG_AgentPhone") ? pamDic["savSG_AgentPhone"].ToString() : ""; // 법정대리인 연락처 글상자
- string agentReasonText = pamDic.ContainsKey("savSG_AgentReasonText") ? pamDic["savSG_AgentReasonText"].ToString() : ""; // 기타 글 상자
- // 관계가 없다면 본인 서명 아니라면 값을
- agentRelation = agentRelation == "" ? "1" : agentRelation;
- // 동의권자 서명 사유
- var value5 = string.Empty;
- var value6 = string.Empty;
- var value7 = string.Empty;
- var value8 = string.Empty;
- var value9 = string.Empty;
- switch (agentReason) {
- case "value1":
- value5 = "Y";
- break;
- case "value2":
- value6 = "Y";
- break;
- case "value3":
- value7 = "Y";
- break;
- case "value4":
- value8 = "Y";
- break;
- case "value5":
- value9 = "Y";
- break;
- }
- using (SaveConsentDac dac = new SaveConsentDac()) {
- Hashtable param = new Hashtable();
- param.Add("pid", pid);
- param.Add("userId", userId);
- param.Add("instcd", "101");
- int pamSeqResult = dac.getPamSeqNo(this.IbatisMapper, param);
- // 기존의 개인정보보호 동의서가 있다면 업데이트
- if(pamSeqResult > 0) {
- dac.updatePreSignData(this.IbatisMapper, param);
- }
- // 개인정보보호동의서 신규
- param.Add("patientNm", patientNm);
- param.Add("agentRelation", agentRelation);
- param.Add("patientSign", string.IsNullOrEmpty(patientSign) ? "N" : "Y");
- param.Add("savPrivacy1", savPrivacy1);
- param.Add("savPrivacy2", savPrivacy2);
- param.Add("savPrivacy3", savPrivacy3);
- param.Add("savPrivacy4", savPrivacy4);
- param.Add("savPrivacy5", savPrivacy5);
- param.Add("value5", value5);
- param.Add("value6", value6);
- param.Add("value7", value7);
- param.Add("value8", value8);
- param.Add("value9", value9);
- param.Add("telno", agentPhone);
- param.Add("etc", agentReasonText);
-
- param.Add("seqno", pamSeqResult);
- param.Add("seqno2", Convert.ToString(Convert.ToInt32(pamSeqResult) + 1));
- var result = dac.insPmcmpicm(this.IbatisMapper, param);
- pamSeqResult = pamSeqResult + 1;
- //CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug("pamSeqResult -- > " + pamSeqResult);
- }
- } catch (Exception ex) {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(string.Format("CLIP.eForm SavePatientConsentInfo ERROR : [{0}]", ex.ToString()));
- throw ex;
- }
- }
- /// <summary>
- /// 기준자료로 부터 OCT 태그에 찍힐 String 값
- /// 경북대병원 dependency
- /// </summary>
- /// <param name="formCd">The form cd.</param>
- /// <param name="dutinstcd">The dutinstcd.</param>
- /// <returns></returns>
- [WebMethod(Description = "기준자료로 부터 OCT 태그에 찍힐 String 값")]
- public String getOcrString(string formCd, string dutinstcd) {
- using (ConsentDac dac = new ConsentDac()) {
- Hashtable param = new Hashtable();
- param.Add("formcd", formCd);
- param.Add("instcd", dutinstcd);
- return dac.getOcrString(this.IbatisMapper, param);
- }
- }
- /// <summary>
- /// 원무 서식의 인증저장 사용여부
- /// Y 일 경우 인증서 묻기를 하지 않는다
- /// 경북대병원 dependency
- /// </summary>
- /// <param name="formCd">서식 코드</param>
- /// <param name="dutinstcd">근무지기관코드</param>
- /// <returns></returns>
- [WebMethod(Description = "원무서식 인증저장 사용여부, Y 일 경우 인증저장시 인증서 묻기 pass")]
- public String getCertUseYn(String formCd, String dutinstcd) {
- using (ConsentDac dac = new ConsentDac()) {
- Hashtable param = new Hashtable();
- param.Add("formcd", formCd);
- param.Add("instcd", dutinstcd);
- String value = dac.getCertuseYn(this.IbatisMapper, param);
- return (value == null) ? "N" : value;
- //return dac.getCertuseYn(this.IbatisMapper, param);
- }
- }
- /// <summary>
- /// 원무 서식의 인증저장 사용여부 (모바일에서 사용)
- /// 원무 서식이 여러개 선택되었을때
- /// Y 일 경우 인증서 묻기를 하지 않는다
- /// 경북대병원 dependency
- /// </summary>
- /// <param name="formCd">서식 코드</param> 서식코드는 '11111111', '2222222', '333333' 형태로 들어옴
- /// <param name="dutinstcd">근무지기관코드</param>
- /// <returns></returns>
- [WebMethod(Description = "원무서식 인증저장 사용여부, Y 일 경우 인증저장시 인증서 묻기 pass (모바일에서 다중 선택 기능 포함)")]
- public String getCertUseYnData(String formCd, String dutinstcd) {
- using (ConsentDac dac = new ConsentDac()) {
- Hashtable param = new Hashtable();
- param.Add("formcd", formCd);
- param.Add("instcd", dutinstcd);
- String result = dac.getCertUseYnData(this.IbatisMapper, param);
- if (result == null) {
- result = "";
- }
- return result;
- }
- }
- /// <summary>
- /// 경북대학교병원 PC 클라이언트 dual view 모드 활성화 여부 조회
- /// </summary>
- /// <param name="dutinstcd">근무지기관코드</param>
- /// <param name="ipaddr">해당 PC 의 ip address</param>
- /// <returns></returns>
- [WebMethod(Description = "경북대학교병원 PC 클라이언트 dual view 모드 활성화 여부 조회")]
- public String getDualViewMode(String dutinstcd, String ipaddr) {
- using (ConsentDac dac = new ConsentDac()) {
- Hashtable param = new Hashtable();
- param.Add("instcd", dutinstcd);
- param.Add("ipaddr", ipaddr);
- String value = dac.getDualViewMode(this.IbatisMapper, param);
- return (value == null) ? "N" : value;
- }
- //return "N";
- }
- /// <summary>
- /// 확인저장 된 서식을 일괄저장
- /// </summary>
- /// <param name="consent_rids"></param>
- /// <param name="ocrtags"></param>
- /// <param name="instcd"></param>
- /// <returns></returns>
- [WebMethod(Description = "경북대학교병원 일괄 인증 저장")]
- public String updateCertifyComplete(String consent_rids, String ocrtags, String instcd) {
- String result = "N";
- try {
- Hashtable param1 = new Hashtable();
- Hashtable param2 = new Hashtable();
- param1.Add("consent_rids", consent_rids);
- param1.Add("instcd", instcd);
- param2.Add("ocrtags", ocrtags);
- param2.Add("instcd", instcd);
- using (ConsentDac dac = new ConsentDac()) {
- // 동의서 테이블 master
- dac.updateToCertifyConsentMst(this.IbatisMapper, param1);
- // 경북대학교병원 출력 로그 테이블
- dac.updateToCertifyOcrprnt(this.IbatisMapper, param2);
- }
- result = "Y";
- } catch (Exception ex) {
- if (this.IbatisSession != null) this.IbatisSession.RollBackTransaction();
- result = "N";
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(
- String.Format("CLIP.eForm updateCertifyComplete ERROR : [{0}]", ex.ToString()));
- }
- return result;
- }
- /// <summary>
- /// 전자동의서 프린트 출력 오류 시 프린트 로그 삭제 메서드
- /// </summary>
- /// <param name="pid"></param>
- /// <param name="ocrtag"></param>
- /// <param name="instcd"></param>
- [WebMethod(Description = "프린터 출력 오류 시 출력 히스토리 삭제")]
- public void updatePrintHistory(String pid, String ocrtag, String instcd) {
- try {
- Hashtable param1 = new Hashtable();
- param1.Add("pid", pid);
- param1.Add("instcd", instcd);
- param1.Add("ocrtag", ocrtag);
- using (ConsentDac dac = new ConsentDac()) {
- dac.updateOcrPrintHistory(this.IbatisMapper, param1);
- dac.updateConsentMaster(this.IbatisMapper, param1);
- }
- } catch (Exception ex) {
- if (this.IbatisSession != null) this.IbatisSession.RollBackTransaction();
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Error(
- String.Format("CLIP.eForm updatePrintHistory ERROR : [{0}]", ex.ToString()));
- }
- }
- /// <summary>
- /// 동의서 선택시 해당일에 대해 중복으로 정상되었는지 확인
- /// </summary>
- /// <param name="pid"></param>
- /// <param name="instcd"></param>
- /// <param name="formcd"></param> '000000', '000001', '000002' 콤마로 붙여야함
- [WebMethod(Description = "동의서 선택시 해당일에 대해 중복으로 정상되었는지 확인")]
- public String duplicateCertConsent(String pid, String instcd, String formcd) {
- using (ConsentDac dac = new ConsentDac()) {
- Hashtable param = new Hashtable();
- param.Add("pid", pid);
- param.Add("instcd", instcd);
- param.Add("formcd", formcd);
- String result = dac.getDupCertConsent(this.IbatisMapper, param);
- if (result == null) {
- result = "N";
- }
- return result;
- }
- }
- [WebMethod(Description = "동의서 선택시 해당일에 대해 중복으로 정상되었는지 확인")]
- public String getUserTableGrants() {
- string result = string.Empty;
- using(CommonCodeDac dac = new CommonCodeDac()) {
- Hashtable param = new Hashtable();
- dac.GetImageServerProps(this.IbatisMapper, param);
- }
-
- return result;
- }
- }
- }
|