123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- "use strict";
- /**
- * mplus_modal_doctorworkschdetail
- */
- var mplus_modal_doctorworkschdetail = function(){
- // 상속
- mplus_common.call(this);
-
- //선택일자 일요일 전역변수
- var varSelDate;
- var gParam;
-
- // 상위 객체 생성
- //var mplusPatient = new mplus_mobile_patient();
- //var mplusNursing = new mplus_nursing();
-
- //super
- var self = this;
-
- //==== 변수 { ====
- //==== 변수 } ====
-
- /**
- * 초기화
- */
- this.init = function(initParam){ //여기서 모든화면 콤보박스데이터를 집어넣자!!! 그래야지 화면이동할때 속도가 오래걸리지않음!!!
- if(initParam === undefined || initParam == null || initParam == ""){
- self.alert("데이터 오류입니다. 관리자에게 문의하세요.");
- return;
- }
- gParam = initParam;
-
- // 초기 화면 조건 구성
- initCondition();
-
- // 이벤트 초기화
- addEvent();
-
- //검색
- searchWorkSch();
- };
-
- //==== 초기화 설정 { ====
- var initCondition = function(){
- // 초기 화면 조건 구성
- $("#spanDoctorWorkSchDocId").text(gParam.doctorId);
- $("#spanDoctorWorkSchDocNm").text(gParam.doctorNm);
-
- initStartEndDate();
- };
-
- var initStartEndDate = function(){
- varSelDate = new Date();
- varSelDate.setYear(moment(gParam.searchMonth , "YYYY-MM").format("YYYY"));
- varSelDate.setMonth(moment(gParam.searchMonth , "YYYY-MM").format("MM")-1);//Date 자료형은 Month -1
- varSelDate.setDate(1); // 1일고정
- //console.log("varSelDate : " + moment(varSelDate).format("YYYY-MM-DD") + " / varSelDate.getFullYear() : "+ varSelDate.getFullYear());
-
- $("#txtDoctorWorkSchYear").text(moment(varSelDate).format("YYYY"));
- $("#txtDoctorWorkSchMonth").text(moment(varSelDate).format("MM"));
- };
- //==== 초기화 설정 } ====
-
- //==== 이벤트 설정 { ====
- var addEvent = function(){
- //$("#btnLogout").on("click", function(){
- // logout();
- //});
-
- eventConditionClick();
-
- eventColumnClick();
-
- eventRowClick();
- };
- var eventConditionClick = function(){
- // 전 달 버튼클릭
- $("#btnDoctorWorkSchMonthSchBefore").off("click"); // 기존 이벤트 해제
- $("#btnDoctorWorkSchMonthSchBefore").on("click", function(e){
- varSelDate.setMonth(varSelDate.getMonth() -1);
- $("#txtDoctorWorkSchYear").text(moment(varSelDate).format("YYYY"));
- $("#txtDoctorWorkSchMonth").text(moment(varSelDate).format("MM"));
- searchWorkSch();
- });
-
- // 다음 달 버튼클릭
- $("#btnDoctorWorkSchMonthSchNext").off("click"); // 기존 이벤트 해제
- $("#btnDoctorWorkSchMonthSchNext").on("click", function(e){
- varSelDate.setMonth(varSelDate.getMonth() +1);
- $("#txtDoctorWorkSchYear").text(moment(varSelDate).format("YYYY"));
- $("#txtDoctorWorkSchMonth").text(moment(varSelDate).format("MM"));
- searchWorkSch();
- });
- };
-
- var eventColumnClick = function(){
- };
-
- var eventRowClick = function(){
-
- };
- //==== 이벤트 설정 } ====
-
- var searchWorkSch = function(){
- var param = {
- userId:gParam.doctorId,
- dutyMonth:moment(varSelDate).format("YYYYMM"),
- jobCls:"D"
- };
- self.schedule.getOnDutyMonthSch(param, processSearchWorkSch);
- };
-
- // 스케줄 정보 조회 결과 처리
- var processSearchWorkSch = function(lists){
- // 1. 스케줄 조회 결과 리스트를 varResultLists로 복사
- //console.log("test : " + JSON.stringify(lists));
-
- // 3. 스케줄 검색 결과를 화면에 disaplay
- if(lists != null && lists !== undefined){
- drawWorkSchList(lists);
- }else{
- self.alert("데이터 오류입니다. 관리자에게 문의하세요.");
- }
- };
-
- // 환자 정보 화면에 그리기
- var drawWorkSchList = function(lists){
- //1.검색월 전월 일수, 다음월 일수 구하기
- //2.각 위치에 해당하는 Data처리
- //3.Data 및 달력 조합 출력
-
- var strDisplayTemp = "";
- $("#divDoctorWorkSchResultRows").empty();
-
- var tempSelDate = new Date(varSelDate);
- tempSelDate.setDate(tempSelDate.getDate() - tempSelDate.getDay());
- var lastDays = 32 - new Date(varSelDate.getFullYear(), varSelDate.getMonth(), 32).getDate(); //해당 검색달의 일수
- //전월 일요일까지 수 + 검색월 일수 + 다음달 토요일까지 일수
- var vSchFullCnt = lastDays + varSelDate.getDay() - (new Date(varSelDate.getFullYear() , varSelDate.getMonth(), lastDays)).getDay() + 6;
- //console.log("(new Date(varSelDate.getFullYear() , varSelDate.getMonth(), lastDays)).getDay() : " + vSchFullCnt);
-
- //일자 채우기
- for(var vSchCnt = 0 ; vSchCnt < vSchFullCnt ;){
- strDisplayTemp += "<div class=\"row\">";
- for(var fCnt=0;fCnt<7;fCnt++){
- strDisplayTemp += " <div id=\"divDoctorWorkSchDate" + moment(tempSelDate).format("MMDD") + "\" class=\"col-sm-2 col-xs-2 " +((tempSelDate.getMonth() != varSelDate.getMonth())? "disable":"" )+ "\" style=\"padding:0px;\"><p>"+ tempSelDate.getDate() +"</p></div>";
- tempSelDate.setDate(tempSelDate.getDate() + 1);
- vSchCnt++;
- }
- strDisplayTemp +=" </div>";
- }
- $("#divDoctorWorkSchResultRows").append(strDisplayTemp);
-
- //달력이 그려진 후 append
- for(var objLength=0 ; objLength < lists.length ; objLength++){
- if(lists[objLength].dutyTxt != null && lists[objLength].dutyTxt != ""){
- var varDoctorWorkSchDateTail = moment(lists[objLength].dutyDt , "YYYY-MM-DD").format("MMDD");
- var TempKey = (lists[objLength].dutyTxt).replace(/\//g , "/<br/>");
- var strPtage = "<p style=\"font-size: 12px;\">"+ TempKey +"</p>";
- $("#divDoctorWorkSchDate"+varDoctorWorkSchDateTail).append(strPtage);
- }
- }
- };
-
- //==== 서비스 실행 { ====
- //==== 서비스 실행 { ====
-
- };
|