package com.yihu.jw.org.service;

import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.utils.StringUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BaseOrgInfoService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
    @Autowired
    private BaseOrgDao baseOrgDao;

    // 基于市，获取医院列表信息
    public List<BaseOrgDO> getOrgByCity(String cityCode,Integer level) {
        if(level!=null){
            return baseOrgDao.findByCityCodeAndOrgLevel(cityCode,level);
        }
        return baseOrgDao.findByCityCode(cityCode);
    }

    public BaseOrgDO getBaseOrgByCode(String orgCode){
        return baseOrgDao.findByCode(orgCode);
    }

}
