"use strict"; /** * mplus_modal_examlist */ var mplus_modal_examlist = function(){ // 상속 mplus_common.call(this); // 상위 객체 생성 //var mplusPatient = new mplus_mobile_patient(); //var mplusNursing = new mplus_nursing(); //super var self = this; var varExamlistResultLists = []; //==== 변수 { ==== //==== 변수 } ==== /** * 초기화 */ this.init = function(){ //여기서 모든화면 콤보박스데이터를 집어넣자!!! 그래야지 화면이동할때 속도가 오래걸리지않음!!! // 초기 화면 조건 구성 initCondition(); // 이벤트 초기화 addEvent(); }; //==== 초기화 설정 { ==== var initCondition = function(){ //결과값 초기화 initEmptyData(); // 초기 화면 조건 구성 initStartEndDate(); //접수부서 initReceiptDeptList(); }; var initEmptyData = function(){ $("#divExamResultRows").empty(); varExamlistResultLists=[]; } var initReceiptDeptList = function(){ var param = { userId:gLoginUserId, patientId:gPatientId, startDt:moment($("#txtExamStartDt").val()).format("YYYYMMDD"), endDt:moment($("#txtExamEndDt").val()).format("YYYYMMDD") }; self.medical.getExamReceiptDeptList(param, processReceiptDeptList); }; var processReceiptDeptList = function(lists){ $("#selReceiptDept").empty(); var strDisplayTemp = ""; strDisplayTemp = ""; if(lists != undefined){ for(var i=0; i"+ lists[i].receiptDeptNm +""; } } $("#selReceiptDept").append(strDisplayTemp); $("#selReceiptDept").val($("#selReceiptDept option:first").val()); searchExam(); }; var initStartEndDate = function(){ //오늘일자 로드 var varToday = new Date(); //varToday.setDate(varToday.getMonth() - 1); //일요일이면 차주 가져오기 //다른 요일이면 해당 요일 처리 $("#txtExamEndDt").val( moment(varToday).format("YYYY-MM-DD") ); $("#txtExamStartDt").val( moment().subtract(1, 'months').format("YYYY-MM-DD") ); }; var searchExam = function(){ var param = { hospitalCd: localStorage.getItem("hospitalCd"), userId:gLoginUserId, patientId:gPatientId, startDt:moment($("#txtExamStartDt").val()).format("YYYYMMDD"), endDt:moment($("#txtExamEndDt").val()).format("YYYYMMDD"), receiptDeptCd:$("#selReceiptDept").val() }; self.medical.getExamList(param, processSearchExamList); }; var processSearchExamList = function(lists){ var strDisplayTemp = ""; var varExamReceiptDt = ""; var varExamReceiptTm = ""; var varExamDt = ""; varExamlistResultLists = lists; $("#divExamResultRows").empty(); for( var i = 0; i < lists.length; i++){ if(lists[i].examReceiptDt != undefined && lists[i].examReceiptDt != "" && lists[i].examReceiptDt != null) { varExamReceiptDt = moment(lists[i].examReceiptDt).format("YYYY-MM-DD"); varExamReceiptTm = moment(lists[i].examReceiptDt , "YYYYMMDDHHmmss").format("HH:mm"); } else { varExamReceiptDt = lists[i].examReceiptDt; varExamReceiptTm = lists[i].examReceiptDt; } if(lists[i].examDt != undefined && lists[i].examDt != "" && lists[i].examDt != null) { varExamDt = moment(lists[i].examDt).format("YYYY-MM-DD"); } else { varExamDt = lists[i].examDt; } strDisplayTemp += "
" + "
" + "

" + lists[i].examClsNm + "

" // + "

" + moment(lists[i].examReceiptDt).format("YYYY-MM-DD") + "
" + moment(lists[i].examReceiptDt , "YYYYMMDDHHmmss").format("HH:mm") + "

" + "

" + varExamReceiptDt + "
" + varExamReceiptTm + "

" // + "

" + moment(lists[i].examDt).format("YYYY-MM-DD") + "

" + "

" + varExamDt + "

" + "

" + lists[i].examNm + "

" + "
" + "
" ; //console.log( i + " : " + lists[i].deptNm); } $("#divExamResultRows").append(strDisplayTemp); // element 추가 addEventExamList(); }; var addEventExamList = function() { $("#divExamResultRows .chart-content").off("click"); // 기존 이벤트 해제 $("#divExamResultRows .chart-content").on("click", function(e){ if(varExamlistResultLists[e.currentTarget.attributes.listCnt.value].examRsltTy == "1"){ // 1:검체검사 2:판독결과 3:병리검사 // 환자 정보 화면 띄우기 $("#modalExamRsltTy1").modal("show"); mplusModalExamrsltty1.init(varExamlistResultLists[e.currentTarget.attributes.listCnt.value]); // }else if(varExamlistResultLists[e.currentTarget.attributes.listCnt.value].examRsltTy == "2"){ }else{ // 환자 정보 화면 띄우기 $("#modalExamRsltTy2").modal("show"); mplusModalExamrsltty2.init(varExamlistResultLists[e.currentTarget.attributes.listCnt.value]); //} else { // self.alert("검사결과 타입값에 오류가 있습니다."); } }); }; var btnSetClassDefault = function(){ $(".inquiry-btn").removeClass("on"); }; //==== 초기화 설정 } ==== //==== 이벤트 설정 { ==== var addEvent = function(){ //$("#btnLogout").on("click", function(){ // logout(); //}); eventConditionClick(); eventColumnClick(); eventRowClick(); }; var eventConditionClick = function(){ // 1일 $("#btnExamOneDaySearch").off("click"); // 기존 이벤트 해제 $("#btnExamOneDaySearch").on("click", function(e){ btnSetClassDefault(); $("#btnExamOneDaySearch").addClass("on"); $("#txtExamStartDt").val( moment().subtract(1, 'days').format("YYYY-MM-DD") ); //접수부서 initReceiptDeptList(); }); // 1주 버튼클릭 $("#btnExamOneWeekSearch").off("click"); // 기존 이벤트 해제 $("#btnExamOneWeekSearch").on("click", function(e){ btnSetClassDefault(); $("#btnExamOneWeekSearch").addClass("on"); var varSelDate = new Date($("#txtExamEndDt").val()); varSelDate.setDate(varSelDate.getDate() - 7); $("#txtExamStartDt").val( moment(varSelDate).format("YYYY-MM-DD") ); //접수부서 initReceiptDeptList(); }); // 1달 버튼클릭 $("#btnExamOneMonthSearch").off("click"); // 기존 이벤트 해제 $("#btnExamOneMonthSearch").on("click", function(e){ btnSetClassDefault(); $("#btnExamOneMonthSearch").addClass("on"); $("#txtExamStartDt").val( moment().subtract(1, 'months').format("YYYY-MM-DD") ); //접수부서 initReceiptDeptList(); }); // 3달 버튼클릭 $("#btnExamThreeMonthSearch").off('click'); // 기존 이벤트 해제 $("#btnExamThreeMonthSearch").on('click', function(e){ btnSetClassDefault(); $("#btnExamThreeMonthSearch").addClass("on"); $("#txtExamStartDt").val( moment().subtract(3, 'months').format("YYYY-MM-DD") ); //접수부서 initReceiptDeptList(); }); // 조회버튼 $("#btnExamSearch").off("click"); // 기존 이벤트 해제 $("#btnExamSearch").on("click", function(e){ searchExam(); }); //날짜 변경 시 부서 다시 가져오기 $("#txtExamStartDt").off("change"); // 기존 이벤트 해제 $("#txtExamStartDt").on("change", function(e){ //접수부서 initReceiptDeptList(); }); $("#txtExamEndDt").off("change"); // 기존 이벤트 해제 $("#txtExamEndDt").on("change", function(e){ //접수부서 initReceiptDeptList(); }); }; var eventColumnClick = function(){ }; var eventRowClick = function(){ }; //==== 이벤트 설정 } ==== //==== 서비스 실행 { ==== //==== 서비스 실행 { ==== };