package com.madeu.service.mobile.mobilehospital.impl;

import com.madeu.constants.Constants;
import com.madeu.dao.mobile.mobilehospital.MobileHospitalSqlMapDAO;
import com.madeu.dao.mobile.mobilejoin.MobileJoinSqlMapDAO;
import com.madeu.service.mobile.mobilehospital.MobileHospitalService;
import com.madeu.util.SecurityUtil;
import com.madeu.util.ValidationCheckUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Slf4j
@Service("MobileHospitalService")
public class MobileHospitalServiceImpl implements MobileHospitalService {

	@Autowired
	private MobileHospitalSqlMapDAO mobileHospitalSqlMapDAO;

	/**
	 * 병원운영시간 조회
	 *
	 * @param paramMap
	 * @return
	 * @throws Exception
	 */
	@Override
	public HashMap<String, Object> selectHospitalWorkTime(
			HashMap<String, Object> paramMap) throws Exception {
		log.debug("MobileHospitalServiceImpl selectHospitalWorkTime START");

		HashMap<String, Object> map = new HashMap<String, Object>();

		log.debug("membershipAccount        :"+paramMap.get("membershipAccount"));

		try{
			List<Map<String, Object>> listMap = mobileHospitalSqlMapDAO.selectHospitalWorkTime(paramMap);
			List<Map<String, Object>> listMap2 = mobileHospitalSqlMapDAO.selectHospitalHoliday(paramMap);

			map.put("msgCode", Constants.OK);
			map.put("success","false");
			if(!listMap.isEmpty()) {
				map.put("workTime",listMap);
			}
			if(!listMap2.isEmpty()) {
				map.put("holiday",listMap2);
			}

		}
		catch(Exception e){
			throw new Exception(e.getMessage());
		}
		log.debug("MobileHospitalServiceImpl selectHospitalWorkTime END");
		return map;
	}

}
