package com.glxp.mipsdl.config;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.glxp.mipsdl.constant.Constants;
import com.glxp.mipsdl.dao.thrsys.ThrSystemDao;
import com.glxp.mipsdl.entity.thrsys.ThrSystemEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

@Slf4j
@Configuration
public class ThirdSysConfig {

    @Value("${THIRD_ID}")
    private String thirdSys;
    @Value("${THIRD_NAME}")
    private String thirdName;
    @Value("${UDIWMS_IP}")
    private String udiWmsUrl;

    @Resource
    private ThrSystemDao thrSystemDao;

    /**
     * 获取第三方系统信息
     *
     * @return
     */
    public ThrSystemEntity getThirdSysConfig() {
        return thrSystemDao.selectOne(new LambdaQueryWrapper<ThrSystemEntity>().eq(ThrSystemEntity::getThirdId, thirdSys));
    }

    /**
     * 获取第三方系统ID
     *
     * @return
     */
    public String getThirdId() {
        return thirdSys;
    }

    public String getThirdName() {
        return thirdName;
    }

    /**
     * 获取上传产品信息URL
     *
     * @return
     */
    public String getPostPiUrl() {
        return udiWmsUrl + Constants.URL_NAME_POST_THR_PRODUCTS_URL;
    }

    /**
     * 获取上传往来单位信息URL
     *
     * @return
     */
    public String getPostCorpUrl() {
        return udiWmsUrl + Constants.URL_NAME_POST_THR_CORPS_URL;
    }

    /**
     * 获取上传往来单位信息URL
     *
     * @return
     */
    public String getPostOrderUrl() {
        return udiWmsUrl + Constants.URL_NAME_POST_THR_ORDER_URL;
    }

    /**
     * 获取上传库存产品URL
     *
     * @return
     */
    public String getPostInvPiUrl() {
        return udiWmsUrl + Constants.URL_NAME_POST_THR_INV_PRODUCTS_URL;
    }

    /**
     * 获取查询UDI管理系统库存信息接口URL
     *
     * @return
     */
    public String getQueryInvUrl() {
        return udiWmsUrl + Constants.URL_NAME_UDIWMS_PRODUCTS_FILTER_URL;
    }

    /**
     * B001 查询指定科室高值/普耗库存
     *
     * @return
     */
    public String getPostInvProductsFilterUrl() {
        return udiWmsUrl + Constants.URL_NAME_FOR_INV_PRODUCTS_FILTER_URL;
    }


    public String getPostInvHighProductsFilterUrl() {
        return udiWmsUrl + Constants.URL_NAME_FOR_INV_HIGH_PRODUCTS_FILTER_URL;
    }

    /**
     * B002 查询耗材字典
     *
     * @return
     */
    public String getPostBasicProductsSearch() {
        return udiWmsUrl + Constants.URL_NAME_FOR_BASiC_PRODUCTS_SEARCH_URL;
    }

    /**
     * B003 高值耗材实时出库/退库
     *
     * @return
     */
    public String getPostInvOutScanCode() {
        return udiWmsUrl + Constants.URL_NAME_FOR_INV_OUT_SCANCODE_URL;
    }

}
