mplus.common.js 82 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673
  1. /**
  2. * mplus_common
  3. */
  4. var mplus_common = function(){
  5. mplus_mobile.call(this);
  6. var self = this;
  7. // ajax 설정
  8. $.ajaxSetup({
  9. timeout: 30000,
  10. error: function(XHR, textStatus, errorThrown ) { //XMLHttpRequest, textStatus(timeout, error, notmodified, parseerror...), errorThrown
  11. //==== old code : 삭제 예정 { ====
  12. //function(x, t, m) { //XMLHttpRequest, textStatus(timeout, error, notmodified, parseerror...), errorThrown
  13. //if(t==="timeout") {
  14. // self.alert(self.getI18n("error500"));
  15. // self.loading("hide");
  16. //} else {
  17. // self.loading("hide");
  18. // self.alert(t);
  19. //}
  20. //==== old code : 삭제 예정 } ====
  21. self.loading( "hide");
  22. if( XHR.status == 0){
  23. self.alert( "You are offline!! <br>Please Check Your Network.");
  24. }else if( XHR.status == 404){
  25. self.alert("Requested URL not found.<br>[HTTP 404 ERROR]");
  26. }else if( XHR.status == 409){
  27. self.alertDuplicationLogin( "다른 기기에서 같은 ID로 로그인 했습니다.");
  28. }else if( XHR.status == 500){
  29. self.alert( "Internel Server Error.<br>[HTTP 500 ERROR]");
  30. }else if( textStatus == "parsererror"){
  31. self.alert( "Error. Parsing JSON Request failed.");
  32. }else if(textStatus == "timeout"){
  33. self.alert( "Request Time out.");
  34. }else {
  35. self.alert( "Unknow Error. " + XHR.responseText);
  36. }
  37. console.log( "code:" + XHR.status + "\n" + "message:" + XHR.responseText + "\n"+"error:" + errorThrown);
  38. },
  39. dataFilter: function(result){
  40. if(result!=""){
  41. resultJson = JSON.parse(result);
  42. if(resultJson.msg==self.getI18n("unauthenticated")){
  43. self.common.initLocalStorage();
  44. location.href = contextPath + "/logout.page";
  45. return null;
  46. };
  47. };
  48. return result;
  49. }
  50. });
  51. $serviceBaseUrl = contextPath + "/mobile";
  52. this.init = function(){
  53. addEvent();
  54. movePageEvent();
  55. };
  56. var addEvent = function(){
  57. //로그아웃
  58. $("#btnLogout").on("click", function(){
  59. logout();
  60. });
  61. //로그아웃2
  62. // $("#btnLogout2").on("click", function(){
  63. // logout();
  64. // });
  65. };
  66. //화면이동 공통이벤트
  67. var movePageEvent = function(){
  68. // //설정창 오픈
  69. // $('#btnMoveSetting').on('click', function(){
  70. // /*location.href = contextPath + '/mobile/setting/setting.page';*/
  71. // var deptList = JSON.parse(localStorage.user).departmentList;
  72. // var div = $('<div></div>');
  73. // $('#settingDeptList').empty();
  74. // for(var i=0; i<deptList.length; i++){
  75. // var radioOption = div.clone().addClass('radio3 radio-check').append(
  76. // $('<input></input>').clone().attr('name', 'settingDeptRadio').attr('type', 'radio').attr('id', 'settingDeptRadio'+i).attr('value', deptList[i].departmentCd).attr('deptName', deptList[i].departmentNm)
  77. // ).append(
  78. // $('<label></label>').clone().attr('for', 'settingDeptRadio'+i).text(deptList[i].departmentNm)
  79. // );
  80. // $('#settingDeptList').append(radioOption);
  81. // };
  82. //
  83. // $('#settingModal').modal("show");
  84. // $('input:radio[name=settingDeptRadio]:input[value=' + localStorage.selectedDeptCd + ']').attr("checked", true);
  85. //
  86. // $('#settingModal .modal-body #settingDeptList').css({'max-height': $(window).height()-180,
  87. // 'overflow-y': 'auto'});
  88. //
  89. // $('#settingModal').modal('show');
  90. // });
  91. // //진료과 설정 저장
  92. // $('#btnSaveSettingModal').unbind();
  93. // $('#btnSaveSettingModal').on('click', function(){
  94. // if(localStorage.getItem('selectedDeptCd')!= $('input[name=settingDeptRadio]:checked').val()){
  95. // localStorage.setItem('selectedDeptCd', $('[name=settingDeptRadio]:checked').val());
  96. // localStorage.setItem('selectedDeptNm', $('[name=settingDeptRadio]:checked')[0].attributes.deptName.value);
  97. // $('#panelUserDept').text($('[name=settingDeptRadio]:checked')[0].attributes.deptName.value);
  98. // $('.slt-my-department').val($('[name=settingDeptRadio]:checked').val());
  99. // if($('.slt-my-department').val()==null) $('.slt-my-department').val($(".slt-my-department option:first").val());
  100. // $('.slt-my-department').trigger('change');
  101. // };
  102. //
  103. // $('#settingModal').modal('hide');
  104. //
  105. // });
  106. //
  107. // //환자상세정보화면이동
  108. // $('[name=btnMoveDetail]').on('click', function(){
  109. // /*location.href = contextPath + '/mobile/patient/clinicInfo.page?page=info';*/
  110. // $('#patientPopup .popup-content:not(#popContentConsultDetail).in').removeClass('in');
  111. // $('#patientPopup #popContentPatientInfo').addClass('in');
  112. // $('#newPopupFooter2').css('display', 'block');
  113. // $('#patientPopup').css({'height': '-webkit-calc(100% - 40px)',
  114. // 'height': '-moz-calc(100% - 40px)',
  115. // 'height': 'calc(100% - 40px)',
  116. // 'bottom': '0px',
  117. // 'display': 'block'});
  118. // var mplusPatient = new mplus_mobile_patient();
  119. // mplusPatient.detailInit();
  120. // });
  121. // //처방화면이동
  122. // $('[name=btnMovePrescription]').on('click', function(){
  123. // /*location.href = contextPath + '/mobile/patient/clinicInfo.page?page=prescription';*/
  124. // $('#patientPopup .popup-content:not(#popContentConsultDetail).in').removeClass('in');
  125. // $('#patientPopup #popContentPrescription').addClass('in');
  126. // $('#newPopupFooter2').css('display', 'block');
  127. // $('#patientPopup').css({'height': '-webkit-calc(100% - 40px)',
  128. // 'height': '-moz-calc(100% - 40px)',
  129. // 'height': 'calc(100% - 40px)',
  130. // 'bottom': '0px',
  131. // 'display': 'block'});
  132. // var mplusPatient = new mplus_mobile_patient();
  133. // mplusPatient.prescriptionInit();
  134. // });
  135. //
  136. // //검사화면이동
  137. // $('[name=btnMoveExamine]').on('click', function(){
  138. // $('#patientPopup .popup-content:not(#popContentConsultDetail).in').removeClass('in');
  139. // $('#patientPopup #popContentExamine').addClass('in');
  140. // $('#newPopupFooter2').css('display', 'block');
  141. // $('#patientPopup').css({'height': '-webkit-calc(100% - 40px)',
  142. // 'height': '-moz-calc(100% - 40px)',
  143. // 'height': 'calc(100% - 40px)',
  144. // 'bottom': '0px',
  145. // 'display': 'block'});
  146. // var mplusPatient = new mplus_mobile_patient();
  147. // mplusPatient.examineInit();
  148. // });
  149. };
  150. var logout = function(){
  151. self.confirm("로그아웃 하시겠습니까?", function(callback){
  152. if(callback){
  153. //자동로그인 기능 제거
  154. localStorage.setItem("defaultisAuto", "");
  155. self.common.initLocalStorage();
  156. location.href = contextPath + "/logout.page";
  157. console.log("contextPath -- > " + contextPath);
  158. };
  159. });
  160. };
  161. this.dateCalc = function(fromDate, toDate){
  162. var fromArray = fromDate.split("-");
  163. var toArray = toDate.split("-");
  164. var calFromDate = new Date(fromArray[0], Number(fromArray[1])-1, fromArray[2]);
  165. var calToDate = new Date(toArray[0], Number(toArray[1])-1, toArray[2]);
  166. var betweenDate = (calToDate.getTime() - calFromDate.getTime())/1000/60/60/24;
  167. return betweenDate;
  168. };
  169. this.rotateScreen = function(orientation){
  170. var jsonmsg = {
  171. "type" : "command",
  172. "functionType" : "rotateScreen",
  173. "value" : {
  174. "orientation" : orientation,
  175. "callbackFn":"window.activeObj.init"
  176. }
  177. };
  178. self.toNative(jsonmsg);
  179. };
  180. /* APP배포 --------------------------------------------------------------------- */
  181. this.deployment = {
  182. //다운로드 이력 로그 전송
  183. inputDownloadLog : function(param, callback){
  184. $.ajax ({
  185. url : $serviceBaseUrl + "/deployment/inputDownloadLog.json",
  186. type : "POST",
  187. contentType: "application/json",
  188. data: JSON.stringify(param),
  189. success: function(response){
  190. if(response.result!=undefined){
  191. callback(response.result);
  192. }else{
  193. self.alert(response.msg);
  194. }
  195. },
  196. beforeSend: function(){
  197. self.loading("show");
  198. },
  199. complete:function(){
  200. self.loading("hide");
  201. }
  202. });
  203. }
  204. };
  205. // 20190405 iOS 캡쳐 방지 로그 전송
  206. this.inputLoginLog = function(){
  207. //디바이스 정보 호출 후 로그 등록
  208. var msg = {
  209. type : "command",
  210. functionType : "getDeviceInfo",
  211. value : {
  212. callbackFn : "window.activeObj.getDeviceInfoCallBack2"
  213. }
  214. };
  215. self.toNative( msg );
  216. };
  217. // 디바이스 정보 전송 추출 callback 처리
  218. this.getDeviceInfoCallBack2 = function(returnCode){
  219. var results = new Object();
  220. if( typeof returnCode === "string" ){
  221. results = self.util.parseJson( returnCode );
  222. } else {
  223. results = returnCode;
  224. }
  225. if( results.success != undefined && results.success == "true" ) {
  226. console.log("getDeviceInfo : success");
  227. console.log( results.result);
  228. gDeviceId = results.result.deviceId;
  229. gAppKind = results.result.appKind;
  230. gAppVersion = results.result.appVersion;
  231. gPhoneKind = results.result.phoneKind;
  232. } else {
  233. console.log("getDeviceInfo : failed");
  234. self.alert( "getDeviceInfo() APP function 호출 오류 " );
  235. }
  236. // 20190125 shinsunwoo device id 추출을 실패한 경우 uuid() 스크립트 값을 적용
  237. if( gDeviceId == "NONE")
  238. gDeviceId = uuid();
  239. console.log("캡쳐로그방지 로그전송" +
  240. "\n gLoginUserId : " + gLoginUserId +
  241. "\n gLoginUserNm : " + gLoginUserNm +
  242. "\n gDeviceId : " + gDeviceId +
  243. "\n gAppVersion : " + gAppVersion +
  244. "\n gAppKind : " + gAppKind +
  245. "\n gPhoneKind : " + gPhoneKind +
  246. "\n gClientIp : " + gClientIp
  247. );
  248. var param = {
  249. userId : (gLoginUserId === undefined) ? "-" : gLoginUserId,
  250. userNm : (gLoginUserNm === undefined) ? "-" : gLoginUserNm,
  251. deviceId: (gDeviceId === undefined) ? "-" : gDeviceId,
  252. appVersion: (gAppVersion === undefined) ? "-" : gAppVersion,
  253. appKind: (gAppKind === undefined) ? "-" : gAppKind,
  254. phoneKind: (gPhoneKind === undefined) ? "-" : gPhoneKind,
  255. userIp: gClientIp,
  256. currentDt : moment( new Date()).format("YYYYMMDDHHmmss"),
  257. successYn : "N",
  258. failMsg : "화면캡쳐",
  259. logFlag : "C"
  260. };
  261. $.ajax ({
  262. url : $serviceBaseUrl + "/login/inputLoginLog.json",
  263. type : "POST",
  264. contentType: "application/json",
  265. data: JSON.stringify(param),
  266. success: function(response){
  267. if(response.result!=undefined){
  268. //callback(response.result);
  269. }else{
  270. self.alert(response.msg);
  271. }
  272. },
  273. beforeSend: function(){
  274. self.loading("show");
  275. },
  276. complete:function(){
  277. self.loading("hide");
  278. }
  279. });
  280. };
  281. /* 로그인 --------------------------------------------------------------------- */
  282. this.login = {
  283. //로그인 접속 로그 전송
  284. inputLoginLog : function(param, callback){
  285. $.ajax ({
  286. url : $serviceBaseUrl + "/login/inputLoginLog.json",
  287. type : "POST",
  288. contentType: "application/json",
  289. data: JSON.stringify(param),
  290. success: function(response){
  291. if(response.result!=undefined){
  292. callback(response.result);
  293. }else{
  294. self.alert(response.msg);
  295. }
  296. },
  297. beforeSend: function(){
  298. self.loading("show");
  299. },
  300. complete:function(){
  301. self.loading("hide");
  302. }
  303. });
  304. }
  305. };
  306. /* 병원관리 --------------------------------------------------------------------- */
  307. this.hospital = {
  308. };
  309. /* 일정관리 --------------------------------------------------------------------- */
  310. this.schedule = {
  311. //검사실 부서 리스트 조회 - 의사, 간호사
  312. getSchExamDeptList : function(param, callback){
  313. $.ajax ({
  314. url : $serviceBaseUrl + "/schedule/getSchExamDeptList.json",
  315. type : "POST",
  316. contentType: "application/json",
  317. data: JSON.stringify(param),
  318. success: function(response){
  319. if(response.result!=undefined){
  320. callback(response.result);
  321. }else{
  322. self.alert(response.msg);
  323. }
  324. },
  325. beforeSend: function(){
  326. self.loading("show");
  327. },
  328. complete:function(){
  329. self.loading("hide");
  330. }
  331. });
  332. } ,
  333. //진료과 부서 리스트 조회 - 의사, 간호사, 인턴
  334. getShcDeptList : function(param, callback){
  335. $.ajax ({
  336. url : $serviceBaseUrl + "/schedule/getShcDeptList.json",
  337. type : "POST",
  338. contentType: "application/json",
  339. data: JSON.stringify(param),
  340. success: function(response){
  341. if(response.result!=undefined){
  342. callback(response.result);
  343. }else{
  344. self.alert(response.msg);
  345. }
  346. },
  347. beforeSend: function(){
  348. self.loading("show");
  349. },
  350. complete:function(){
  351. self.loading("hide");
  352. }
  353. });
  354. } ,
  355. //병동 부서 리스트 조회 - 의사, 간호사
  356. getShcWardList : function(param, callback){
  357. $.ajax ({
  358. url : $serviceBaseUrl + "/schedule/getShcWardList.json",
  359. type : "POST",
  360. contentType: "application/json",
  361. data: JSON.stringify(param),
  362. success: function(response){
  363. if(response.result!=undefined){
  364. callback(response.result);
  365. }else{
  366. self.alert(response.msg);
  367. }
  368. },
  369. beforeSend: function(){
  370. self.loading("show");
  371. },
  372. complete:function(){
  373. self.loading("hide");
  374. }
  375. });
  376. } ,
  377. //당직 일정 조회 - 의사, 간호사
  378. getOnDutyWeekSch : function(param, callback){
  379. $.ajax ({
  380. url : $serviceBaseUrl + "/schedule/getOnDutyWeekSch.json",
  381. type : "POST",
  382. contentType: "application/json",
  383. data: JSON.stringify(param),
  384. success: function(response){
  385. if(response.result!=undefined){
  386. callback(response.result);
  387. }else{
  388. self.alert(response.msg);
  389. }
  390. },
  391. beforeSend: function(){
  392. self.loading("show");
  393. },
  394. complete:function(){
  395. self.loading("hide");
  396. }
  397. });
  398. } ,
  399. //개인 상세 당직 일정 조회 - 의사, 간호사
  400. getOnDutyMonthSch : function(param, callback){
  401. $.ajax ({
  402. url : $serviceBaseUrl + "/schedule/getOnDutyMonthSch.json",
  403. type : "POST",
  404. contentType: "application/json",
  405. data: JSON.stringify(param),
  406. success: function(response){
  407. if(response.result!=undefined){
  408. callback(response.result);
  409. }else{
  410. self.alert(response.msg);
  411. }
  412. },
  413. beforeSend: function(){
  414. self.loading("show");
  415. },
  416. complete:function(){
  417. self.loading("hide");
  418. }
  419. });
  420. } ,
  421. //외래 진료 일정 조회
  422. getWorkSch : function(param, callback){
  423. $.ajax ({
  424. url : $serviceBaseUrl + "/schedule/getWorkSch.json",
  425. type : "POST",
  426. contentType: "application/json",
  427. data: JSON.stringify(param),
  428. success: function(response){
  429. if(response.result!=undefined){
  430. callback(response.result);
  431. }else{
  432. self.alert(response.msg);
  433. }
  434. },
  435. beforeSend: function(){
  436. self.loading("show");
  437. },
  438. complete:function(){
  439. self.loading("hide");
  440. }
  441. });
  442. } ,
  443. //의료진 정보 조회
  444. getDoctorInfo : function(param, callback, type){
  445. $.ajax ({
  446. url : $serviceBaseUrl + "/schedule/getDoctorInfo.json",
  447. type : "POST",
  448. async: false,
  449. contentType: "application/json",
  450. data: JSON.stringify(param),
  451. success: function(response){
  452. if(response.result!=undefined){
  453. callback(response.result, type);
  454. }else{
  455. self.alert(response.msg);
  456. }
  457. },
  458. beforeSend: function(){
  459. self.loading("show");
  460. },
  461. complete:function(){
  462. self.loading("hide");
  463. }
  464. });
  465. }
  466. };
  467. /* 진료 --------------------------------------------------------------------- */
  468. this.medical = {
  469. /* 진료-서비스 --------------------------------------------------------------------- */
  470. //과거 입원 이력 조회
  471. getInHistoryList : function(param, callback){
  472. $.ajax ({
  473. url : $serviceBaseUrl + "/medical/getInHistoryList.json",
  474. type : "POST",
  475. contentType: "application/json",
  476. data: JSON.stringify(param),
  477. success: function(response){
  478. if(response.result!=undefined){
  479. callback(response.result);
  480. }else{
  481. self.alert(response.msg);
  482. }
  483. },
  484. beforeSend: function(){
  485. self.loading("show");
  486. },
  487. complete:function(){
  488. self.loading("hide");
  489. }
  490. });
  491. },
  492. //과거 외래 진료 이력 조회
  493. getOutHistoryList : function(param, callback){
  494. $.ajax ({
  495. url : $serviceBaseUrl + "/medical/getOutHistoryList.json",
  496. type : "POST",
  497. contentType: "application/json",
  498. data: JSON.stringify(param),
  499. success: function(response){
  500. if(response.result!=undefined){
  501. callback(response.result);
  502. }else{
  503. self.alert(response.msg);
  504. }
  505. },
  506. beforeSend: function(){
  507. self.loading("show");
  508. },
  509. complete:function(){
  510. self.loading("hide");
  511. }
  512. });
  513. },
  514. //과거 수술 이력 조회
  515. getOpHistoryList : function(param, callback){
  516. $.ajax ({
  517. url : $serviceBaseUrl + "/medical/getOpHistoryList.json",
  518. type : "POST",
  519. contentType: "application/json",
  520. data: JSON.stringify(param),
  521. success: function(response){
  522. if(response.result!=undefined){
  523. callback(response.result);
  524. }else{
  525. self.alert(response.msg);
  526. }
  527. },
  528. beforeSend: function(){
  529. self.loading("show");
  530. },
  531. complete:function(){
  532. self.loading("hide");
  533. }
  534. });
  535. },
  536. //진료 기록 조회
  537. getMediRecord : function(param, callback){
  538. $.ajax ({
  539. url : $serviceBaseUrl + "/medical/getMediRecord.json",
  540. type : "POST",
  541. contentType: "application/json",
  542. data: JSON.stringify(param),
  543. success: function(response){
  544. if(response.result!=undefined){
  545. callback(response.result);
  546. }else{
  547. self.alert(response.msg);
  548. }
  549. },
  550. beforeSend: function(){
  551. self.loading("show");
  552. },
  553. complete:function(){
  554. self.loading("hide");
  555. }
  556. });
  557. },
  558. //입원일자 이력 리스트 조회
  559. getInDateList : function(param, callback){
  560. $.ajax ({
  561. url : $serviceBaseUrl + "/medical/getInDateList.json",
  562. type : "POST",
  563. contentType: "application/json",
  564. data: JSON.stringify(param),
  565. success: function(response){
  566. if(response.result!=undefined){
  567. callback(response.result);
  568. }else{
  569. self.alert(response.msg);
  570. }
  571. },
  572. beforeSend: function(){
  573. self.loading("show");
  574. },
  575. complete:function(){
  576. self.loading("hide");
  577. }
  578. });
  579. },
  580. //외래 진료일자 이력 리스트 조회
  581. getOutDateList : function(param, callback){
  582. $.ajax ({
  583. url : $serviceBaseUrl + "/medical/getOutDateList.json",
  584. type : "POST",
  585. contentType: "application/json",
  586. data: JSON.stringify(param),
  587. success: function(response){
  588. if(response.result!=undefined){
  589. callback(response.result);
  590. }else{
  591. self.alert(response.msg);
  592. }
  593. },
  594. beforeSend: function(){
  595. self.loading("show");
  596. },
  597. complete:function(){
  598. self.loading("hide");
  599. }
  600. });
  601. },
  602. //처방 분류 리스트 조회- 입원, 외래
  603. getPrescriptionClsList : function(param, callback){
  604. $.ajax ({
  605. url : $serviceBaseUrl + "/medical/getPrescriptionClsList.json",
  606. type : "POST",
  607. contentType: "application/json",
  608. data: JSON.stringify(param),
  609. success: function(response){
  610. if(response.result!=undefined){
  611. callback(response.result);
  612. }else{
  613. self.alert(response.msg);
  614. }
  615. },
  616. beforeSend: function(){
  617. self.loading("show");
  618. },
  619. complete:function(){
  620. self.loading("hide");
  621. }
  622. });
  623. },
  624. //처방 상태 리스트 조회- 입원, 외래
  625. getPrescriptionStatList : function(param, callback){
  626. $.ajax ({
  627. url : $serviceBaseUrl + "/medical/getPrescriptionStatList.json",
  628. type : "POST",
  629. contentType: "application/json",
  630. data: JSON.stringify(param),
  631. success: function(response){
  632. if(response.result!=undefined){
  633. callback(response.result);
  634. }else{
  635. self.alert(response.msg);
  636. }
  637. },
  638. beforeSend: function(){
  639. self.loading("show");
  640. },
  641. complete:function(){
  642. self.loading("hide");
  643. }
  644. });
  645. },
  646. //처방 내역 조회 - 입원, 외래, 협진
  647. getPrescription : function(param, callback){
  648. $.ajax ({
  649. url : $serviceBaseUrl + "/medical/getPrescription.json",
  650. type : "POST",
  651. contentType: "application/json",
  652. data: JSON.stringify(param),
  653. success: function(response){
  654. if(response.result!=undefined){
  655. callback(response.result);
  656. }else{
  657. self.alert(response.msg);
  658. }
  659. },
  660. beforeSend: function(){
  661. self.loading("show");
  662. },
  663. complete:function(){
  664. self.loading("hide");
  665. }
  666. });
  667. },
  668. //복약정보 조회
  669. getDrugInfo : function(param, callback){
  670. $.ajax ({
  671. url : $serviceBaseUrl + "/medical/getDrugInfo.json",
  672. type : "POST",
  673. contentType: "application/json",
  674. data: JSON.stringify(param),
  675. success: function(response){
  676. if(response.result!=undefined){
  677. callback(response.result);
  678. }else{
  679. self.alert(response.msg);
  680. }
  681. },
  682. beforeSend: function(){
  683. self.loading("show");
  684. },
  685. complete:function(){
  686. self.loading("hide");
  687. }
  688. });
  689. },
  690. //복약정보 조회
  691. getDrugDetail : function(param, callback){
  692. $.ajax ({
  693. url : $serviceBaseUrl + "/medical/getDrugDetail.json",
  694. type : "POST",
  695. contentType: "application/json",
  696. data: JSON.stringify(param),
  697. success: function(response){
  698. if(response.result!=undefined){
  699. callback(response.result);
  700. }else{
  701. self.alert(response.msg);
  702. }
  703. },
  704. beforeSend: function(){
  705. self.loading("show");
  706. },
  707. complete:function(){
  708. self.loading("hide");
  709. }
  710. });
  711. },
  712. //검사결과 접수부서 리스트 조회
  713. getExamReceiptDeptList : function(param, callback){
  714. $.ajax ({
  715. url : $serviceBaseUrl + "/medical/getExamReceiptDeptList.json",
  716. type : "POST",
  717. contentType: "application/json",
  718. data: JSON.stringify(param),
  719. success: function(response){
  720. if(response.result!=undefined){
  721. callback(response.result);
  722. }else{
  723. self.alert(response.msg);
  724. }
  725. },
  726. beforeSend: function(){
  727. self.loading("show");
  728. },
  729. complete:function(){
  730. self.loading("hide");
  731. }
  732. });
  733. },
  734. //검사결과 리스트 조회
  735. getExamList : function(param, callback){
  736. $.ajax ({
  737. url : $serviceBaseUrl + "/medical/getExamList.json",
  738. type : "POST",
  739. contentType: "application/json",
  740. data: JSON.stringify(param),
  741. success: function(response){
  742. if(response.result!=undefined){
  743. callback(response.result);
  744. }else{
  745. self.alert(response.msg);
  746. }
  747. },
  748. beforeSend: function(){
  749. self.loading("show");
  750. },
  751. complete:function(){
  752. self.loading("hide");
  753. }
  754. });
  755. },
  756. //검사결과 상세 조회 - 검체검사
  757. getExamRsltTy1 : function(param, callback){
  758. $.ajax ({
  759. url : $serviceBaseUrl + "/medical/getExamRsltTy1.json",
  760. type : "POST",
  761. contentType: "application/json",
  762. data: JSON.stringify(param),
  763. success: function(response){
  764. if(response.result!=undefined){
  765. callback(response.result);
  766. }else{
  767. self.alert(response.msg);
  768. }
  769. },
  770. beforeSend: function(){
  771. self.loading("show");
  772. },
  773. complete:function(){
  774. self.loading("hide");
  775. }
  776. });
  777. },
  778. //검사결과 상세 조회 - 판독결과
  779. getExamRsltTy2 : function(param, callback){
  780. $.ajax ({
  781. url : $serviceBaseUrl + "/medical/getExamRsltTy2.json",
  782. type : "POST",
  783. contentType: "application/json",
  784. data: JSON.stringify(param),
  785. success: function(response){
  786. if(response.result!=undefined){
  787. callback(response.result);
  788. }else{
  789. self.alert(response.msg);
  790. }
  791. },
  792. beforeSend: function(){
  793. self.loading("show");
  794. },
  795. complete:function(){
  796. self.loading("hide");
  797. }
  798. });
  799. },
  800. //수술 이력 목록 조회
  801. getOpDetailHistoryList : function(param, callback){
  802. $.ajax ({
  803. url : $serviceBaseUrl + "/medical/getOpDetailHistoryList.json",
  804. type : "POST",
  805. contentType: "application/json",
  806. data: JSON.stringify(param),
  807. success: function(response){
  808. if(response.result!=undefined){
  809. callback(response.result);
  810. }else{
  811. self.alert(response.msg);
  812. }
  813. },
  814. beforeSend: function(){
  815. self.loading("show");
  816. },
  817. complete:function(){
  818. self.loading("hide");
  819. }
  820. });
  821. },
  822. //수술 상세 조회
  823. getOperationDetail : function(param, callback){
  824. $.ajax ({
  825. url : $serviceBaseUrl + "/medical/getOperationDetail.json",
  826. type : "POST",
  827. contentType: "application/json",
  828. data: JSON.stringify(param),
  829. success: function(response){
  830. if(response.result!=undefined){
  831. callback(response.result);
  832. }else{
  833. self.alert(response.msg);
  834. }
  835. },
  836. beforeSend: function(){
  837. self.loading("show");
  838. },
  839. complete:function(){
  840. self.loading("hide");
  841. }
  842. });
  843. },
  844. //시술 이력 목록 조회
  845. getTrDetailHistoryList : function(param, callback){
  846. $.ajax ({
  847. url : $serviceBaseUrl + "/medical/getTrDetailHistoryList.json",
  848. type : "POST",
  849. contentType: "application/json",
  850. data: JSON.stringify(param),
  851. success: function(response){
  852. if(response.result!=undefined){
  853. callback(response.result);
  854. }else{
  855. self.alert(response.msg);
  856. }
  857. },
  858. beforeSend: function(){
  859. self.loading("show");
  860. },
  861. complete:function(){
  862. self.loading("hide");
  863. }
  864. });
  865. },
  866. //시술 상세 조회
  867. getTreatmentDetail : function(param, callback){
  868. $.ajax ({
  869. url : $serviceBaseUrl + "/medical/getTreatmentDetail.json",
  870. type : "POST",
  871. contentType: "application/json",
  872. data: JSON.stringify(param),
  873. success: function(response){
  874. if(response.result!=undefined){
  875. callback(response.result);
  876. }else{
  877. self.alert(response.msg);
  878. }
  879. },
  880. beforeSend: function(){
  881. self.loading("show");
  882. },
  883. complete:function(){
  884. self.loading("hide");
  885. }
  886. });
  887. },
  888. //협진 이력 목록 조회
  889. getCoDetailHistoryList : function(param, callback){
  890. $.ajax ({
  891. url : $serviceBaseUrl + "/medical/getCoDetailHistoryList.json",
  892. type : "POST",
  893. contentType: "application/json",
  894. data: JSON.stringify(param),
  895. success: function(response){
  896. if(response.result!=undefined){
  897. callback(response.result);
  898. }else{
  899. self.alert(response.msg);
  900. }
  901. },
  902. beforeSend: function(){
  903. self.loading("show");
  904. },
  905. complete:function(){
  906. self.loading("hide");
  907. }
  908. });
  909. },
  910. //협진 상세 조회
  911. getCollaborationDetail : function(param, callback){
  912. $.ajax ({
  913. url : $serviceBaseUrl + "/medical/getCollaborationDetail.json",
  914. type : "POST",
  915. contentType: "application/json",
  916. data: JSON.stringify(param),
  917. success: function(response){
  918. if(response.result!=undefined){
  919. callback(response.result);
  920. }else{
  921. self.alert(response.msg);
  922. }
  923. },
  924. beforeSend: function(){
  925. self.loading("show");
  926. },
  927. complete:function(){
  928. self.loading("hide");
  929. }
  930. });
  931. },
  932. //진료 기록 목록 조회
  933. getMediRecordList : function(param, callback){
  934. $.ajax ({
  935. url : $serviceBaseUrl + "/medical/getMediRecordList.json",
  936. type : "POST",
  937. contentType: "application/json",
  938. data: JSON.stringify(param),
  939. success: function(response){
  940. if(response.result!=undefined){
  941. callback(response.result);
  942. }else{
  943. self.alert(response.msg);
  944. }
  945. },
  946. beforeSend: function(){
  947. self.loading("show");
  948. },
  949. complete:function(){
  950. self.loading("hide");
  951. }
  952. });
  953. },
  954. //진료기록서식코드조회
  955. getMediRecordFormList : function(param, callback){
  956. $.ajax ({
  957. url : $serviceBaseUrl + "/medical/getMediRecordFormList.json",
  958. type : "POST",
  959. contentType: "application/json",
  960. data: JSON.stringify(param),
  961. success: function(response){
  962. if(response.result!=undefined){
  963. callback(response.result);
  964. }else{
  965. self.alert(response.msg);
  966. }
  967. },
  968. beforeSend: function(){
  969. self.loading("show");
  970. },
  971. complete:function(){
  972. self.loading("hide");
  973. }
  974. });
  975. },
  976. //진료 기록 상세 조회
  977. getMediRecordDetail : function(param, callback){
  978. $.ajax ({
  979. url : $serviceBaseUrl + "/medical/getMediRecordDetail.json",
  980. type : "POST",
  981. contentType: "application/json",
  982. data: JSON.stringify(param),
  983. success: function(response){
  984. if(response.result!=undefined){
  985. callback(response.result);
  986. }else{
  987. self.alert(response.msg);
  988. }
  989. },
  990. beforeSend: function(){
  991. self.loading("show");
  992. },
  993. complete:function(){
  994. self.loading("hide");
  995. }
  996. });
  997. },
  998. //진료 기록 내용 상세 조회
  999. getMediRecordContentDetail : function(param, callback){
  1000. $.ajax ({
  1001. url : $serviceBaseUrl + "/medical/getMediRecordContentDetail.json",
  1002. type : "POST",
  1003. contentType: "application/json",
  1004. data: JSON.stringify(param),
  1005. success: function(response){
  1006. if(response.result!=undefined){
  1007. callback(response.result);
  1008. }else{
  1009. self.alert(response.msg);
  1010. }
  1011. },
  1012. beforeSend: function(){
  1013. self.loading("show");
  1014. },
  1015. complete:function(){
  1016. self.loading("hide");
  1017. }
  1018. });
  1019. },
  1020. //임상관찰 조회
  1021. getVitalList : function(param, callback){
  1022. $.ajax ({
  1023. url : $serviceBaseUrl + "/medical/getVitalList.json",
  1024. type : "POST",
  1025. contentType: "application/json",
  1026. data: JSON.stringify(param),
  1027. success: function(response){
  1028. if(response.result!=undefined){
  1029. callback(response.result);
  1030. }else{
  1031. self.alert(response.msg);
  1032. }
  1033. },
  1034. beforeSend: function(){
  1035. self.loading("show");
  1036. },
  1037. complete:function(){
  1038. self.loading("hide");
  1039. }
  1040. });
  1041. },
  1042. //임상관찰 IO합계 조회
  1043. getVitalListSum : function(param, callback){
  1044. $.ajax ({
  1045. url : $serviceBaseUrl + "/medical/getVitalListSum.json",
  1046. type : "POST",
  1047. contentType: "application/json",
  1048. data: JSON.stringify(param),
  1049. success: function(response){
  1050. if(response.result!=undefined){
  1051. callback(response.result);
  1052. }else{
  1053. self.alert(response.msg);
  1054. }
  1055. },
  1056. beforeSend: function(){
  1057. self.loading("show");
  1058. },
  1059. complete:function(){
  1060. self.loading("hide");
  1061. }
  1062. });
  1063. },
  1064. //임상관찰 IO합계 조회
  1065. getVitalListSum2 : function(param, callback){
  1066. $.ajax ({
  1067. url : $serviceBaseUrl + "/medical/getVitalListSum2.json",
  1068. type : "POST",
  1069. contentType: "application/json",
  1070. data: JSON.stringify(param),
  1071. success: function(response){
  1072. if(response.result!=undefined){
  1073. callback(response.result);
  1074. }else{
  1075. self.alert(response.msg);
  1076. }
  1077. },
  1078. beforeSend: function(){
  1079. self.loading("show");
  1080. },
  1081. complete:function(){
  1082. self.loading("hide");
  1083. }
  1084. });
  1085. },
  1086. //투약실시 내역 조회
  1087. getMedicationList : function(param, callback){
  1088. $.ajax ({
  1089. url : $serviceBaseUrl + "/medical/getMedicationList.json",
  1090. type : "POST",
  1091. contentType: "application/json",
  1092. data: JSON.stringify(param),
  1093. success: function(response){
  1094. if(response.result!=undefined){
  1095. callback(response.result);
  1096. }else{
  1097. self.alert(response.msg);
  1098. }
  1099. },
  1100. beforeSend: function(){
  1101. self.loading("show");
  1102. },
  1103. complete:function(){
  1104. self.loading("hide");
  1105. }
  1106. });
  1107. },
  1108. //임상관찰 등록
  1109. inputVital : function(param, callback){
  1110. $.ajax ({
  1111. url : $serviceBaseUrl + "/medical/inputVital.json",
  1112. type : "POST",
  1113. contentType: "application/json",
  1114. data: JSON.stringify(param),
  1115. success: function(response){
  1116. if(response.result!=undefined){
  1117. callback(response.result);
  1118. }else{
  1119. self.alert(response.msg);
  1120. }
  1121. },
  1122. beforeSend: function(){
  1123. self.loading("show");
  1124. },
  1125. complete:function(){
  1126. self.loading("hide");
  1127. }
  1128. });
  1129. },
  1130. //환자의 마지막 임상관찰 조회
  1131. getVitalByLast : function(param, callback){
  1132. $.ajax ({
  1133. url : $serviceBaseUrl + "/medical/getVitalByLast.json",
  1134. type : "POST",
  1135. contentType: "application/json",
  1136. data: JSON.stringify(param),
  1137. success: function(response){
  1138. if(response.result!=undefined){
  1139. callback(response.result);
  1140. }else{
  1141. self.alert(response.msg);
  1142. }
  1143. },
  1144. beforeSend: function(){
  1145. self.loading("show");
  1146. },
  1147. complete:function(){
  1148. self.loading("hide");
  1149. }
  1150. });
  1151. },
  1152. //환부이미지 전송
  1153. inputWoundImg : function(param, callback){
  1154. $.ajax ({
  1155. url : $serviceBaseUrl + "/medical/inputWoundImg.json",
  1156. type : "POST",
  1157. contentType: "application/json",
  1158. data: JSON.stringify(param),
  1159. success: function(response){
  1160. if(response.result!=undefined){
  1161. callback(response.result);
  1162. }else{
  1163. self.alert(response.msg);
  1164. }
  1165. },
  1166. beforeSend: function(){
  1167. self.loading("show");
  1168. },
  1169. complete:function(){
  1170. self.loading("hide");
  1171. }
  1172. });
  1173. },
  1174. /* 진료-환자검색 --------------------------------------------------------------------- */
  1175. //사용자의 진료과 리스트 조회 - 입원, 외래, 응급, 수술, 시술, 협진
  1176. getDeptList : function(param, callback){
  1177. $.ajax ({
  1178. url : $serviceBaseUrl + "/medical/getDeptList.json",
  1179. type : "POST",
  1180. contentType: "application/json",
  1181. data: JSON.stringify(param),
  1182. success: function(response){
  1183. if(response.result!=undefined){
  1184. callback(response.result);
  1185. }else{
  1186. self.alert(response.msg);
  1187. }
  1188. },
  1189. beforeSend: function(){
  1190. self.loading("show");
  1191. },
  1192. complete:function(){
  1193. self.loading("hide");
  1194. }
  1195. });
  1196. },
  1197. //진료과의 진료의 리스트 조회 - 입원, 외래, 수술, 시술, 협진
  1198. getDoctorListByDept : function(param, callback){
  1199. $.ajax ({
  1200. url : $serviceBaseUrl + "/medical/getDoctorListByDept.json",
  1201. type : "POST",
  1202. contentType: "application/json",
  1203. data: JSON.stringify(param),
  1204. success: function(response){
  1205. if(response.result!=undefined){
  1206. callback(response.result);
  1207. }else{
  1208. self.alert(response.msg);
  1209. }
  1210. },
  1211. beforeSend: function(){
  1212. self.loading("show");
  1213. },
  1214. complete:function(){
  1215. self.loading("hide");
  1216. }
  1217. });
  1218. },
  1219. //사용자의 병동 리스트 조회
  1220. getWardList : function(param, callback){
  1221. $.ajax ({
  1222. url : $serviceBaseUrl + "/medical/getWardList.json",
  1223. type : "POST",
  1224. contentType: "application/json",
  1225. data: JSON.stringify(param),
  1226. success: function(response){
  1227. if(response.result!=undefined){
  1228. callback(response.result);
  1229. }else{
  1230. self.alert(response.msg);
  1231. }
  1232. },
  1233. beforeSend: function(){
  1234. self.loading("show");
  1235. },
  1236. complete:function(){
  1237. self.loading("hide");
  1238. }
  1239. });
  1240. },
  1241. //병동의 병실 리스트 조회
  1242. getRoomListByWard : function(param, callback){
  1243. $.ajax ({
  1244. url : $serviceBaseUrl + "/medical/getRoomListByWard.json",
  1245. type : "POST",
  1246. contentType: "application/json",
  1247. data: JSON.stringify(param),
  1248. success: function(response){
  1249. if(response.result!=undefined){
  1250. callback(response.result);
  1251. }else{
  1252. self.alert(response.msg);
  1253. }
  1254. },
  1255. beforeSend: function(){
  1256. self.loading("show");
  1257. },
  1258. complete:function(){
  1259. self.loading("hide");
  1260. }
  1261. });
  1262. },
  1263. //입원환자 검색
  1264. getInPatientList : function(param, callback){
  1265. $.ajax ({
  1266. url : $serviceBaseUrl + "/medical/getInPatientList.json",
  1267. type : "POST",
  1268. contentType: "application/json",
  1269. data: JSON.stringify(param),
  1270. success: function(response){
  1271. if(response.result!=undefined){
  1272. callback(response.result);
  1273. }else{
  1274. self.alert(response.msg);
  1275. }
  1276. },
  1277. beforeSend: function(){
  1278. self.loading("show");
  1279. },
  1280. complete:function(){
  1281. self.loading("hide");
  1282. }
  1283. });
  1284. },
  1285. //외래 진료 상태 리스트 조회
  1286. getOutTreatStatList : function(param, callback){
  1287. $.ajax ({
  1288. url : $serviceBaseUrl + "/medical/getOutTreatStatList.json",
  1289. type : "POST",
  1290. contentType: "application/json",
  1291. data: JSON.stringify(param),
  1292. success: function(response){
  1293. if(response.result!=undefined){
  1294. callback(response.result);
  1295. }else{
  1296. self.alert(response.msg);
  1297. }
  1298. },
  1299. beforeSend: function(){
  1300. self.loading("show");
  1301. },
  1302. complete:function(){
  1303. self.loading("hide");
  1304. }
  1305. });
  1306. },
  1307. //외래환자 검색
  1308. getOutPatientList : function(param, callback){
  1309. $.ajax ({
  1310. url : $serviceBaseUrl + "/medical/getOutPatientList.json",
  1311. type : "POST",
  1312. contentType: "application/json",
  1313. data: JSON.stringify(param),
  1314. success: function(response){
  1315. if(response.result!=undefined){
  1316. callback(response.result);
  1317. }else{
  1318. self.alert(response.msg);
  1319. }
  1320. },
  1321. beforeSend: function(){
  1322. self.loading("show");
  1323. },
  1324. complete:function(){
  1325. self.loading("hide");
  1326. }
  1327. });
  1328. },
  1329. //응급환자 상태 리스트 조회
  1330. getEmTreatStatList : function(param, callback){
  1331. $.ajax ({
  1332. url : $serviceBaseUrl + "/medical/getEmTreatStatList.json",
  1333. type : "POST",
  1334. contentType: "application/json",
  1335. data: JSON.stringify(param),
  1336. success: function(response){
  1337. if(response.result!=undefined){
  1338. callback(response.result);
  1339. }else{
  1340. self.alert(response.msg);
  1341. }
  1342. },
  1343. beforeSend: function(){
  1344. self.loading("show");
  1345. },
  1346. complete:function(){
  1347. self.loading("hide");
  1348. }
  1349. });
  1350. },
  1351. //응급환자 검색
  1352. getEmPatientList : function(param, callback){
  1353. $.ajax ({
  1354. url : $serviceBaseUrl + "/medical/getEmPatientList.json",
  1355. type : "POST",
  1356. contentType: "application/json",
  1357. data: JSON.stringify(param),
  1358. success: function(response){
  1359. if(response.result!=undefined){
  1360. callback(response.result);
  1361. }else{
  1362. self.alert(response.msg);
  1363. }
  1364. },
  1365. beforeSend: function(){
  1366. self.loading("show");
  1367. },
  1368. complete:function(){
  1369. self.loading("hide");
  1370. }
  1371. });
  1372. },
  1373. //수술실 리스트 조회
  1374. getOperationCntrList : function(param, callback){
  1375. $.ajax ({
  1376. url : $serviceBaseUrl + "/medical/getOperationCntrList.json",
  1377. type : "POST",
  1378. contentType: "application/json",
  1379. data: JSON.stringify(param),
  1380. success: function(response){
  1381. if(response.result!=undefined){
  1382. callback(response.result);
  1383. }else{
  1384. self.alert(response.msg);
  1385. }
  1386. },
  1387. beforeSend: function(){
  1388. self.loading("show");
  1389. },
  1390. complete:function(){
  1391. self.loading("hide");
  1392. }
  1393. });
  1394. },
  1395. //수술실의 수술방 리스트 조회
  1396. getOperationRoomList : function(param, callback){
  1397. $.ajax ({
  1398. url : $serviceBaseUrl + "/medical/getOperationRoomList.json",
  1399. type : "POST",
  1400. contentType: "application/json",
  1401. data: JSON.stringify(param),
  1402. success: function(response){
  1403. if(response.result!=undefined){
  1404. callback(response.result);
  1405. }else{
  1406. self.alert(response.msg);
  1407. }
  1408. },
  1409. beforeSend: function(){
  1410. self.loading("show");
  1411. },
  1412. complete:function(){
  1413. self.loading("hide");
  1414. }
  1415. });
  1416. },
  1417. //수술 진행 상태 리스트 조회
  1418. getOperationStatList : function(param, callback){
  1419. $.ajax ({
  1420. url : $serviceBaseUrl + "/medical/getOperationStatList.json",
  1421. type : "POST",
  1422. contentType: "application/json",
  1423. data: JSON.stringify(param),
  1424. success: function(response){
  1425. if(response.result!=undefined){
  1426. callback(response.result);
  1427. }else{
  1428. self.alert(response.msg);
  1429. }
  1430. },
  1431. beforeSend: function(){
  1432. self.loading("show");
  1433. },
  1434. complete:function(){
  1435. self.loading("hide");
  1436. }
  1437. });
  1438. },
  1439. //수술환자 검색
  1440. getOpPatientList : function(param, callback){
  1441. $.ajax ({
  1442. url : $serviceBaseUrl + "/medical/getOpPatientList.json",
  1443. type : "POST",
  1444. contentType: "application/json",
  1445. data: JSON.stringify(param),
  1446. success: function(response){
  1447. if(response.result!=undefined){
  1448. callback(response.result);
  1449. }else{
  1450. self.alert(response.msg);
  1451. }
  1452. },
  1453. beforeSend: function(){
  1454. self.loading("show");
  1455. },
  1456. complete:function(){
  1457. self.loading("hide");
  1458. }
  1459. });
  1460. },
  1461. //시술실 리스트 조회
  1462. getTreatmentCntrList : function(param, callback){
  1463. $.ajax ({
  1464. url : $serviceBaseUrl + "/medical/getTreatmentCntrList.json",
  1465. type : "POST",
  1466. contentType: "application/json",
  1467. data: JSON.stringify(param),
  1468. success: function(response){
  1469. if(response.result!=undefined){
  1470. callback(response.result);
  1471. }else{
  1472. self.alert(response.msg);
  1473. }
  1474. },
  1475. beforeSend: function(){
  1476. self.loading("show");
  1477. },
  1478. complete:function(){
  1479. self.loading("hide");
  1480. }
  1481. });
  1482. },
  1483. //시술 진행 상태 리스트 조회
  1484. getTreatmentStatList : function(param, callback){
  1485. $.ajax ({
  1486. url : $serviceBaseUrl + "/medical/getTreatmentStatList.json",
  1487. type : "POST",
  1488. contentType: "application/json",
  1489. data: JSON.stringify(param),
  1490. success: function(response){
  1491. if(response.result!=undefined){
  1492. callback(response.result);
  1493. }else{
  1494. self.alert(response.msg);
  1495. }
  1496. },
  1497. beforeSend: function(){
  1498. self.loading("show");
  1499. },
  1500. complete:function(){
  1501. self.loading("hide");
  1502. }
  1503. });
  1504. },
  1505. //시술환자 검색
  1506. getTrPatientList : function(param, callback){
  1507. $.ajax ({
  1508. url : $serviceBaseUrl + "/medical/getTrPatientList.json",
  1509. type : "POST",
  1510. contentType: "application/json",
  1511. data: JSON.stringify(param),
  1512. success: function(response){
  1513. if(response.result!=undefined){
  1514. callback(response.result);
  1515. }else{
  1516. self.alert(response.msg);
  1517. }
  1518. },
  1519. beforeSend: function(){
  1520. self.loading("show");
  1521. },
  1522. complete:function(){
  1523. self.loading("hide");
  1524. }
  1525. });
  1526. },
  1527. //협진환자 검색
  1528. getCoPatientList : function(param, callback){
  1529. $.ajax ({
  1530. url : $serviceBaseUrl + "/medical/getCoPatientList.json",
  1531. type : "POST",
  1532. contentType: "application/json",
  1533. data: JSON.stringify(param),
  1534. success: function(response){
  1535. if(response.result!=undefined){
  1536. callback(response.result);
  1537. }else{
  1538. self.alert(response.msg);
  1539. }
  1540. },
  1541. beforeSend: function(){
  1542. self.loading("show");
  1543. },
  1544. complete:function(){
  1545. self.loading("hide");
  1546. }
  1547. });
  1548. },
  1549. //바코드환자 검색
  1550. getBarPatientList : function(param, callback){
  1551. $.ajax ({
  1552. url : $serviceBaseUrl + "/medical/getBarPatientList.json",
  1553. type : "POST",
  1554. contentType: "application/json",
  1555. data: JSON.stringify(param),
  1556. success: function(response){
  1557. if(response.result!=undefined){
  1558. callback(response.result);
  1559. }else{
  1560. self.alert(response.msg);
  1561. }
  1562. },
  1563. beforeSend: function(){
  1564. self.loading("show");
  1565. },
  1566. complete:function(){
  1567. self.loading("hide");
  1568. }
  1569. });
  1570. },
  1571. //QR코드 환자 검색
  1572. getQrPatientList : function(param, callback){
  1573. $.ajax ({
  1574. url : $serviceBaseUrl + "/medical/getQrPatientList.json",
  1575. type : "POST",
  1576. contentType: "application/json",
  1577. data: JSON.stringify(param),
  1578. success: function(response){
  1579. if(response.result!=undefined){
  1580. callback(response.result);
  1581. }else{
  1582. self.alert(response.msg);
  1583. }
  1584. },
  1585. beforeSend: function(){
  1586. self.loading("show");
  1587. },
  1588. complete:function(){
  1589. self.loading("hide");
  1590. }
  1591. });
  1592. },
  1593. //NFC 환자 검색
  1594. getNfcPatientList : function(param, callback){
  1595. $.ajax ({
  1596. url : $serviceBaseUrl + "/medical/getNfcPatientList.json",
  1597. type : "POST",
  1598. contentType: "application/json",
  1599. data: JSON.stringify(param),
  1600. success: function(response){
  1601. if(response.result!=undefined){
  1602. callback(response.result);
  1603. }else{
  1604. self.alert(response.msg);
  1605. }
  1606. },
  1607. beforeSend: function(){
  1608. self.loading("show");
  1609. },
  1610. complete:function(){
  1611. self.loading("hide");
  1612. }
  1613. });
  1614. },
  1615. /* 진료-환자정보 --------------------------------------------------------------------- */
  1616. //환자정보(or 진료서비스) 접근 권한 체크
  1617. checkAccessRights : function(param, callback){
  1618. $.ajax ({
  1619. url : $serviceBaseUrl + "/medical/checkAccessRights.json",
  1620. type : "POST",
  1621. contentType: "application/json",
  1622. data: JSON.stringify(param),
  1623. success: function(response){
  1624. if(response.result!=undefined){
  1625. callback(response.result);
  1626. }else{
  1627. self.alert(response.msg);
  1628. }
  1629. },
  1630. beforeSend: function(){
  1631. self.loading("show");
  1632. },
  1633. complete:function(){
  1634. self.loading("hide");
  1635. }
  1636. });
  1637. },
  1638. //환자정보 조회
  1639. getPatientInfo : function(param, callback){
  1640. $.ajax ({
  1641. url : $serviceBaseUrl + "/medical/getPatientInfo.json",
  1642. type : "POST",
  1643. contentType: "application/json",
  1644. data: JSON.stringify(param),
  1645. success: function(response){
  1646. if(response.result!=undefined){
  1647. callback(response.result);
  1648. }else{
  1649. self.alert(response.msg);
  1650. }
  1651. },
  1652. beforeSend: function(){
  1653. self.loading("show");
  1654. },
  1655. complete:function(){
  1656. self.loading("hide");
  1657. }
  1658. });
  1659. },
  1660. //환자용 notice 조회
  1661. getPatientNotice : function(param, callback){
  1662. $.ajax ({
  1663. url : $serviceBaseUrl + "/medical/getPatientNotice.json",
  1664. type : "POST",
  1665. contentType: "application/json",
  1666. data: JSON.stringify(param),
  1667. success: function(response){
  1668. if(response.result!=undefined){
  1669. callback(response.result);
  1670. }else{
  1671. self.alert(response.msg);
  1672. }
  1673. },
  1674. beforeSend: function(){
  1675. self.loading("show");
  1676. },
  1677. complete:function(){
  1678. self.loading("hide");
  1679. }
  1680. });
  1681. }
  1682. };
  1683. this.safety = {
  1684. //환자안전관리 투약리스트
  1685. getInjectionList : function(param, callback){
  1686. $.ajax ({
  1687. url : $serviceBaseUrl + "/safety/getInjectionList.json",
  1688. type : "POST",
  1689. contentType: "application/json",
  1690. data: JSON.stringify(param),
  1691. success: function(response){
  1692. if(response.result!=undefined){
  1693. callback(response.result);
  1694. }else{
  1695. self.alert(response.msg);
  1696. }
  1697. },
  1698. beforeSend: function(){
  1699. self.loading("show");
  1700. },
  1701. complete:function(){
  1702. self.loading("hide");
  1703. }
  1704. });
  1705. },
  1706. //환자안전관리 투약실시
  1707. inputInjection : function(param, callback){
  1708. $.ajax ({
  1709. url : $serviceBaseUrl + "/safety/inputInjection.json",
  1710. type : "POST",
  1711. contentType: "application/json",
  1712. data: JSON.stringify(param),
  1713. success: function(response){
  1714. if(response.result!=undefined){
  1715. callback(response.result);
  1716. }else{
  1717. self.alert(response.msg);
  1718. }
  1719. },
  1720. beforeSend: function(){
  1721. self.loading("show");
  1722. },
  1723. complete:function(){
  1724. self.loading("hide");
  1725. }
  1726. });
  1727. } ,
  1728. //환자안전관리 IVF 처리
  1729. getInfusionList : function(param, callback){
  1730. $.ajax ({
  1731. url : $serviceBaseUrl + "/safety/getInfusionList.json",
  1732. type : "POST",
  1733. contentType: "application/json",
  1734. data: JSON.stringify(param),
  1735. success: function(response){
  1736. if(response.result!=undefined){
  1737. callback(response.result);
  1738. }else{
  1739. self.alert(response.msg);
  1740. }
  1741. },
  1742. beforeSend: function(){
  1743. self.loading("show");
  1744. },
  1745. complete:function(){
  1746. self.loading("hide");
  1747. }
  1748. });
  1749. },
  1750. //환자안전관리 IVF 실시
  1751. inputStartInfusion: function(param, callback){
  1752. $.ajax ({
  1753. url : $serviceBaseUrl + "/safety/inputStartInfusion.json",
  1754. type : "POST",
  1755. contentType: "application/json",
  1756. data: JSON.stringify(param),
  1757. success: function(response){
  1758. if(response.result!=undefined){
  1759. callback(response.result);
  1760. }else{
  1761. self.alert(response.msg);
  1762. }
  1763. },
  1764. beforeSend: function(){
  1765. self.loading("show");
  1766. },
  1767. complete:function(){
  1768. self.loading("hide");
  1769. }
  1770. });
  1771. } ,
  1772. //환자안전관리 IVF 종료
  1773. inputEndInfusion : function(param, callback){
  1774. $.ajax ({
  1775. url : $serviceBaseUrl + "/safety/inputEndInfusion.json",
  1776. type : "POST",
  1777. contentType: "application/json",
  1778. data: JSON.stringify(param),
  1779. success: function(response){
  1780. if(response.result!=undefined){
  1781. callback(response.result);
  1782. }else{
  1783. self.alert(response.msg);
  1784. }
  1785. },
  1786. beforeSend: function(){
  1787. self.loading("show");
  1788. },
  1789. complete:function(){
  1790. self.loading("hide");
  1791. }
  1792. });
  1793. },
  1794. //환자안전관리 체혈 리스트
  1795. getSpecimenList : function(param, checkYn, callback){
  1796. $.ajax ({
  1797. url : $serviceBaseUrl + "/safety/getSpecimenList.json",
  1798. type : "POST",
  1799. contentType: "application/json",
  1800. data: JSON.stringify(param),
  1801. success: function(response){
  1802. if(response.result!=undefined){
  1803. callback(checkYn, response.result);
  1804. }else{
  1805. self.alert(response.msg);
  1806. }
  1807. },
  1808. beforeSend: function(){
  1809. self.loading("show");
  1810. },
  1811. complete:function(){
  1812. self.loading("hide");
  1813. }
  1814. });
  1815. },
  1816. //환자안전관리 체혈 실시
  1817. actSpecimen : function(param){
  1818. var result = "";
  1819. $.ajax ({
  1820. url : $serviceBaseUrl + "/safety/actSpecimen.json",
  1821. type : "POST",
  1822. contentType: "application/json",
  1823. async: false,
  1824. data: JSON.stringify(param),
  1825. success: function(response){
  1826. // if(response.result!=undefined){
  1827. // callback(response.result);
  1828. // }else{
  1829. // self.alert(response.msg);
  1830. // }
  1831. // var returnCd = "";
  1832. // if (response.result == undefined) {
  1833. // returnCd = "0001";
  1834. // } else {
  1835. // returnCd = response.result[0].returnCd;
  1836. // }
  1837. //
  1838. // callback(returnCd, size, key);
  1839. if (response.result == undefined) {
  1840. result = "failed";
  1841. } else if (response.result.length == 0) {
  1842. result = "failed";
  1843. } else {
  1844. if (response.result[0].returnCd == "0000") {
  1845. result = "success";
  1846. } else {
  1847. result = "failed";
  1848. }
  1849. }
  1850. },
  1851. beforeSend: function(){
  1852. self.loading("show");
  1853. },
  1854. complete:function(){
  1855. self.loading("hide");
  1856. },
  1857. error: function (XHR, textStatus, errorThrown) {
  1858. self.loading("hide");
  1859. result = "failed";
  1860. }
  1861. });
  1862. return result;
  1863. } ,
  1864. //환자안전관리 혈액신청 리스트
  1865. getBloodRequestList : function(param, callback){
  1866. $.ajax ({
  1867. url : $serviceBaseUrl + "/safety/getBloodRequestList.json",
  1868. type : "POST",
  1869. contentType: "application/json",
  1870. data: JSON.stringify(param),
  1871. success: function(response){
  1872. if(response.result!=undefined){
  1873. callback(response.result);
  1874. }else{
  1875. self.alert(response.msg);
  1876. }
  1877. },
  1878. beforeSend: function(){
  1879. self.loading("show");
  1880. },
  1881. complete:function(){
  1882. self.loading("hide");
  1883. }
  1884. });
  1885. },
  1886. //환자안전관리 혈액신청
  1887. inputBloodRequest: function(param, callback){
  1888. $.ajax ({
  1889. url : $serviceBaseUrl + "/safety/inputBloodRequest.json",
  1890. type : "POST",
  1891. contentType: "application/json",
  1892. data: JSON.stringify(param),
  1893. success: function(response){
  1894. if(response.result!=undefined){
  1895. callback(response.result);
  1896. }else{
  1897. self.alert(response.msg);
  1898. }
  1899. },
  1900. beforeSend: function(){
  1901. self.loading("show");
  1902. },
  1903. complete:function(){
  1904. self.loading("hide");
  1905. }
  1906. });
  1907. } ,
  1908. //환자안전관리 혈액 수령 리스트
  1909. getBloodReceiveList : function(param, callback){
  1910. $.ajax ({
  1911. url : $serviceBaseUrl + "/safety/getBloodReceiveList.json",
  1912. type : "POST",
  1913. contentType: "application/json",
  1914. data: JSON.stringify(param),
  1915. success: function(response){
  1916. if(response.result!=undefined){
  1917. callback(response.result);
  1918. }else{
  1919. self.alert(response.msg);
  1920. }
  1921. },
  1922. beforeSend: function(){
  1923. self.loading("show");
  1924. },
  1925. complete:function(){
  1926. self.loading("hide");
  1927. }
  1928. });
  1929. },
  1930. //환자안전관리 혈액 수령
  1931. inputBloodReceive: function(param, callback){
  1932. $.ajax ({
  1933. url : $serviceBaseUrl + "/safety/inputBloodReceive.json",
  1934. type : "POST",
  1935. contentType: "application/json",
  1936. data: JSON.stringify(param),
  1937. success: function(response){
  1938. if(response.result!=undefined){
  1939. callback(response.result);
  1940. }else{
  1941. self.alert(response.msg);
  1942. }
  1943. },
  1944. beforeSend: function(){
  1945. self.loading("show");
  1946. },
  1947. complete:function(){
  1948. self.loading("hide");
  1949. }
  1950. });
  1951. } ,
  1952. // Mcare-Fatima 수혈 혈액정보 요청
  1953. getBloodCheckList : function(param, isSecondTrial, callback){
  1954. $.ajax ({
  1955. url : $serviceBaseUrl + "/safety/getBloodCheckList.json",
  1956. async : false,
  1957. type : "POST",
  1958. contentType: "application/json",
  1959. data: JSON.stringify(param),
  1960. success: function(response){
  1961. if(response.result!=undefined){
  1962. callback(isSecondTrial, response.result);
  1963. }else{
  1964. self.alert(response.msg);
  1965. }
  1966. },
  1967. beforeSend: function(){
  1968. self.loading("show");
  1969. },
  1970. complete:function(){
  1971. self.loading("hide");
  1972. }
  1973. });
  1974. },
  1975. // Mcare-Fatima 수혈 혈액 상세정보 요청
  1976. getBloodDetailInfo : function(param, index, callback){
  1977. $.ajax ({
  1978. url : $serviceBaseUrl + "/safety/getBloodDetailInfo.json",
  1979. type : "POST",
  1980. async : false,
  1981. contentType: "application/json",
  1982. data: JSON.stringify(param),
  1983. success: function(response){
  1984. if(response.result!=undefined){
  1985. callback(index, response.result);
  1986. }else{
  1987. self.alert(response.msg);
  1988. }
  1989. },
  1990. beforeSend: function(){
  1991. self.loading("show");
  1992. },
  1993. complete:function(){
  1994. self.loading("hide");
  1995. },
  1996. error: function (XHR, textStatus, errorThrown) {
  1997. self.alert("정보 조회에 실패하였습니다.");
  1998. self.loading("hide");
  1999. }
  2000. });
  2001. },
  2002. //환자안전관리 수혈확인
  2003. inputBloodCheck: function(param, callback){
  2004. $.ajax ({
  2005. url : $serviceBaseUrl + "/safety/inputBloodCheck.json",
  2006. type : "POST",
  2007. contentType: "application/json",
  2008. data: JSON.stringify(param),
  2009. success: function(response){
  2010. if(response.result!=undefined){
  2011. callback(response.result);
  2012. }else{
  2013. self.alert(response.msg);
  2014. }
  2015. },
  2016. beforeSend: function(){
  2017. self.loading("show");
  2018. },
  2019. complete:function(){
  2020. self.loading("hide");
  2021. }
  2022. });
  2023. } ,
  2024. //환자안전관리 혈액반납 리스트
  2025. getBloodCancelList : function(param, callback){
  2026. $.ajax ({
  2027. url : $serviceBaseUrl + "/safety/getBloodCancelList.json",
  2028. type : "POST",
  2029. contentType: "application/json",
  2030. data: JSON.stringify(param),
  2031. success: function(response){
  2032. if(response.result!=undefined){
  2033. callback(response.result);
  2034. }else{
  2035. self.alert(response.msg);
  2036. }
  2037. },
  2038. beforeSend: function(){
  2039. self.loading("show");
  2040. },
  2041. complete:function(){
  2042. self.loading("hide");
  2043. }
  2044. });
  2045. },
  2046. //환자안전관리 혈액 반납
  2047. inputBloodCancel: function(param, callback){
  2048. $.ajax ({
  2049. url : $serviceBaseUrl + "/safety/inputBloodCancel.json",
  2050. type : "POST",
  2051. contentType: "application/json",
  2052. data: JSON.stringify(param),
  2053. success: function(response){
  2054. if(response.result!=undefined){
  2055. callback(response.result);
  2056. }else{
  2057. self.alert(response.msg);
  2058. }
  2059. },
  2060. beforeSend: function(){
  2061. self.loading("show");
  2062. },
  2063. complete:function(){
  2064. self.loading("hide");
  2065. }
  2066. });
  2067. },
  2068. getAtcPrescriptionList: function(param, callback){
  2069. $.ajax ({
  2070. url : $serviceBaseUrl + "/safety/getAtcPrescriptionList.json",
  2071. type : "POST",
  2072. contentType: "application/json",
  2073. data: JSON.stringify(param),
  2074. success: function(response){
  2075. if(response.result!=undefined){
  2076. // callback(response.result);
  2077. callback(response.result);
  2078. }else{
  2079. // failCallback(param);
  2080. self.alert(response.msg);
  2081. }
  2082. },
  2083. beforeSend: function(){
  2084. self.loading("show");
  2085. },
  2086. complete:function(){
  2087. self.loading("hide");
  2088. }
  2089. });
  2090. },
  2091. // 환자안전관리 투약 처방 리스트
  2092. getPrescriptionList: function(param, checkYn, callback){
  2093. $.ajax ({
  2094. url : $serviceBaseUrl + "/safety/getPrescriptionList.json",
  2095. type : "POST",
  2096. contentType: "application/json",
  2097. data: JSON.stringify(param),
  2098. success: function(response){
  2099. if(response.result!=undefined){
  2100. callback(checkYn, response.result);
  2101. }else{
  2102. // failCallback(param);
  2103. self.alert(response.msg);
  2104. }
  2105. },
  2106. beforeSend: function(){
  2107. self.loading("show");
  2108. },
  2109. complete:function(){
  2110. self.loading("hide");
  2111. }
  2112. });
  2113. },
  2114. /**
  2115. * 대구파티마병원 NFC 태그 시 사용자 정보 호출
  2116. * @param {Object} param 전송될 파라미터
  2117. * @param {function} callback
  2118. */
  2119. getNfcDoctorId: function(param, callback){
  2120. $.ajax ({
  2121. url : $serviceBaseUrl + "/safety/getNfcDoctorId.json",
  2122. type : "POST",
  2123. contentType: "application/json",
  2124. data: JSON.stringify(param),
  2125. success: function(response){
  2126. if(response.result!=undefined){
  2127. callback(response.result);
  2128. }else{
  2129. self.alert(response.msg);
  2130. }
  2131. },
  2132. beforeSend: function(){
  2133. self.loading("show");
  2134. },
  2135. complete:function(){
  2136. self.loading("hide");
  2137. }
  2138. });
  2139. },
  2140. // 환자안전관리 환자 정보 공통
  2141. getPocPatientInfo: function(param, patientId, isSecondTrial, callback){
  2142. $.ajax ({
  2143. url : $serviceBaseUrl + "/safety/getPocPatientInfo.json",
  2144. type : "POST",
  2145. contentType: "application/json",
  2146. data: JSON.stringify(param),
  2147. success: function(response){
  2148. if(response.result!=undefined){
  2149. callback(response.result, patientId, isSecondTrial);
  2150. }else{
  2151. self.alert(response.msg);
  2152. }
  2153. },
  2154. beforeSend: function(){
  2155. self.loading("show");
  2156. },
  2157. complete:function(){
  2158. self.loading("hide");
  2159. },
  2160. error: function (XHR, textStatus, errorThrown) {
  2161. self.alert("정보 조회에 실패하였습니다.");
  2162. self.loading("hide");
  2163. }
  2164. });
  2165. },
  2166. // 환자안전관리 투약 실시
  2167. actMedication: function(param){
  2168. var result = "";
  2169. $.ajax ({
  2170. url : $serviceBaseUrl + "/safety/actMedication.json",
  2171. type : "POST",
  2172. contentType: "application/json",
  2173. data: JSON.stringify(param),
  2174. async: false,
  2175. success: function(response){
  2176. // console.log("response -- > " + JSON.stringify(response));
  2177. // if(response.result!=undefined){
  2178. // callback(response.result);
  2179. // }else{
  2180. // self.alert(response.msg);
  2181. // }
  2182. // var returnCd = "";
  2183. // if (response.result.length == 0) {
  2184. // result = "failed";
  2185. // } else if (response.result == undefined) {
  2186. // returnCd = "0001";
  2187. // } else {
  2188. // returnCd = response.result[0].returnCd;
  2189. // }
  2190. //
  2191. // callback(returnCd, size, key);
  2192. if (response.result == undefined) {
  2193. result = "failed";
  2194. } else if (response.result.length == 0) {
  2195. result = "failed";
  2196. } else {
  2197. if (response.result[0].returnCd == "0000") {
  2198. result = "success";
  2199. } else {
  2200. result = "failed";
  2201. }
  2202. }
  2203. },
  2204. beforeSend: function(){
  2205. self.loading("show");
  2206. },
  2207. complete:function(){
  2208. self.loading("hide");
  2209. },
  2210. error: function (XHR, textStatus, errorThrown) {
  2211. // self.alert("Error");
  2212. self.loading("hide");
  2213. result = "failed";
  2214. }
  2215. });
  2216. return result;
  2217. },
  2218. // 수혈 1단계 저장
  2219. inputCheckupId : function(param, callback, selectItem){
  2220. $.ajax ({
  2221. url : $serviceBaseUrl + "/safety/inputCheckupId.json",
  2222. type : "POST",
  2223. contentType: "application/json",
  2224. data: JSON.stringify(param),
  2225. success: function(response){
  2226. // if(response.result!=undefined){
  2227. // callback(response.result);
  2228. // }else{
  2229. // self.alert(response.msg);
  2230. // }
  2231. var returnCd = "";
  2232. if (response.result == undefined) {
  2233. returnCd = "0001";
  2234. } else {
  2235. returnCd = response.result[0].returnCd;
  2236. }
  2237. callback(returnCd, selectItem);
  2238. },
  2239. beforeSend: function(){
  2240. self.loading("show");
  2241. },
  2242. complete:function(){
  2243. self.loading("hide");
  2244. }
  2245. });
  2246. },
  2247. // 수혈 2~4단계 저장
  2248. inputBloodHealthCheck : function(param, item, callback, stepName){
  2249. $.ajax ({
  2250. url : $serviceBaseUrl + "/safety/inputBloodHealthCheck.json",
  2251. type : "POST",
  2252. contentType: "application/json",
  2253. async: false,
  2254. data: JSON.stringify(param),
  2255. success: function(response){
  2256. console.log("response -- > " + JSON.stringify(response));
  2257. checkCnt = checkCnt + 1;
  2258. if (response.result == undefined) {
  2259. resultReturnCode += "0001" + ",";
  2260. } else if (response.result.length == 0) {
  2261. resultReturnCode += "0001" + ",";
  2262. } else {
  2263. resultReturnCode += response.result[0].returnCd + ",";
  2264. }
  2265. if (item.length == checkCnt) {
  2266. callback(resultReturnCode, checkCnt, item.length, stepName);
  2267. resultReturnCode = "";
  2268. checkCnt = 0;
  2269. }
  2270. },
  2271. beforeSend: function(){
  2272. self.loading("show");
  2273. },
  2274. complete:function(){
  2275. self.loading("hide");
  2276. },
  2277. error: function (XHR, textStatus, errorThrown) {
  2278. self.loading("hide");
  2279. alert("저장에 실패하였습니다.");
  2280. }
  2281. });
  2282. },
  2283. // 수혈 인증저장
  2284. inputBloodSignData : function(param, item, callback){
  2285. $.ajax ({
  2286. url : $serviceBaseUrl + "/safety/inputBloodSignData.json",
  2287. type : "POST",
  2288. contentType: "application/json",
  2289. async: false,
  2290. data: JSON.stringify(param),
  2291. success: function(response){
  2292. console.log("response -- > " + JSON.stringify(response));
  2293. checkCnt = checkCnt + 1;
  2294. if (response.result == undefined) {
  2295. resultReturnCode += "0001" + ",";
  2296. } else if (response.result.length == 0) {
  2297. resultReturnCode += "0001" + ",";
  2298. } else {
  2299. resultReturnCode += response.result[0].returnCd + ",";
  2300. }
  2301. if (item.length == checkCnt) {
  2302. callback(resultReturnCode, checkCnt, item.length);
  2303. resultReturnCode = "";
  2304. checkCnt = 0;
  2305. }
  2306. },
  2307. beforeSend: function(){
  2308. self.loading("show");
  2309. },
  2310. complete:function(){
  2311. self.loading("hide");
  2312. },
  2313. error: function (XHR, textStatus, errorThrown) {
  2314. self.loading("hide");
  2315. alert("저장에 실패하였습니다.");
  2316. }
  2317. });
  2318. },
  2319. // 부작용 리스트
  2320. getSideEffectList : function(param, callback){
  2321. $.ajax ({
  2322. url : $serviceBaseUrl + "/safety/getSideEffectList.json",
  2323. type : "POST",
  2324. contentType: "application/json",
  2325. data: JSON.stringify(param),
  2326. success: function(response){
  2327. if(response.result!=undefined){
  2328. callback(response.result);
  2329. }else{
  2330. self.alert(response.msg);
  2331. }
  2332. },
  2333. beforeSend: function(){
  2334. self.loading("show");
  2335. },
  2336. complete:function(){
  2337. self.loading("hide");
  2338. }
  2339. });
  2340. },
  2341. // 수혈중단 사유 리스트
  2342. getTransStopReasonList: function (param, type, callback) {
  2343. $.ajax ({
  2344. url : $serviceBaseUrl + "/safety/getTransStopReasonList.json",
  2345. type : "POST",
  2346. contentType: "application/json",
  2347. data: JSON.stringify(param),
  2348. success: function(response){
  2349. if(response.result!=undefined){
  2350. callback(type, response.result);
  2351. }else{
  2352. self.alert(response.msg);
  2353. }
  2354. },
  2355. beforeSend: function(){
  2356. self.loading("show");
  2357. },
  2358. complete:function(){
  2359. self.loading("hide");
  2360. }
  2361. });
  2362. }
  2363. };
  2364. /* 공통 서비스 --------------------------------------------------------------------- */
  2365. this.common = {
  2366. /**
  2367. * 환자를 선택한 경우, 각 다이얼로그 화면에 사용자 정보를 설정
  2368. *
  2369. * @param {string} patientId 환자 번호
  2370. * @param {string} patientNm 환자 이름
  2371. * @param {string} patientAge 환자 나이
  2372. * @param {string} patientGender 환자 성별
  2373. * @param {string} patientTreatCls ??
  2374. * @param {string} patientReceiptNo 접수 번호
  2375. * @param {string} patientDeptCd 환자 진료과 코드
  2376. * @param {string} patientDoctorId 진료의? 주치의?
  2377. */
  2378. setSelectedPatient : function(patientId, patientNm, patientAge, patientGender, patientTreatCls, patientReceiptNo, patientDeptCd, patientDoctorId){
  2379. // 전역 변수에 값 할당
  2380. gPatientId = patientId;
  2381. gPatientNm = patientNm;
  2382. gPatientAge = patientAge;
  2383. gPatientGender = patientGender;
  2384. gPatientTreatCls = patientTreatCls;
  2385. gPatientReceiptNo = patientReceiptNo;
  2386. gPatientDeptCd = patientDeptCd;
  2387. gPatientDoctorId = patientDoctorId;
  2388. $(".modal-patient-id").text(gPatientId);
  2389. $(".modal-patient-name").text(gPatientNm);
  2390. $(".modal-patient-age-gender").text(gPatientAge + " / " + patientGender);
  2391. $(".modal-patient-treat-cls").text(self.common.displayTreatCls( patientTreatCls));
  2392. },
  2393. /**
  2394. * 전역 변수에 어떤 일자를 설정
  2395. *
  2396. * @param {string} hospitalizationDt 어떤 일자
  2397. */
  2398. setHospitalizationDt : function(hospitalizationDt){
  2399. gPatientHospitalizationDt = hospitalizationDt;
  2400. },
  2401. // localstorage 를 초기화 : 로그 아웃에서 사용
  2402. initLocalStorage : function(){
  2403. var hospitalCd = "";
  2404. var defaultDeptCd = "";
  2405. var defaultHomePage = "";
  2406. var defaultUserID = "";
  2407. var defaultData = "";
  2408. var defaultisAuto = "";
  2409. if( localStorage.getItem("hospitalCd") != undefined && localStorage.getItem("hospitalCd") != "" )
  2410. hospitalCd = localStorage.getItem("hospitalCd");
  2411. if( localStorage.getItem("defaultDeptCd") != undefined && localStorage.getItem("defaultDeptCd") != "" )
  2412. defaultDeptCd = localStorage.getItem("defaultDeptCd");
  2413. if( localStorage.getItem("defaultHomePage") != undefined && localStorage.getItem("defaultHomePage") != "" )
  2414. defaultHomePage = localStorage.getItem("defaultHomePage");
  2415. if( localStorage.getItem("defaultUserID") != undefined && localStorage.getItem("defaultUserID") != "" )
  2416. defaultUserID = localStorage.getItem("defaultUserID");
  2417. if( localStorage.getItem("defaultData") != undefined && localStorage.getItem("defaultData") != "" )
  2418. defaultData = localStorage.getItem("defaultData");
  2419. if( localStorage.getItem("defaultisAuto") != undefined && localStorage.getItem("defaultisAuto") != "" )
  2420. defaultisAuto = localStorage.getItem("defaultisAuto");
  2421. localStorage.clear();
  2422. localStorage.setItem("hospitalCd", hospitalCd);
  2423. localStorage.setItem("defaultDeptCd", defaultDeptCd);
  2424. localStorage.setItem("defaultHomePage", defaultHomePage);
  2425. localStorage.setItem("defaultUserID", defaultUserID);
  2426. localStorage.setItem("defaultData", defaultData);
  2427. localStorage.setItem("defaultisAuto", defaultisAuto);
  2428. },
  2429. // localstorage에 선택된 사용자 설정 등록
  2430. setLocalStorageSelectedInfo : function(userDeptInfo){
  2431. localStorage.setItem("selectedUserId", userDeptInfo.userId);
  2432. localStorage.setItem("selectedUserNm", userDeptInfo.userNm);
  2433. localStorage.setItem("selectedDeptCd", userDeptInfo.deptCd);
  2434. localStorage.setItem("selectedDeptNm", userDeptInfo.deptNm);
  2435. localStorage.setItem("selectedJobKindCd", userDeptInfo.jobKindCd);
  2436. localStorage.setItem("selectedJobKindNm", userDeptInfo.jobKindNm);
  2437. localStorage.setItem("selectedUserAuth", userDeptInfo.userAuth);
  2438. },
  2439. // 배열 Object 문자 정렬
  2440. sortArrayObject : function(arrayObject, fieldName, isAscending){
  2441. if( arrayObject.length < 2){
  2442. console.log( "sortArrayObject : 배열이 2개 미만으로 정렬하지 않음");
  2443. return;
  2444. }
  2445. if( isAscending){
  2446. arrayObject.sort( function(a, b) { // 오름차순
  2447. return a[fieldName] < b[fieldName] ? -1 : a[fieldName] > b[fieldName] ? 1 : 0;
  2448. });
  2449. } else {
  2450. arrayObject.sort( function(a, b) { // 내림차순
  2451. return a[fieldName] > b[fieldName] ? -1 : a[fieldName] < b[fieldName] ? 1 : 0;
  2452. });
  2453. }
  2454. },
  2455. // 현재 로그인 사용자의 jobKind와 맞는 권한 인지 체크
  2456. checkAccessJobKind : function(jobKindLevel){
  2457. if( localStorage.getItem("selectedJobKindCd") == jobKindLevel)
  2458. return true;
  2459. else
  2460. return false;
  2461. },
  2462. //현재 로그인 사용자의 userAuth와 맞는 권한 인지 체크
  2463. checkAccessUserAuth : function(authLevel){
  2464. if( localStorage.getItem("selectedUserAuth") == authLevel)
  2465. return true;
  2466. else
  2467. return false;
  2468. },
  2469. // 기본 페이지 URL 가져오는 함수
  2470. getDefaultHomePageURL : function(strHomePage){
  2471. if (strHomePage == "injection")
  2472. return contextPath + "/mobile_poc/medicine/medicine.page?menuId=clinic";
  2473. else if (strHomePage == "bleeding")
  2474. return contextPath + "/mobile_poc/bleeding/bleeding.page?menuId=clinic";
  2475. else if (strHomePage == "transfusion")
  2476. return contextPath + "/mobile_poc/transfusion/transfusion.page?menuId=clinic";
  2477. else
  2478. return contextPath + "/mobile_poc/medicine/medicine.page?menuId=clinic";
  2479. },
  2480. // 기본 페이지로 이동해주는 함수
  2481. gotoDefaultHomePage : function(){
  2482. //alert( "[" + localStorage.getItem("defaultHomePage") + "]");
  2483. if (localStorage.getItem("defaultHomePage") == undefined || localStorage.getItem("defaultHomePage") == "") {
  2484. //location.href="index.page";
  2485. //location.href = contextPath + "/mobile/medical/inpatient.page?menuId=clinic";
  2486. location.href = getDefaultHomePageURL("default");
  2487. } else {
  2488. location.href = getDefaultHomePageURL( localStorage.getItem("defaultHomePage"));
  2489. }
  2490. },
  2491. // 화면 element disabled 설정
  2492. enableElements : function(targetObj){
  2493. targetObj.prop("enabled", true);
  2494. targetObj.find("*").prop("enabled", true);
  2495. },
  2496. // 화면 element enable or disabled 설정
  2497. disableElements : function(targetObj){
  2498. targetObj.prop("disabled", true);
  2499. targetObj.find("*").prop("disabled", true);
  2500. },
  2501. //JSON 그룹핑
  2502. JSONGroupBy : function(xs, key) {
  2503. return xs.reduce(function(rv, x) {
  2504. (rv[x[key]] = rv[x[key]] || []).push(x);
  2505. return rv;
  2506. }, {});
  2507. },
  2508. displayTreatCls : function(treatCls){
  2509. if( gPatientTreatCls == "I")
  2510. return "입원";
  2511. else if( gPatientTreatCls == "O")
  2512. return "외래";
  2513. else if( gPatientTreatCls == "E")
  2514. return "응급";
  2515. else
  2516. return "";
  2517. },
  2518. /**
  2519. * 각 화면별 입력 화면 권한처리
  2520. */
  2521. authorityCheck : function(objectID){
  2522. var adminID = "29990030";
  2523. if(objectID != null && objectID != "" && adminID != gLoginUserId){
  2524. $(objectID).prop( "disabled", true );
  2525. console.log("authorityCheck call");
  2526. }
  2527. },
  2528. /**
  2529. * 건대 요구사항 : 소속 과에 사용자명이 없을 경우 %전공의로 처리
  2530. * 해당 이름이 있을 경우
  2531. */
  2532. kuhResidentSelect : function(selectElement, targetName, targetValue){
  2533. if( !selectElement){
  2534. return "";
  2535. }
  2536. for( var i = 0; i < selectElement.options.length; i ++){
  2537. if(selectElement.options[i].text == targetName && selectElement.options[i].value == targetValue){
  2538. return targetValue;
  2539. }
  2540. }
  2541. for( var i = 0; i < selectElement.options.length; i ++){
  2542. if((selectElement.options[i].text).indexOf("전공의") > -1){
  2543. return selectElement.options[i].value;
  2544. }
  2545. }
  2546. return "";
  2547. },
  2548. /**
  2549. * 백병원 요구사항 : 소속 과에 사용자명이 없을 경우 %전공의로 처리 부분 제외
  2550. * 해당 이름이 있을 경우
  2551. */
  2552. commonResidentSelect : function(selectElement, targetName, targetValue){
  2553. if( !selectElement){
  2554. return "";
  2555. }
  2556. for( var i = 0; i < selectElement.options.length; i ++){
  2557. if(selectElement.options[i].text == targetName && selectElement.options[i].value == targetValue){
  2558. return targetValue;
  2559. }
  2560. }
  2561. return "";
  2562. }
  2563. };
  2564. };