operation.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691
  1. /**
  2. * mplus_mobile_operation
  3. */
  4. var mplus_mobile_operation = function(){
  5. //상속
  6. mplus_common.call(this);
  7. //super
  8. var self = this;
  9. //변수
  10. var div = $("<div></div>");
  11. var tr = $("<tr></tr>");
  12. var th = $("<th></th>");
  13. var td = $("<td></td>");
  14. var table = $("<table></table>");
  15. var li = $("<li></li>");
  16. var a = $("<a></a>");
  17. var span = $("<span></span>");
  18. var button = $("<button></button>");
  19. var $opViewToDt = $('#opViewToDt'),
  20. $opViewFmDt = $('#opViewFmDt'),
  21. $opTotalNumSpan = $('#opTotalNumSpan'),
  22. $opSearchBtn = $('#opSearchBtn'),
  23. $ulOperationList = $('#ulOperationList'),
  24. $opSortOpenBtn = $('#opSortOpenBtn'),
  25. $anesViewToDt = $('#anesViewToDt'),
  26. $anesViewFmDt = $('#anesViewFmDt'),
  27. $anesTotalNumSpan = $('#anesTotalNumSpan'),
  28. $anesSearchBtn = $('#anesSearchBtn'),
  29. $ulAnesthesiaList = $('#ulAnesthesiaList'),
  30. $anesSortOpenBtn = $('#anesSortOpenBtn'),
  31. $trViewToDt = $('#trViewToDt'),
  32. $trViewFmDt = $('#trViewFmDt'),
  33. $trTotalNumSpan = $('#trTotalNumSpan'),
  34. $trSearchBtn = $('#trSearchBtn'),
  35. $ulTreatmentList = $('#ulTreatmentList'),
  36. $trSortOpenBtn = $('#trSortOpenBtn');
  37. var today = new Date();
  38. var prevDay = new Date(Date.parse(new Date()) - 6 * 1000 * 60 * 60 * 24); //일주일전!!
  39. var operatingList = [];
  40. var anesthesiaList = [];
  41. var treatmentList = [];
  42. var deptList = new Array();
  43. self.hospital.getDeptList('D', function(result) {
  44. var sltList = result;
  45. $('#opDepartmentCd').empty();
  46. $('#anesDepartmentCd').empty();
  47. $('#trDepartmentCd').empty();
  48. var totalOption = $('<option></option>').clone().attr('value', '%').text('전체');
  49. $('#opDepartmentCd, #anesDepartmentCd, #trDepartmentCd').append(totalOption);
  50. for(var i=0; i<sltList.length; i++){
  51. var option = $('<option></option>').clone().attr('value', sltList[i].departmentCd)
  52. .text(sltList[i].operatingDeptNm);
  53. $('#opDepartmentCd, #anesDepartmentCd, #trDepartmentCd').append(option);
  54. };
  55. $('#opDepartmentCd').val('%');
  56. $('#anesDepartmentCd').val('%');
  57. $('#trDepartmentCd').val('%');
  58. });
  59. self.hospital.getOpCntrList(function(result) {
  60. var OpCntrList = result;
  61. $('#opOperatingCntr').empty();
  62. $('#anesOperatingCntr').empty();
  63. var totalOption = $('<option></option>').clone().attr('value', '%').text('전체');
  64. $('#opOperatingCntr, #anesOperatingCntr').append(totalOption);
  65. for(var i=0; i<OpCntrList.length; i++){
  66. var option = $('<option></option>').clone().attr('value', OpCntrList[i].operatingCntrCd)
  67. .text(OpCntrList[i].operatingCntrNm);
  68. $('#opOperatingCntr, #anesOperatingCntr').append(option);
  69. };
  70. $('#opOperatingCntr').val('%');
  71. $('#anesOperatingCntr').val('%');
  72. });
  73. self.hospital.getTrCntrList(function(result) {
  74. var TrCntrList = result;
  75. $('#trTreatmentCntr').empty();
  76. var totalOption = $('<option></option>').clone().attr('value', '%').text('전체');
  77. $('#trTreatmentCntr').append(totalOption);
  78. for(var i=0; i<TrCntrList.length; i++){
  79. var option = $('<option></option>').clone().attr('value', TrCntrList[i].treatmentCntrCd)
  80. .text(TrCntrList[i].treatmentCntrNm);
  81. $('#trTreatmentCntr').append(option);
  82. };
  83. $('#trTreatmentCntr').val('%');
  84. });
  85. // self.hospital.getOpRoomList( "MOR", function(result) {
  86. // var opRoomList = result;
  87. // $('#opOperatingRoom').empty();
  88. // $('#anesOperatingRoom').empty();
  89. // var totalOption = $('<option></option>').clone().attr('value', '%').text('전체');
  90. // $('#opOperatingRoom, #anesOperatingRoom').append(totalOption);
  91. //
  92. // for(var i=0; i<opRoomList.length; i++){
  93. // var option = $('<option></option>').clone().attr('value', opRoomList[i].operatingRoomCd)
  94. // .text(opRoomList[i].operatingRoomNm);
  95. // $('#opOperatingRoom, #anesOperatingRoom').append(option);
  96. // };
  97. // $('#opOperatingRoom').val('%');
  98. // $('#anesOperatingRoom').val('%');
  99. // });
  100. /**
  101. * 초기화
  102. */
  103. this.init = function(){
  104. operatingInit();
  105. operatingAddEvent();
  106. searchOperatingList();
  107. var sortList = new Array();
  108. sortList = [{key: 'operatingDeptNm', type: 'string', value: '집도과순'},
  109. {key: 'operatingRoom', type: 'string', value: '수술방번호순'},
  110. {key: 'patientNm', type: 'string', value: '이름순'}];
  111. sortInit(sortList);
  112. $('#operatingTab a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  113. patientInfoInit();
  114. if($("ul#operatingTab.nav-tabs li.active a").attr('aria-controls')=='tabOperating'){
  115. operatingInit();
  116. operatingAddEvent();
  117. sortList = [{key: 'operatingDeptNm', type: 'string', value: '집도과순'},
  118. {key: 'operatingRoom', type: 'string', value: '수술방번호순'},
  119. {key: 'patientNm', type: 'string', value: '이름순'}];
  120. sortInit(sortList);
  121. searchOperatingList();
  122. }else if($("ul#operatingTab.nav-tabs li.active a").attr('aria-controls')=='tabAnesthesia'){
  123. anesthesiaInit();
  124. anesthesiaAddEvent();
  125. sortList = [{key: 'operatingDeptNm', type: 'string', value: '집도과순'},
  126. {key: 'operatingRoom', type: 'string', value: '수술방번호순'},
  127. {key: 'patientNm', type: 'string', value: '이름순'}];
  128. sortInit(sortList);
  129. searchAnesthesiaList();
  130. }else if($("ul#operatingTab.nav-tabs li.active a").attr('aria-controls')=='tabTreatment'){
  131. treatmentInit();
  132. treatmentAddEvent();
  133. sortList = [{key: 'operatingDeptNm', type: 'string', value: '시술과순'},
  134. {key: 'treatmentCntrCd', type: 'string', value: '시술실순'},
  135. {key: 'patientNm', type: 'string', value: '이름순'}];
  136. sortInit(sortList);
  137. searchTreatmentList();
  138. }else{
  139. /*slef.aler('에러메시지?');*/
  140. };
  141. });
  142. };
  143. var patientInfoInit = function(){
  144. $('#divId').text('');
  145. $('#divOpPatientName').text('');
  146. $('#divOpDoctorName').text('');
  147. $('#divAnesthesiaDrNm').text('');
  148. $('#divOperatingCntr').text('');
  149. $('#divOpName1').text('');
  150. $('#divOpTime').text('');
  151. $('#divAnTime').text('');
  152. $('#divAnesMethod').text('');
  153. $('#divOperatingSticksOut').text('');
  154. };
  155. /*-----------------수술 탭---------------------*/
  156. var operatingInit = function(){
  157. var todayDateStr = moment(today).format('YYYY-MM-DD');
  158. /*var prevDayStr = moment(prevDay).format('YYYY-MM-DD');*/
  159. $opViewToDt.val(todayDateStr);
  160. $opViewFmDt.val(todayDateStr);
  161. $('.anDisplayOnly').css('display', 'none');
  162. $('.trDisplayOnly').css('display', 'none');
  163. $('.opDisplayOnly').css('display', 'block');
  164. $('.trDisplayNone').css('display', 'block');
  165. $('#opDepartmentCd').val('%');
  166. $('#opOperatingCntr').val('%');
  167. $('#opOperatingRoom').val('%');
  168. $('[id*=opOperatingTyp]').prop('checked', false);
  169. $('#opOperatingTypAll').prop('checked', true);
  170. if( self.isTablet() ) {
  171. $('.tablet-header-ctrl').addClass('text-center');
  172. }
  173. operatingList = [];
  174. $opTotalNumSpan.text(0);
  175. $ulOperationList.empty();
  176. };
  177. /**
  178. * 이벤트 등록
  179. */
  180. var operatingAddEvent = function(){
  181. $opSearchBtn.unbind();
  182. $opSearchBtn.on("click", function(e){
  183. $('.header span').css('display', 'none');
  184. searchOperatingList();
  185. });
  186. $opSortOpenBtn.unbind();
  187. $opSortOpenBtn.on("click", function(e){
  188. $('#sortModal').modal('show');
  189. });
  190. $('#sortConfirmBtn').unbind();
  191. $('#sortConfirmBtn').on("click", function(e){
  192. $('#sortModal').modal('hide');
  193. sortOperatingList($('#sltSort').val(), $('#sltSort option:selected').attr('type'), $('input[type="radio"][name="sortRadio"]:checked').val());
  194. $('.header span').css('display', 'none');
  195. $('.header.sort_'+$('#sltSort').val()+' .sort-icon-'+$('input[type="radio"][name="sortRadio"]:checked').val()).css('display', 'inline-block');
  196. });
  197. $('#opOperatingTypAll').unbind();
  198. $('#opOperatingTypAll').change(function(e){
  199. if(e.currentTarget.checked){
  200. $('[id*=opOperatingTyp]:not(#opOperatingTypAll)').prop('checked', false);
  201. }
  202. });
  203. $('[id*=opOperatingTyp]:not(#opOperatingTypAll)').unbind();
  204. $('[id*=opOperatingTyp]:not(#opOperatingTypAll)').change(function(e){
  205. if(e.currentTarget.checked && $('#opOperatingTypAll').prop('checked')){
  206. $('#opOperatingTypAll').prop('checked', false);
  207. }
  208. });
  209. // 수술실 변경
  210. $('#opOperatingCntr').unbind();
  211. $('#opOperatingCntr').on("change", function(e){
  212. if( e.currentTarget.value == '') return;
  213. changeOpOperatingRoom(e.currentTarget.value);
  214. });
  215. };
  216. // 수술실 리스트 변경시, 방 목록 재로드
  217. var changeOpOperatingRoom = function( ParamOperatingCntr){
  218. self.hospital.getOpRoomList( ParamOperatingCntr, function(result) {
  219. var opRoomList = result;
  220. $('#opOperatingRoom').empty();
  221. var totalOption = $('<option></option>').clone().attr('value', '%').text('전체');
  222. $('#opOperatingRoom').append(totalOption);
  223. for(var i=0; i<opRoomList.length; i++){
  224. var option = $('<option></option>').clone().attr('value', opRoomList[i].operatingRoomCd)
  225. .text(opRoomList[i].operatingRoomNm);
  226. $('#opOperatingRoom').append(option);
  227. };
  228. $('#opOperatingRoom').val('%');
  229. });
  230. };
  231. var sortOperatingList = function(key, type, method){
  232. operatingList = self.util.sortObj(operatingList, key, type, method);
  233. bindingOperatingList(operatingList);
  234. };
  235. var searchOperatingList = function(){
  236. if($opViewToDt.val()=='' || $opViewFmDt.val()==''){
  237. self.alert('조회 일자를 입력해주세요.');
  238. return;
  239. }
  240. if(self.dateCalc($opViewFmDt.val(), $opViewToDt.val())>6){
  241. self.alert('조회 기간은 7일이내로 설정해주세요.');
  242. return;
  243. }else if(self.dateCalc($opViewFmDt.val(), $opViewToDt.val())<0){
  244. self.alert('조회 기간을 확인해주세요.');
  245. return;
  246. }
  247. if($('[id*=opOperatingTyp]:checked').length<1){
  248. $('#opOperatingTypAll').prop('checked', true);
  249. }
  250. patientInfoInit();
  251. $ulOperationList.empty();
  252. operatingList = [];
  253. var param = {
  254. startDt: moment($opViewFmDt.val()).format('YYYYMMDD'),
  255. endDt: moment($opViewToDt.val()).format('YYYYMMDD'),
  256. operatingCntrCd: $('#opOperatingCntr').val(),
  257. departmentCd: $('#opDepartmentCd').val(),
  258. operatingRoomCd: $('#opOperatingRoom').val(),
  259. operatingDrNm: '%',
  260. operatingTyp1: ($('#opOperatingTypAll').prop('checked') || $('#opOperatingTyp1').prop('checked'))? '1': '0',
  261. operatingTyp2: ($('#opOperatingTypAll').prop('checked') || $('#opOperatingTyp2').prop('checked'))? '1': '0',
  262. operatingTyp3: ($('#opOperatingTypAll').prop('checked') || $('#opOperatingTyp3').prop('checked'))? '1': '0'
  263. };
  264. self.schedule.getOpSchedule(param);
  265. bindingOperatingList(operatingList, null);
  266. };
  267. bindingOperatingList = function(bindOperatingList, extraMsg){
  268. $ulOperationList.empty();
  269. $opTotalNumSpan.text(bindOperatingList.length);
  270. operatingList = bindOperatingList;
  271. if(operatingList.length==0){
  272. $ulOperationList.append(li.clone().append(div.clone().addClass('text-center no-result').text('―')));
  273. }
  274. for(var i=0; i<operatingList.length; i++){
  275. var divWard= div.clone().addClass("num_4 col-xs-4 col-sm-4 pdr0 letter-control").text(operatingList[i].wardNm);
  276. var divName = div.clone().addClass("name col-xs-5 col-sm-5").text(operatingList[i].patientNm + ' ' + operatingList[i].patientId);
  277. /*var divNum = div.clone().addClass("num col-xs-3 col-sm-1").append(
  278. span.clone().addClass('badge ' + (patientSex=='F'? 'female':'male') )
  279. .text( (patientSex=='F'? 'F':'M') + patientAge )
  280. );*/
  281. var divNum = div.clone().addClass("num_4 col-xs-3 col-sm-3").text(operatingList[i].gender + ' / ' + operatingList[i].age);
  282. var divOperationDt = div.clone().addClass("date col-xs-4 col-sm-4 pdr0 letter-control").text(moment(operatingList[i].operatingDt).format('YYYY-MM-DD'));
  283. var divoperatingDeptNm = div.clone().addClass("num_b col-xs-5 col-sm-5").text(operatingList[i].departmentNm);
  284. var divOperatingTyp = div.clone().addClass("lowBadge col-xs-3 col-sm-3").text(operatingList[i].operatingTyp);
  285. var divRow1 = div.clone().addClass("col-xs-12 col-sm-6 pd0").append(divWard).append(divName).append(divNum);
  286. var divRow2 = div.clone().addClass("col-xs-12 col-sm-6 pd0").append(divOperationDt).append(divoperatingDeptNm).append(divOperatingTyp);
  287. var divRow = div.clone().addClass("list-row container").append(divRow1).append(divRow2);
  288. $ulOperationList.append(li.clone().append(a.clone().addClass('list-group-item' + (operatingList[i].emergencyYn=='Y'? ' operation-emergency': '')).attr('patientNo', i).append(divRow)));
  289. }
  290. $('#operationList .list-group-item').on('click',function(){
  291. $('.list-group-item').removeClass('active');
  292. $(this).addClass('active');
  293. $('#openToggle').stop().animate({bottom:240},500);
  294. $('#overlay').stop().animate({bottom:-49},500);
  295. $(this).addClass('active');
  296. $('#footer').css('overflow','visible');
  297. $('#openToggle').addClass('on');
  298. $('#openToggle').find('.fa').removeClass('fa-chevron-up');
  299. $('#openToggle').find('.fa').addClass('fa-chevron-down');
  300. $('.pop-content ul').scrollTop(0);
  301. var patientInfo = operatingList[event.currentTarget.attributes.patientNo.value];
  302. $('#divId').text(patientInfo.patientId);
  303. $('#divOpPatientName').text(patientInfo.patientNm);
  304. $('#divOpDoctorName').text(patientInfo.operatingDrNm);
  305. $('#divDiagnosisNm').text(patientInfo.diagnosisNm);
  306. $('#divOperatingCntr').text(patientInfo.operatingCntrCd + ' ' + patientInfo.operatingRoomCd);
  307. $('#divOpName1').text(patientInfo.operatingNm);
  308. $('#divOpTime').text(self.util.restoreTime(patientInfo.operatingFmTm) + ' ~ ' + self.util.restoreTime(patientInfo.operatingToTm));
  309. $('#divAnesMethod').text(patientInfo.anesthesiaMeth);
  310. $('#divOperatingSticksOut').text(patientInfo.operatingSticksOut);
  311. return false;
  312. })
  313. }
  314. /*---------------------수술탭 종료-----------------------*/
  315. /*---------------------마취탭-----------------------*/
  316. var anesthesiaInit = function(){
  317. var todayDateStr = moment(today).format('YYYY-MM-DD');
  318. /*var prevDayStr = moment(prevDay).format('YYYY-MM-DD');*/
  319. $anesViewToDt.val(todayDateStr);
  320. $anesViewFmDt.val(todayDateStr);
  321. $('.opDisplayOnly').css('display', 'none');
  322. $('.anDisplayOnly').css('display', 'block');
  323. $('.trDisplayOnly').css('display', 'none');
  324. $('.trDisplayNone').css('display', 'block');
  325. $('#anesDepartmentCd').val('%');
  326. $('#anesOperatingCntr').val('%');
  327. $('#anesOperatingRoom').val('%');
  328. $('[id*=anesOperatingTyp]').prop('checked', false);
  329. $('#anesOperatingTypAll').prop('checked', true);
  330. if( self.isTablet() ) {
  331. $('.tablet-header-ctrl').addClass('text-center');
  332. }
  333. anesthesiaList = [];
  334. $anesTotalNumSpan.text(0);
  335. $ulAnesthesiaList.empty();
  336. };
  337. var anesthesiaAddEvent = function(){
  338. $anesSearchBtn.unbind();
  339. $anesSearchBtn.on("click", function(e){
  340. $('.header span').css('display', 'none');
  341. searchAnesthesiaList();
  342. });
  343. $anesSortOpenBtn.unbind();
  344. $anesSortOpenBtn.on("click", function(e){
  345. $('#sortModal').modal('show');
  346. });
  347. $('#sortConfirmBtn').unbind();
  348. $('#sortConfirmBtn').on("click", function(e){
  349. $('#sortModal').modal('hide');
  350. sortAnesthesiaList($('#sltSort').val(), $('#sltSort option:selected').attr('type'), $('input[type="radio"][name="sortRadio"]:checked').val());
  351. $('.header span').css('display', 'none');
  352. $('.header.sort_'+$('#sltSort').val()+' .sort-icon-'+$('input[type="radio"][name="sortRadio"]:checked').val()).css('display', 'inline-block');
  353. });
  354. $('#anesOperatingTypAll').unbind();
  355. $('#anesOperatingTypAll').change(function(e){
  356. if(e.currentTarget.checked){
  357. $('[id*=anesOperatingTyp]:not(#anesOperatingTypAll)').prop('checked', false);
  358. }
  359. });
  360. $('[id*=anesOperatingTyp]:not(#anesOperatingTypAll)').unbind();
  361. $('[id*=anesOperatingTyp]:not(#anesOperatingTypAll)').change(function(e){
  362. if(e.currentTarget.checked && $('#anesOperatingTypAll').prop('checked')){
  363. $('#anesOperatingTypAll').prop('checked', false);
  364. }
  365. });
  366. // 마취실 변경
  367. $('#anesOperatingCntr').unbind();
  368. $('#anesOperatingCntr').on("change", function(e){
  369. if( e.currentTarget.value == '') return;
  370. changeAnesOperatingRoom(e.currentTarget.value);
  371. });
  372. };
  373. // 마취실 리스트 변경시, 방 목록 재로드
  374. var changeAnesOperatingRoom = function( ParamOperatingCntr){
  375. self.hospital.getOpRoomList( ParamOperatingCntr, function(result) {
  376. var opRoomList = result;
  377. $('#anesOperatingRoom').empty();
  378. var totalOption = $('<option></option>').clone().attr('value', '%').text('전체');
  379. $('#anesOperatingRoom').append(totalOption);
  380. for(var i=0; i<opRoomList.length; i++){
  381. var option = $('<option></option>').clone().attr('value', opRoomList[i].operatingRoomCd)
  382. .text(opRoomList[i].operatingRoomNm);
  383. $('#anesOperatingRoom').append(option);
  384. };
  385. $('#anesOperatingRoom').val('%');
  386. });
  387. };
  388. var sortAnesthesiaList = function(key, type, method){
  389. anesthesiaList = self.util.sortObj(anesthesiaList, key, type, method);
  390. bindingAnesthesiaList(anesthesiaList);
  391. };
  392. var searchAnesthesiaList = function(){
  393. if($anesViewToDt.val()=='' || $anesViewFmDt.val()==''){
  394. self.alert('조회 일자를 입력해주세요.');
  395. return;
  396. };
  397. if(self.dateCalc($anesViewFmDt.val(), $anesViewToDt.val())>6){
  398. self.alert('조회 기간은 7일이내로 설정해주세요.');
  399. return;
  400. }else if(self.dateCalc($anesViewFmDt.val(), $anesViewToDt.val())<0){
  401. self.alert('조회 기간을 확인해주세요.');
  402. return;
  403. };
  404. if($('[id*=anesOperatingTyp]:checked').length<1){
  405. $('#anesOperatingTypAll').prop('checked', true);
  406. };
  407. patientInfoInit();
  408. $ulAnesthesiaList.empty();
  409. anesthesiaList = [];
  410. var param = {
  411. startDt: moment($anesViewFmDt.val()).format('YYYYMMDD'),
  412. endDt: moment($anesViewToDt.val()).format('YYYYMMDD'),
  413. operatingCntrCd: $('#anesOperatingCntr').val(),
  414. departmentCd: $('#anesDepartmentCd').val(),
  415. operatingRoomCd: $('#anesOperatingRoom').val(),
  416. operatingDrNm: '%',
  417. operatingTyp1: ($('#anesOperatingTypAll').prop('checked') || $('#anesOperatingTyp1').prop('checked'))? '1': '0',
  418. operatingTyp2: ($('#anesOperatingTypAll').prop('checked') || $('#anesOperatingTyp2').prop('checked'))? '1': '0',
  419. operatingTyp3: ($('#anesOperatingTypAll').prop('checked') || $('#anesOperatingTyp3').prop('checked'))? '1': '0'
  420. };
  421. self.schedule.getAnSchedule(param);
  422. bindingAnesthesiaList(anesthesiaList, null);
  423. };
  424. bindingAnesthesiaList = function(bindAnesthesiaList, extraMsg){
  425. $ulAnesthesiaList.empty();
  426. $anesTotalNumSpan.text(bindAnesthesiaList.length);
  427. anesthesiaList = bindAnesthesiaList;
  428. if(anesthesiaList.length==0){
  429. $ulAnesthesiaList.append(li.clone().append(div.clone().addClass('text-center no-result').text('―')));
  430. }
  431. for(var i=0; i<anesthesiaList.length; i++){
  432. var divWard = div.clone().addClass("num_3 col-xs-4 col-sm-4 pdr0 letter-control").text(anesthesiaList[i].wardNm);
  433. var divName = div.clone().addClass("name col-xs-5 col-sm-5").text(anesthesiaList[i].patientNm + ' ' + anesthesiaList[i].patientId);
  434. var divNum = div.clone().addClass("num_3 col-xs-3 col-sm-3").text(anesthesiaList[i].gender + ' / ' + anesthesiaList[i].age);
  435. /*var patientAge = anesthesiaList[i].age;
  436. var patientSex = anesthesiaList[i].sex;
  437. var divNum = div.clone().addClass("num col-xs-3 col-sm-1").append(
  438. span.clone().addClass('badge ' + (patientSex=='F'? 'female':'male') )
  439. .text( (patientSex=='F'? 'F':'M') + patientAge )
  440. );*/
  441. var divOperationDt = div.clone().addClass("date col-xs-4 col-sm-4 pdr0 letter-control").text(moment(anesthesiaList[i].operatingDt).format('YYYY-MM-DD'));
  442. var divoperatingDeptNm = div.clone().addClass("num_b col-xs-5 col-sm-5").text(anesthesiaList[i].departmentNm);
  443. var divOperatingTyp = div.clone().addClass("lowBadge col-xs-3 col-sm-3").text(anesthesiaList[i].operatingTyp);
  444. var divRow1 = div.clone().addClass("col-xs-12 col-sm-6 pd0").append(divWard).append(divName).append(divNum);
  445. var divRow2 = div.clone().addClass("col-xs-12 col-sm-6 pd0").append(divOperationDt).append(divoperatingDeptNm).append(divOperatingTyp);
  446. var divRow = div.clone().addClass("list-row container").append(divRow1).append(divRow2);
  447. $ulAnesthesiaList.append(li.clone().append(a.clone().addClass('list-group-item' + (anesthesiaList[i].emergencyYn=='Y'? ' operation-emergency': '')).attr('patientNo', i).append(divRow)));
  448. };
  449. $('#ulAnesthesiaList .list-group-item').on('click',function(){
  450. $('.list-group-item').removeClass('active');
  451. $(this).addClass('active');
  452. $('#openToggle').stop().animate({bottom:240},500);
  453. $('#overlay').stop().animate({bottom:-49},500);
  454. $(this).addClass('active');
  455. $('#footer').css('overflow','visible');
  456. $('#openToggle').addClass('on');
  457. $('#openToggle').find('.fa').removeClass('fa-chevron-up');
  458. $('#openToggle').find('.fa').addClass('fa-chevron-down');
  459. $('.pop-content ul').scrollTop(0);
  460. var patientInfo = anesthesiaList[event.currentTarget.attributes.patientNo.value];
  461. $('#divId').text(patientInfo.patientId);
  462. $('#divOpPatientName').text(patientInfo.patientNm);
  463. $('#divOpDoctorName').text(patientInfo.operatingDrNm);
  464. $('#divAnesthesiaNm').text(patientInfo.anesthesiaNm);
  465. $('#divAnesthesiaDrNm').text(patientInfo.anesthesiaDrNm);
  466. $('#divOperatingCntr').text(patientInfo.operatingCntrCd + ' ' + patientInfo.operatingRoomCd);
  467. $('#divAnTime').text(self.util.restoreTime(patientInfo.anesthesiaFmTm) + ' ~ ' + self.util.restoreTime(patientInfo.anesthesiaToTm));
  468. $('#divAnesMethod').text(patientInfo.anesthesiaMeth);
  469. $('#divOperatingSticksOut').text(patientInfo.operatingSticksOut);
  470. return false;
  471. })
  472. }
  473. /*-----------------마취 탭종료---------------------*/
  474. /*-----------------시술 탭---------------------*/
  475. var treatmentInit = function(){
  476. var todayDateStr = moment(today).format('YYYY-MM-DD');
  477. /*var prevDayStr = moment(prevDay).format('YYYY-MM-DD');*/
  478. $trViewToDt.val(todayDateStr);
  479. $trViewFmDt.val(todayDateStr);
  480. $('.opDisplayOnly').css('display', 'none');
  481. $('.anDisplayOnly').css('display', 'none');
  482. $('.trDisplayOnly').css('display', 'block');
  483. $('.trDisplayNone').css('display', 'none');
  484. $('#trDepartmentCd').val('%');
  485. $('#trTreatmentCntr').val('%');
  486. $('#trTreatTyp').val('I');
  487. $('[id*=trTreatmentTyp]').prop('checked', false);
  488. $('#trTreatmentTyp1').prop('checked', true);
  489. if( self.isTablet() ) {
  490. $('.tablet-header-ctrl').addClass('text-center');
  491. }
  492. treatmentList = [];
  493. $trTotalNumSpan.text(0);
  494. $ulTreatmentList.empty();
  495. };
  496. /**
  497. * 이벤트 등록
  498. */
  499. var treatmentAddEvent = function(){
  500. $trSearchBtn.unbind();
  501. $trSearchBtn.on("click", function(e){
  502. $('.header span').css('display', 'none');
  503. searchTreatmentList();
  504. });
  505. $trSortOpenBtn.unbind();
  506. $trSortOpenBtn.on("click", function(e){
  507. $('#sortModal').modal('show');
  508. });
  509. $('#sortConfirmBtn').unbind();
  510. $('#sortConfirmBtn').on("click", function(e){
  511. $('#sortModal').modal('hide');
  512. sortTreatmentList($('#sltSort').val(), $('#sltSort option:selected').attr('type'), $('input[type="radio"][name="sortRadio"]:checked').val());
  513. $('.header span').css('display', 'none');
  514. $('.header.sort_'+$('#sltSort').val()+' .sort-icon-'+$('input[type="radio"][name="sortRadio"]:checked').val()).css('display', 'inline-block');
  515. });
  516. $('[id*=trTreatmentTyp]').unbind();
  517. $('[id*=trTreatmentTyp]').change(function(e){
  518. $('[id*=trTreatmentTyp]:not(#' + e.currentTarget.id + ')').prop('checked', false);
  519. });
  520. };
  521. var sortTreatmentList = function(key, type, method){
  522. treatmentList = self.util.sortObj(treatmentList, key, type, method);
  523. bindingTreatmentList(treatmentList);
  524. };
  525. var searchTreatmentList = function(){
  526. if($trViewToDt.val()=='' || $trViewFmDt.val()==''){
  527. self.alert('조회 일자를 입력해주세요.');
  528. return;
  529. }
  530. if(self.dateCalc($trViewFmDt.val(), $trViewToDt.val())>6){
  531. self.alert('조회 기간은 7일이내로 설정해주세요.');
  532. return;
  533. }else if(self.dateCalc($trViewFmDt.val(), $trViewToDt.val())<0){
  534. self.alert('조회 기간을 확인해주세요.');
  535. return;
  536. }
  537. if($('[id*=trTreatmentTyp]:checked').length<1){
  538. $('#trTreatmentTypAll').prop('checked', true);
  539. }
  540. patientInfoInit();
  541. $ulTreatmentList.empty();
  542. treatmentList = [];
  543. var param = {
  544. startDt: moment($trViewFmDt.val()).format('YYYYMMDD'),
  545. endDt: moment($trViewToDt.val()).format('YYYYMMDD'),
  546. treatTyp: $('#trTreatTyp').val(),
  547. departmentCd: $('#trDepartmentCd').val(),
  548. treatmentCntrCd: $('#trTreatmentCntr').val(),
  549. treatmentTyp1: $('#trTreatmentTyp1').prop('checked')? '1': '0',
  550. treatmentTyp2: $('#trTreatmentTyp2').prop('checked')? '1': '0',
  551. treatmentTyp3: $('#trTreatmentTyp3').prop('checked')? '1': '0'
  552. };
  553. self.schedule.getTrSchedule(param);
  554. bindingTreatmentList(treatmentList, null);
  555. };
  556. bindingTreatmentList = function(bindTreatmentList, extraMsg){
  557. $ulTreatmentList.empty();
  558. $trTotalNumSpan.text(bindTreatmentList.length);
  559. treatmentList = bindTreatmentList;
  560. if(treatmentList.length==0){
  561. $ulTreatmentList.append(li.clone().append(div.clone().addClass('text-center no-result').text('―')));
  562. }
  563. for(var i=0; i<treatmentList.length; i++){
  564. var divWard = div.clone().addClass("num_3 col-xs-4 col-sm-4 pdr0 letter-control").text(treatmentList[i].wardNm);
  565. var divName = div.clone().addClass("name col-xs-5 col-sm-5").text(treatmentList[i].patientNm + ' ' + treatmentList[i].patientId);
  566. var divNum = div.clone().addClass("num_3 col-xs-3 col-sm-3").text(treatmentList[i].gender + ' / ' + treatmentList[i].age);
  567. var divOperationDt = div.clone().addClass("date col-xs-4 col-sm-4 pdr0 letter-control").text(treatmentList[i].treatmentDt != ''? moment(treatmentList[i].treatmentDt).format('YYYY-MM-DD') : '-');
  568. var divoperatingDeptNm = div.clone().addClass("num_b col-xs-5 col-sm-5").text(treatmentList[i].departmentNm);
  569. var divOperatingTyp = div.clone().addClass("lowBadge col-xs-3 col-sm-3").text(treatmentList[i].treatmentTyp);
  570. var divRow1 = div.clone().addClass("col-xs-12 col-sm-6 pd0").append(divWard).append(divName).append(divNum);
  571. var divRow2 = div.clone().addClass("col-xs-12 col-sm-6 pd0").append(divOperationDt).append(divoperatingDeptNm).append(divOperatingTyp);
  572. var divRow = div.clone().addClass("list-row container").append(divRow1).append(divRow2);
  573. $ulTreatmentList.append(li.clone().append(a.clone().addClass('list-group-item' + (treatmentList[i].emergencyYn=='Y'? ' operation-emergency': '')).attr('patientNo', i).append(divRow)));
  574. };
  575. $('#ulTreatmentList .list-group-item').on('click',function(){
  576. $('.list-group-item').removeClass('active');
  577. $(this).addClass('active');
  578. $('#openToggle').stop().animate({bottom:240},500);
  579. $('#overlay').stop().animate({bottom:-49},500);
  580. $(this).addClass('active');
  581. $('#footer').css('overflow','visible');
  582. $('#openToggle').addClass('on');
  583. $('#openToggle').find('.fa').removeClass('fa-chevron-up');
  584. $('#openToggle').find('.fa').addClass('fa-chevron-down');
  585. $('.pop-content ul').scrollTop(0);
  586. var patientInfo = treatmentList[event.currentTarget.attributes.patientNo.value];
  587. $('#divId').text(patientInfo.patientId);
  588. $('#divOpPatientName').text(patientInfo.patientNm);
  589. $('#divTrDoctorName').text(patientInfo.treatmentDrNm);
  590. $('#divDiagnosisNm').text(patientInfo.diagnosisNm);
  591. $('#divTreatmentCntr').text(patientInfo.treatmentCntrCd);
  592. $('#divTrName1').text(patientInfo.treatmentNm);
  593. $('#divTrTime').text(patientInfo.treatmentFmTm + ' ~ ' + patientInfo.treatmentToTm);
  594. //$('#divAnesMethod').text(patientInfo.anesthesiaMeth);
  595. //$('#divOperatingSticksOut').text(patientInfo.operatingSticksOut);
  596. return false;
  597. })
  598. }
  599. /*---------------------시술탭 종료-----------------------*/
  600. };