package com.joju.datamanager.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.joju.datamanager.mapper.IntelligentGuidanceCategoryMapper;
import com.joju.datamanager.mapper.IntelligentGuidanceQuestionsMapper;
import com.joju.datamanager.model.guidance.IntelligentGuidanceCategory;
import com.joju.datamanager.model.guidance.IntelligentGuidanceQuestions;
import com.joju.datamanager.service.IntelligentGuidanceCategoryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @description: 身体部位分类实现类
 * @author: Mr.zs
 * @create: 2024-03-21 18:11
 **/
@Service
public class IntelligentGuidanceCategoryServiceImpl extends ServiceImpl<IntelligentGuidanceCategoryMapper, IntelligentGuidanceCategory> implements IntelligentGuidanceCategoryService {


    @Resource
    IntelligentGuidanceCategoryMapper intelligentGuidanceCategoryMapper;

    @Resource
    IntelligentGuidanceQuestionsMapper intelligentGuidanceQuestionsMapper;

    @Override
    public List<IntelligentGuidanceCategory> getSymptomByBodyAreaType(String bodyAreaType) {
        return intelligentGuidanceCategoryMapper.selectList(new QueryWrapper<IntelligentGuidanceCategory>().eq("body_area_type", bodyAreaType));
    }

    @Override
    public List<IntelligentGuidanceQuestions> getQuestionsByChildId(String childId) {

        return intelligentGuidanceQuestionsMapper.selectList(new QueryWrapper<IntelligentGuidanceQuestions>().eq("parent_id", childId));
    }

    @Override
    public List<IntelligentGuidanceCategory> getAllBodyArea() {

        return intelligentGuidanceCategoryMapper.selectList(new QueryWrapper<IntelligentGuidanceCategory>().select("DISTINCT body_area,body_area_type"));
    }
}
