package com.diagbot.facade;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.diagbot.entity.IntroduceTitleConfig;
import com.diagbot.enums.IsDeleteEnum;
import com.diagbot.service.impl.IntroduceTitleConfigServiceImpl;
import com.diagbot.util.EntityUtil;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @Description:
 * @Author:zhaops
 * @time: 2019/3/11 13:16
 */
@Component
public class IntroduceTitleConfigFacade extends IntroduceTitleConfigServiceImpl {

    /**
     * 根据医院编码获取静态知识标题公表映射关系 Map<itemName,uniqueName>
     *
     * @return
     */
    public Map<String, String> getTitleMappingHosCode(String hosCode) {
        QueryWrapper<IntroduceTitleConfig> titleMappingQueryWrapper = new QueryWrapper<>();
        titleMappingQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).eq("hospital_code",hosCode);
        List<IntroduceTitleConfig> titleMappingList = this.list(titleMappingQueryWrapper);
        Map<String, String> retMap= EntityUtil.makeMapWithKeyValue(titleMappingList, "itemName", "uniqueName");
        return retMap;
    }
}
