package com.ruoyi.web.modules.diagnosis.service.impl;

import java.util.Collections;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.web.modules.diagnosis.domain.AppOnlineConsultVetQuery;
import com.ruoyi.web.modules.diagnosis.domain.vo.AppOnlineConsultVetListVo;
import com.ruoyi.web.modules.diagnosis.mapper.AppOnlineConsultMapper;
import com.ruoyi.web.modules.diagnosis.service.IAppOnlineConsultService;

/**
 * 移动端在线问诊。
 */
@Service
public class AppOnlineConsultServiceImpl implements IAppOnlineConsultService
{
    @Autowired
    private AppOnlineConsultMapper appOnlineConsultMapper;

    @Override
    public List<AppOnlineConsultVetListVo> selectOnlineConsultVetList(AppOnlineConsultVetQuery query)
    {
        AppOnlineConsultVetQuery effective = normalize(query);
        List<AppOnlineConsultVetListVo> list = appOnlineConsultMapper.selectOnlineConsultVetList(effective);
        return list != null ? list : Collections.emptyList();
    }

    private static AppOnlineConsultVetQuery normalize(AppOnlineConsultVetQuery query)
    {
        AppOnlineConsultVetQuery q = query != null ? query : new AppOnlineConsultVetQuery();
        if (StringUtils.isNotEmpty(q.getResourceName()))
        {
            q.setResourceName(q.getResourceName().trim());
        }
        else
        {
            q.setResourceName(null);
        }
        return q;
    }
}
