package com.rf.psychological.file.excel;

import com.rf.psychological.utils.Constant;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * @author zzf
 * @description:Excel导出辅助类，自定义表头和字段英文值
 * @date 2021/1/27 9:21
 */
public class ExcelClass {


    /**
     * 全量导出，自定义flag
     *
     * @param flag
     * @return
     */
    public Map<Integer, List<ExcelBean>> contentExcel(String flag) {
        List<ExcelBean> excel = new ArrayList<>();
        Map<Integer, List<ExcelBean>> map = new LinkedHashMap<>();
        //设置标题栏
        if (Constant.QUEST_TYPE_ASK.equals(flag)) {
            excel.add(new ExcelBean("题号", "no", 0));
            excel.add(new ExcelBean("题目", "content", 0));
            excel.add(new ExcelBean("量表", "scale", 0));
            excel.add(new ExcelBean("选择项", "checkItems", 0));
            excel.add(new ExcelBean("计分方向", "type", 0));
        } else if (Constant.QUEST_TYPE_PSQI.equals(flag)) {
            excel.add(new ExcelBean("题号", "no", 0));
            excel.add(new ExcelBean("题目", "content", 0));
            excel.add(new ExcelBean("选项", "checkItems", 0));
            excel.add(new ExcelBean("选择项", "checked", 0));
        } else if (Constant.QUEST_TYPE_POMS.equals(flag)) {
            excel.add(new ExcelBean("题号", "no", 0));
            excel.add(new ExcelBean("题目", "content", 0));
            excel.add(new ExcelBean("选择项", "checked", 0));
            excel.add(new ExcelBean("分量", "type", 0));
        } else if (Constant.QUEST_TYPE_SCL.equals(flag)) {
            excel.add(new ExcelBean("题号", "no", 0));
            excel.add(new ExcelBean("题目", "content", 0));
            excel.add(new ExcelBean("量表", "type", 0));
            excel.add(new ExcelBean("选择项", "checked", 0));
        } else if (Constant.QUEST_TYPE_AVAI.equals(flag)) {
            excel.add(new ExcelBean("题号", "no", 0));
            excel.add(new ExcelBean("题目", "content", 0));
            excel.add(new ExcelBean("得分", "checked", 0));
        } else if (Constant.QUEST_TYPE_SUPP.equals(flag)) {
            excel.add(new ExcelBean("题号", "no", 0));
            excel.add(new ExcelBean("题目", "content", 0));
            excel.add(new ExcelBean("选项", "checkItems", 0));
            excel.add(new ExcelBean("选择项", "checked", 0));
        } else if (Constant.QUEST_TYPE_DEPR.equals(flag)) {
            excel.add(new ExcelBean("题号", "no", 0));
            excel.add(new ExcelBean("题目", "content", 0));
            excel.add(new ExcelBean("量表", "type", 0));
            excel.add(new ExcelBean("选择项", "checked", 0));
        } else if (Constant.QUEST_TYPE_MOOD.equals(flag)) {
            excel.add(new ExcelBean("题号", "no", 0));
            excel.add(new ExcelBean("题目", "content", 0));
            excel.add(new ExcelBean("情绪方向", "type", 0));
            excel.add(new ExcelBean("选择项", "checked", 0));
        } else if (Constant.QUEST_TYPE_STATUS.equals(flag)) {
            excel.add(new ExcelBean("题号", "no", 0));
            excel.add(new ExcelBean("题目", "content", 0));
            excel.add(new ExcelBean("选择项", "checked", 0));
            excel.add(new ExcelBean("计分方向", "type", 0));
        } else if (Constant.QUEST_TYPE_RIVEN.equals(flag) || Constant.QUEST_TYPE_CDT.equals(flag)) {
            excel.add(new ExcelBean("题号", "key", 0));
            excel.add(new ExcelBean("选择项", "value", 0));
        } else if (Constant.QUEST_TYPE_MOCA.equals(flag) || Constant.QUEST_TYPE_MMSE.equals(flag)) {
            excel.add(new ExcelBean("题号", "key", 0));
            excel.add(new ExcelBean("得分", "value", 0));
        } else if (Constant.QUEST_TYPE_GO_NO_GO.equals(flag)) {
            //excel.add(new ExcelBean("轮次","circle",0));
            excel.add(new ExcelBean("信号颜色", "color", 0));
            //excel.add(new ExcelBean("本轮出现次数","times",0));
            excel.add(new ExcelBean("响应时间", "rspTime", 0));
        } else if (Constant.QUEST_TYPE_GO_NO_GO_ADDICTION.equals(flag)) {
            excel.add(new ExcelBean("信号颜色", "color", 0));
            excel.add(new ExcelBean("响应时间", "rspTime", 0));
            excel.add(new ExcelBean("刺激类型","stimulateType",0));
            excel.add(new ExcelBean("按键正误","rightOrWrong",0));
        } else if (Constant.QUEST_TYPE_ALERTNESS.equals(flag)) {
            excel.add(new ExcelBean("刺激次数", "key", 0));
            excel.add(new ExcelBean("反映时长(ms)", "value", 0));
        } else if (Constant.QUEST_TYPE_ADDITION.equals(flag)) {
            excel.add(new ExcelBean("数字个数", "key", 0));
            excel.add(new ExcelBean("正确次数", "value", 0));
        } else if (Constant.QUEST_TYPE_MEMORY.equals(flag)) {
            excel.add(new ExcelBean("难度等级", "diffLevel", 0));
            excel.add(new ExcelBean("是否需要点击", "ifNeedClick", 0));
            excel.add(new ExcelBean("用户是否点击", "ifUserClick", 0));
            excel.add(new ExcelBean("字符", "letter", 0));
            excel.add(new ExcelBean("响应时长(毫秒)", "userResponseTime", 0));
        } else if (Constant.QUEST_TYPE_LIFE.equals(flag)) {
            excel.add(new ExcelBean("生活事件", "content", 0));
            excel.add(new ExcelBean("发生次数", "checked", 0));
            excel.add(new ExcelBean("单次分值", "score", 0));
        } else if (Constant.QUEST_TYPE_RTC.equals(flag) || Constant.QUEST_TYPE_MTH.equals(flag)) {
            excel.add(new ExcelBean("描述", "key", 0));
            excel.add(new ExcelBean("分值", "value", 0));
        } else if (Constant.QUEST_TYPE_MOVEMENT.equals(flag)) {
            excel.add(new ExcelBean("序号", "index", 0));
            excel.add(new ExcelBean("方向", "diff", 0));
            excel.add(new ExcelBean("噪声", "noise", 0));
            excel.add(new ExcelBean("速度", "dist", 0));
            excel.add(new ExcelBean("运动方向", "direction", 0));
            excel.add(new ExcelBean("用户反应方向", "userResponse", 0));
            excel.add(new ExcelBean("反应时间", "responseTime", 0));
        } else if (Constant.QUEST_TYPE_RHYTHM.equals(flag)) {
            excel.add(new ExcelBean("题号", "questionNo", 0));
            excel.add(new ExcelBean("模式类型", "subType", 0));
            excel.add(new ExcelBean("节拍间隔", "interval", 0));
            excel.add(new ExcelBean("持续时间", "duration", 0));
            excel.add(new ExcelBean("总分", "score", 0));
        } else if (Constant.QUEST_TYPE_ANT.equals(flag)) {
            excel.add(new ExcelBean("序号", "index", 0));
            excel.add(new ExcelBean("展示类型", "type", 0));
            excel.add(new ExcelBean("展示箭头的方向", "currentDir", 0));
            excel.add(new ExcelBean("用户反馈的方向", "userClickDir", 0));
            excel.add(new ExcelBean("反应时间", "responseTime", 0));
            excel.add(new ExcelBean("是否为一致性", "consistency", 0));
        } else if (Constant.QUEST_TYPE_SHAPE.equals(flag) || Constant.QUEST_TYPE_SHAPE2.equals(flag) || Constant.QUEST_TYPE_BIC.equals(flag) || Constant.QUEST_TYPE_MEMORYT.equals(flag) || Constant.QUEST_TYPE_REM.equals(flag)) {
            excel.add(new ExcelBean("序号", "index", 0));
            excel.add(new ExcelBean("正确性", "rightOrWrong", 0));
            excel.add(new ExcelBean("反应时间(毫秒)", "responseTime", 0));
            excel.add(new ExcelBean("难度指数", "diff", 0));
        } else if (Constant.QUEST_TYPE_GTCT.equals(flag)) {
            excel.add(new ExcelBean("序号", "index", 0));
            excel.add(new ExcelBean("难度等级", "diff", 0));
            excel.add(new ExcelBean("运动速度(秒)", "velocity", 0));
            excel.add(new ExcelBean("运动时长", "duration", 0));
            excel.add(new ExcelBean("追踪目标数", "targetNum", 0));
            excel.add(new ExcelBean("正确率(%)", "raghtRate", 0));
        } else if (Constant.QUEST_TYPE_MTT.equals(flag)) {
            excel.add(new ExcelBean("序号", "index", 0));
            excel.add(new ExcelBean("难度等级", "diff", 0));
            excel.add(new ExcelBean("运动速度(秒)", "velocity", 0));
            excel.add(new ExcelBean("运动时长", "duration", 0));
            excel.add(new ExcelBean("追踪目标数", "targetNum", 0));
            excel.add(new ExcelBean("正确率(%)", "raghtRate", 0));
            excel.add(new ExcelBean("反应时间", "responseTime", 0));
        }else if (Constant.QUEST_TYPE_GO_NO_GO2.equals(flag)) {
            excel.add(new ExcelBean("信号颜色", "color", 0));
            excel.add(new ExcelBean("箭头朝向", "arrowDirection", 0));
            excel.add(new ExcelBean("是否需要反应", "needResponse", 0));
            excel.add(new ExcelBean("用户点击方向", "userDirection", 0));
            excel.add(new ExcelBean("反应是否正确", "responseTrue", 0));
            excel.add(new ExcelBean("用户反应时间", "responseTime", 0));
        } else if (Constant.QUEST_TYPE_RDT.equals(flag)) {
            excel.add(new ExcelBean("序号", "index", 0));
            excel.add(new ExcelBean("本轮得分", "currentEarn", 0));
            excel.add(new ExcelBean("点击次数", "numberPumps", 0));
        } else if (Constant.QUEST_TYPE_SC.equals(flag)) {
            excel.add(new ExcelBean("序号", "imgIndex", 0));
            excel.add(new ExcelBean("小球运动速度", "speed", 0));
            excel.add(new ExcelBean("方块长度", "length", 0));
            excel.add(new ExcelBean("误差", "error", 0));
        } else if (Constant.QUEST_TYPE_GBE.equals(flag)) {
            excel.add(new ExcelBean("关卡", "level", 0));
            excel.add(new ExcelBean("是否通过", "isPassed", 0));
            excel.add(new ExcelBean("反应时间", "responseTimeDanger1", 0));
            excel.add(new ExcelBean("反应时间", "responseTimeDanger2", 0));
            excel.add(new ExcelBean("反应时间", "responseTimeDanger3", 0));
            excel.add(new ExcelBean("反应时间", "responseTimeDanger4", 0));
            excel.add(new ExcelBean("得分", "score", 0));
            excel.add(new ExcelBean("错误个数", "errorNum", 0));
            excel.add(new ExcelBean("道路个数", "roadNum", 0));
        } else if (Constant.QUEST_TYPE_XJWL.equals(flag)) {
            excel.add(new ExcelBean("关卡", "nanNan", 0));
            excel.add(new ExcelBean("正确率", "zhengQue", 0));
            excel.add(new ExcelBean("得分", "fenFen", 0));
            excel.add(new ExcelBean("正确个数", "zhengZheng", 0));
            excel.add(new ExcelBean("错误个数", "cuo", 0));
        } else if (Constant.QUEST_TYPE_TKHL.equals(flag) || Constant.SHEET_NAME_HKJZ.equals(flag)) {
            excel.add(new ExcelBean("关卡", "levelNum", 0));
            excel.add(new ExcelBean("反应时间", "everyReactionTimes", 0));
            excel.add(new ExcelBean("平均反应时间", "averageSlideTimes", 0));
            excel.add(new ExcelBean("得分", "scores", 0));
            excel.add(new ExcelBean("正确率", "correctRate", 0));
        } else if (Constant.QUEST_TYPE_XYZC.equals(flag)) {
            excel.add(new ExcelBean("关卡", "levelNum", 0));
            excel.add(new ExcelBean("滑动反应", "everySlideTimes", 0));
            excel.add(new ExcelBean("平均反应时间", "averageSlideTimes", 0));
            excel.add(new ExcelBean("得分", "scores", 0));
        } else if (Constant.QUEST_TYPE_STTA.equals(flag) || Constant.QUEST_TYPE_STTB.equals(flag)) {
            excel.add(new ExcelBean("练习测试时间", "exerciseTime", 0));
            excel.add(new ExcelBean("正式测试时间", "realTime", 0));
            excel.add(new ExcelBean("总时间", "totalTime", 0));
        } else if (Constant.QUEST_TYPE_DST.equals(flag)) {
            excel.add(new ExcelBean("序号", "index", 0));
            excel.add(new ExcelBean("难度等级", "diff", 0));
            excel.add(new ExcelBean("类型", "type", 0));
            excel.add(new ExcelBean("显示顺序", "qNumberSequence", 0));
            excel.add(new ExcelBean("用户反应顺序", "userResponseSequence", 0));
            excel.add(new ExcelBean("反应正确性", "rightOrWrong", 0));
            excel.add(new ExcelBean("反应时间", "responseTime", 0));
        } else if (Constant.QUEST_TYPE_BSNTask.equals(flag)) {
            excel.add(new ExcelBean("序号", "index", 0));
            excel.add(new ExcelBean("图片名", "picName", 0));
            excel.add(new ExcelBean("用户选择", "picChoice", 0));
        } else if (Constant.QUEST_TYPE_AMWSTask.equals(flag) || Constant.QUEST_TYPE_EREC.equals(flag)) {
            excel.add(new ExcelBean("类型", "key", 0));
            excel.add(new ExcelBean("类型值", "value", 0));
        } else if (Constant.QUEST_TYPE_ETB01.equals(flag)) {
            excel.add(new ExcelBean("序号", "index", 0));
            excel.add(new ExcelBean("情绪类型", "emoType", 0));
            excel.add(new ExcelBean("类型值", "emoAmp", 0));
            excel.add(new ExcelBean("选择的情绪类型", "userSelectEmoType", 0));
            excel.add(new ExcelBean("反应时（ms）", "responseTime", 0));
            excel.add(new ExcelBean("正确率", "correct", 0));
        } else if (Constant.QUEST_TYPE_ECAT.equals(flag)) {
            excel.add(new ExcelBean("序号", "index", 0));
            excel.add(new ExcelBean("情绪类型", "wordType", 0));
            excel.add(new ExcelBean("选择的情绪类型", "userSelectWordType", 0));
            excel.add(new ExcelBean("反应时（ms）", "responseTime", 0));
        } else if (Constant.QUEST_TYPE_EMEM.equals(flag)) {
            excel.add(new ExcelBean("序号", "index", 0));
            excel.add(new ExcelBean("情绪类型", "wordType", 0));
            excel.add(new ExcelBean("是否出现过", "appearedOrNot", 0));
            excel.add(new ExcelBean("反应时（ms）", "responseTime", 0));
            excel.add(new ExcelBean("正确性", "correct", 0));
        } else if (Constant.QUEST_TYPE_FDOT.equals(flag)) {
            excel.add(new ExcelBean("序号", "index", 0));
            excel.add(new ExcelBean("情绪类型", "emoType", 0));
            excel.add(new ExcelBean("点出现的位置", "dotPos", 0));
            excel.add(new ExcelBean("反应时（ms）", "responseTime", 0));
            excel.add(new ExcelBean("正确性", "correct", 0));
            excel.add(new ExcelBean("类型", "type", 0));
        } else if (Constant.QUEST_TYPE_MEMORYT2.equals(flag)) {
            excel.add(new ExcelBean("时间间隔", "timeSpan", 0));
            excel.add(new ExcelBean("是否是相同图片", "same", 0));
            excel.add(new ExcelBean("左键或右键", "keyType", 0));
            excel.add(new ExcelBean("用户反应是否正确", "userResponse", 0));
            excel.add(new ExcelBean("反应时间", "responseTime", 0));
        } else if (Constant.QUEST_TYPE_ANT_FISH_V2.equals(flag)) {
            excel.add(new ExcelBean("序号", "id", 0));
            excel.add(new ExcelBean("箭头朝向", "answer", 0));
            excel.add(new ExcelBean("展示类型", "pattern", 0));
            excel.add(new ExcelBean("cue类型", "cue", 0));
            excel.add(new ExcelBean("箭头出现的位置", "position", 0));
            excel.add(new ExcelBean("是否一致", "consistency", 0));
            excel.add(new ExcelBean("用户反应方向", "userClickFlag", 0));
            excel.add(new ExcelBean("用户反应是否正确", "userResponse", 0));
            excel.add(new ExcelBean("反应时间", "responseTime", 0));
        }else if (Constant.QUEST_TYPE_FDOT_CHILD.equals(flag)) {
            excel.add(new ExcelBean("序号", "index", 0));
            excel.add(new ExcelBean("情绪类型", "emoType", 0));
            excel.add(new ExcelBean("点出现的位置", "dotPos", 0));
            excel.add(new ExcelBean("反应时（ms）", "responseTime", 0));
            excel.add(new ExcelBean("正确性", "correct", 0));
            excel.add(new ExcelBean("类型", "type", 0));
            excel.add(new ExcelBean("积极偏向", "positiveBias", 0));
            excel.add(new ExcelBean("消极偏向", "negativeBias", 0));
        } else if (Constant.QUEST_TYPE_STROOP_TASK.equals(flag)) {
            excel.add(new ExcelBean("序号", "index", 0));
            excel.add(new ExcelBean("类型", "diff", 0));
            excel.add(new ExcelBean("用户反馈的方向", "clickLorR", 0));
            excel.add(new ExcelBean("正确性", "rightOrWrong", 0));
            excel.add(new ExcelBean("反应时间(毫秒)", "responseTime", 0));
        } else if (Constant.QUEST_TYPE_EAT.equals(flag)) {
            excel.add(new ExcelBean("图片名称", "name", 0));
            excel.add(new ExcelBean("情绪类型", "emoType", 0));
            excel.add(new ExcelBean("用户反应类型", "userResponse", 0));
            excel.add(new ExcelBean("是否正确", "correct", 0));
            excel.add(new ExcelBean("吸引力", "xiyin", 0));
            excel.add(new ExcelBean("愉悦度", "yuyue", 0));
            excel.add(new ExcelBean("唤醒度", "huanxing", 0));
            excel.add(new ExcelBean("优势度", "youshi", 0));
        } else if (Constant.QUEST_TYPE_EPRT.equals(flag)) {
            excel.add(new ExcelBean("图片名称", "name", 0));
            excel.add(new ExcelBean("恐惧等级", "level", 0));
            excel.add(new ExcelBean("效价", "xiaojia", 0));
            excel.add(new ExcelBean("唤起度", "huanqi", 0));
            excel.add(new ExcelBean("优势度", "youshi", 0));
        } else if (Constant.QUEST_TYPE_STFS.equals(flag)) {
            excel.add(new ExcelBean("左边显示词汇", "leftWord", 0));
            excel.add(new ExcelBean("右侧比对词汇", "rightWord", 0));
            excel.add(new ExcelBean("词汇类型，0-具体，1-抽象", "type", 0));
            excel.add(new ExcelBean("词汇关系，0-相关，1-不相关", "relation", 0));
            excel.add(new ExcelBean("用户输入等级", "rank", 0));
        }
        map.put(0, excel);
        return map;
    }

    /**
     * 全量导出，自定义flag
     *
     * @param
     * @return
     */
    public Map<Integer, List<ExcelBean>> contentExcel() {
        List<ExcelBean> excel = new ArrayList<>();
        Map<Integer, List<ExcelBean>> map = new LinkedHashMap<>();
        //设置标题栏
        excel.add(new ExcelBean("题号", "questionNo", 0));
        excel.add(new ExcelBean("题目", "answer", 0));
        excel.add(new ExcelBean("选择项", "checkItems", 0));
        excel.add(new ExcelBean("类型", "questionType", 0));
        excel.add(new ExcelBean("计分方向", "scoreDirection", 0));
        map.put(0, excel);
        return map;
    }

    public Map<Integer, List<ExcelBean>> userExportExcel() {
        List<ExcelBean> excel = new ArrayList<>();
        Map<Integer, List<ExcelBean>> map = new LinkedHashMap<>();
        //设置标题栏
        excel.add(new ExcelBean("机构名称", "institutionName", 0));
        excel.add(new ExcelBean("机构编号", "institutionNo", 0));
        excel.add(new ExcelBean("姓名", "petName", 0));
        excel.add(new ExcelBean("性别", "gender", 0));
        excel.add(new ExcelBean("出生年月", "birthday", 0));
        excel.add(new ExcelBean("职业", "profession", 0));
        excel.add(new ExcelBean("附加信息", "additionInfo", 0));
        excel.add(new ExcelBean("账号", "phone", 0));
        excel.add(new ExcelBean("密码", "password", 0));
        map.put(0, excel);
        return map;
    }
            /*excel.add(new ExcelBean("任务","backCount",0));
            excel.add(new ExcelBean("组块","groupCount",0));
            excel.add(new ExcelBean("字符次序","charShowCount",0));
            excel.add(new ExcelBean("字符","charStr",0));
            excel.add(new ExcelBean("响应时长(毫秒)","time",0));*/

    /**
     * 自定义导出
     *
     * @param entryMap key:中文表头  value 英文字段，与实体类一一对应
     * @return
     */
    public Map<Integer, List<ExcelBean>> contentExcel(Map<String, String> entryMap) {
        List<ExcelBean> excel = new ArrayList<>();
        Map<Integer, List<ExcelBean>> map = new LinkedHashMap<>();
        //设置标题栏
        for (Map.Entry<String, String> entry : entryMap.entrySet()) {
            excel.add(new ExcelBean(entry.getValue(), entry.getKey(), 0));
            map.put(0, excel);
        }
        return map;
    }
}
