package com.yihu.jw.dict.service;

import com.yihu.jw.area.dao.BaseCityDao;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.entity.base.area.BaseCityDO;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
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 HospitalDeptService extends BaseJpaService<BaseCityDO, BaseCityDao> {
    @Autowired
    private DictHospitalDeptDao dictHospitalDeptDao;

    // 基于机构编码，获取该机构下所有的科室列表
    public List<DictHospitalDeptDO> getHosDeptByCode(String orgCode,String consultDeptFlag) {
        if(StringUtils.isNotBlank(consultDeptFlag)){
            return dictHospitalDeptDao.findByOrgCodeAndConsultDeptFlag(orgCode,consultDeptFlag);
        }else{
            return dictHospitalDeptDao.findByOrgCode(orgCode);
        }
    }
}
