package com.diagbot.facade;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.diagbot.entity.PacsConfig;
import com.diagbot.enums.IsDeleteEnum;
import com.diagbot.service.impl.PacsConfigServiceImpl;
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:10
 */
@Component
public class PacsConfigFacade extends PacsConfigServiceImpl{

    /**
     * 根据医院编码获取辅检公表映射关系 Map<mealName,uniqueName>
     *
     * @return
     */
    public Map<String, String> getPacsConfigByHosCode(String hosCode) {
        QueryWrapper<PacsConfig> pacsConfigQueryWrapper = new QueryWrapper<>();
        pacsConfigQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).eq("hospital_code",hosCode);
        List<PacsConfig> pacsConfigList = this.list(pacsConfigQueryWrapper);
        Map<String, String> retMap=EntityUtil.makeMapWithKeyValue(pacsConfigList, "mealName", "uniqueName");
        return retMap;
    }
}