package com.madeu.dao.web.webStatistics;

import jakarta.annotation.PostConstruct;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository
public class WebStatisticsSqlMapDAO extends SqlSessionDaoSupport{

    @Autowired
    private SqlSessionTemplate sqlSessionTemplate;

    @PostConstruct
    void init() {
        setSqlSessionTemplate(sqlSessionTemplate);
    }

    /**
     * 대시보드 매출 - 매출금액조회
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectTotalPaymentAmount(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectTotalPaymentAmount START");
        String sqlId = "WebStatistics.selectTotalPaymentAmount";
        logger.debug("WebStatisticsSqlMapDAO selectTotalPaymentAmount END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 대시보드 매출 - 진료항목별 건수 조회
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectTotalTreatmentCount(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectTotalTreatmentCount START");
        String sqlId = "WebStatistics.selectTotalTreatmentCount";
        logger.debug("WebStatisticsSqlMapDAO selectTotalTreatmentCount END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    /**
     * 대시보드 매출 - 진료항목별 건수 조회
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectTotalTreatmentCountAmount(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectTotalTreatmentCountAmount START");
        String sqlId = "WebStatistics.selectTotalTreatmentCountAmount";
        logger.debug("WebStatisticsSqlMapDAO selectTotalTreatmentCountAmount END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    /**
     * 대시보드 매출 - 성별에 따른 방문자수 조회
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectTotalVisitorCount(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectTotalVisitorCount START");
        String sqlId = "WebStatistics.selectTotalVisitorCount";
        logger.debug("WebStatisticsSqlMapDAO selectTotalVisitorCount END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    /**
     * 대시보드 매출 - 성별에 따른 방문자수 조회
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectTotalVisitorGenderCount(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectTotalVisitorGenderCount START");
        String sqlId = "WebStatistics.selectTotalVisitorGenderCount";
        logger.debug("WebStatisticsSqlMapDAO selectTotalVisitorGenderCount END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    /**
     * 대시보드 매출 - 진료항목별 일별 매출 그래프
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectStatisticsDailyPayment(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsDailyPayment START");
        String sqlId = "WebStatistics.selectStatisticsDailyPayment";
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsDailyPayment END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    /**
     * 대시보드 매출 - 전월 일별 매출 금액
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectStatisticsPrevPayment(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsPrevPayment START");
        String sqlId = "WebStatistics.selectStatisticsPrevPayment";
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsPrevPayment END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    /**
     * 대시보드 매출 - 당월 일별 매출 금액
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectStatisticsThisPayment(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsThisPayment START");
        String sqlId = "WebStatistics.selectStatisticsThisPayment";
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsThisPayment END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    /**
     * 대시보드 매출 - 진료항목별 월매출 그래프
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectStatisticsMonthPayment(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsMonthPayment START");
        String sqlId = "WebStatistics.selectStatisticsMonthPayment";
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsMonthPayment END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    /**
     * 대시보드 매출 - 검색 날짜 조회
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectListStatisticsDate(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectListStatisticsDate START");
        String sqlId = "WebStatistics.selectListStatisticsDate";
        logger.debug("WebStatisticsSqlMapDAO selectListStatisticsDate END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    /**
     * 대시보드 매출 - 검색 이전달 날짜 조회
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectListStatisticsLastDate(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectListStatisticsLastDate START");
        String sqlId = "WebStatistics.selectListStatisticsLastDate";
        logger.debug("WebStatisticsSqlMapDAO selectListStatisticsLastDate END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 결제통계 - 상태별 금액
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectTotalPaymentAmountStatus(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectTotalPaymentAmountStatus START");
        String sqlId = "WebStatistics.selectTotalPaymentAmountStatus";
        logger.debug("WebStatisticsSqlMapDAO selectTotalPaymentAmountStatus END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 결제통계 - 결제수단별 금액
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectTotalPaymentAmountCategory(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectTotalPaymentAmountCategory START");
        String sqlId = "WebStatistics.selectTotalPaymentAmountCategory";
        logger.debug("WebStatisticsSqlMapDAO selectTotalPaymentAmountCategory END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 결제통계 - 결제수단별 금액
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectListStatisticsPayment(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectListStatisticsPayment START");
        String sqlId = "WebStatistics.selectListStatisticsPayment";
        logger.debug("WebStatisticsSqlMapDAO selectListStatisticsPayment END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 진료통계 - 진료별 건수, 결제금액
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectTotalPaymentAmountTreatment(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectTotalPaymentAmountTreatment START");
        String sqlId = "WebStatistics.selectTotalPaymentAmountTreatment";
        logger.debug("WebStatisticsSqlMapDAO selectTotalPaymentAmountTreatment END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 진료통계 - 당월 일별 진료별 금액 (진료 매출 트렌드)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectStatisticsThisPaymentTreatment(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsThisPaymentTreatment START");
        String sqlId = "WebStatistics.selectStatisticsThisPaymentTreatment";
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsThisPaymentTreatment END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 진료통계 - 닥터/상담 매출 비중
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectListStatisticsClinicMember(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectListStatisticsClinicMember START");
        String sqlId = "WebStatistics.selectListStatisticsClinicMember";
        logger.debug("WebStatisticsSqlMapDAO selectListStatisticsClinicMember END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 진료통계 - 매출 TOP 10 시술
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectListStatisticsPaymentTreatmentTop(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectListStatisticsPaymentTreatmentTop START");
        String sqlId = "WebStatistics.selectListStatisticsPaymentTreatmentTop";
        logger.debug("WebStatisticsSqlMapDAO selectListStatisticsPaymentTreatmentTop END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 진료통계 - 상세내역
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectListStatisticsPaymentClinic(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectListStatisticsPaymentClinic START");
        String sqlId = "WebStatistics.selectListStatisticsPaymentClinic";
        logger.debug("WebStatisticsSqlMapDAO selectListStatisticsPaymentClinic END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 고객통계 - 고객유형(초진/재진)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectStatisticsVisitorFirstYn(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsVisitorFirstYn START");
        String sqlId = "WebStatistics.selectStatisticsVisitorFirstYn";
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsVisitorFirstYn END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 고객통계 - 멤버십 회원
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectTotalVisitorMembership(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectTotalVisitorMembership START");
        String sqlId = "WebStatistics.selectTotalVisitorMembership";
        logger.debug("WebStatisticsSqlMapDAO selectTotalVisitorMembership END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 고객통계 - 방문고객 트렌드 초진/재진
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectStatisticsThisVisitorFirstYn(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsThisVisitorFirstYn START");
        String sqlId = "WebStatistics.selectStatisticsThisVisitorFirstYn";
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsThisVisitorFirstYn END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 고객통계 - 예약유형
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectStatisticsVisitorCategory(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsVisitorCategory START");
        String sqlId = "WebStatistics.selectStatisticsVisitorCategory";
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsVisitorCategory END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 고객통계 - 성별/연령
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectStatisticsVisitorGenderAge(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsVisitorGenderAge START");
        String sqlId = "WebStatistics.selectStatisticsVisitorGenderAge";
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsVisitorGenderAge END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 고객통계 - 국적
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectStatisticsVisitorNationality(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsVisitorNationality START");
        String sqlId = "WebStatistics.selectStatisticsVisitorNationality";
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsVisitorNationality END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 고객통계 - 고객구분
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectStatisticsVisitorUserType(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsVisitorUserType START");
        String sqlId = "WebStatistics.selectStatisticsVisitorUserType";
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsVisitorUserType END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 고객통계 - 상세내역
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectListStatisticsUser(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectListStatisticsUser START");
        String sqlId = "WebStatistics.selectListStatisticsUser";
        logger.debug("WebStatisticsSqlMapDAO selectListStatisticsUser END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 푸시통계 - 앱푸시, SMS, 알림톡 건수 / 비용
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectTotalCountAmountPush(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectTotalCountAmountPush START");
        String sqlId = "WebStatistics.selectTotalCountAmountPush";
        logger.debug("WebStatisticsSqlMapDAO selectTotalCountAmountPush END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 푸시통계 - 당월 일별 앱푸시 건수 (푸시 트렌드)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectStatisticsThisAppPush(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsThisAppPush START");
        String sqlId = "WebStatistics.selectStatisticsThisAppPush";
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsThisAppPush END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 푸시통계 - 당월 일별 SMS 건수 (푸시 트렌드)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectStatisticsThisSms(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsThisSms START");
        String sqlId = "WebStatistics.selectStatisticsThisSms";
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsThisSms END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 푸시통계 - 당월 일별 알림톡 건수 (푸시 트렌드)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectStatisticsThisKakao(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsThisKakao START");
        String sqlId = "WebStatistics.selectStatisticsThisKakao";
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsThisKakao END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 푸시통계 - 당월 일별 비용
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectStatisticsThisTotalAmount(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsThisTotalAmount START");
        String sqlId = "WebStatistics.selectStatisticsThisTotalAmount";
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsThisTotalAmount END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 푸시통계 - 전송상태 비율
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectStatisticsPushState(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsPushState START");
        String sqlId = "WebStatistics.selectStatisticsPushState";
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsPushState END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 푸시통계 - 알림톡 전송통계
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectStatisticsKakaoTemplateCountYn(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsKakaoTemplateCountYn START");
        String sqlId = "WebStatistics.selectStatisticsKakaoTemplateCountYn";
        logger.debug("WebStatisticsSqlMapDAO selectStatisticsKakaoTemplateCountYn END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 푸시통계 - 상세내역
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectListStatisticsPush(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebStatisticsSqlMapDAO selectListStatisticsPush START");
        String sqlId = "WebStatistics.selectListStatisticsPush";
        logger.debug("WebStatisticsSqlMapDAO selectListStatisticsPush END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

}
