package com.openhis.ybcatalog.service.impl;

import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.openhis.ybcatalog.domain.CatalogDrugInfoUsual;
import com.openhis.ybcatalog.mapper.CatalogDrugInfoUsualMapper;
import com.openhis.ybcatalog.service.ICatalogDrugInfoUsualService;

/**
 * 西药中成药目录Service业务层处理
 *
 * @author system
 * @date 2025-07-02
 */
@Service
public class CatalogDrugInfoUsualServiceImpl extends ServiceImpl<CatalogDrugInfoUsualMapper, CatalogDrugInfoUsual>
    implements ICatalogDrugInfoUsualService {
    /**
     * 获取药品信息
     */

    @Override
    public Page<CatalogDrugInfoUsual> selectCatalogDrugInfoUsual(Integer pageNo, Integer pageSize, String searchKey) {
        Page<CatalogDrugInfoUsual> page = new Page<>(pageNo, pageSize);
        return (baseMapper.selectPage(page,
            new LambdaQueryWrapper<CatalogDrugInfoUsual>().like(CatalogDrugInfoUsual::getRegisteredName, searchKey).or()
                .like(CatalogDrugInfoUsual::getPinyinCode, searchKey).or()
                .like(CatalogDrugInfoUsual::getWubiCode, searchKey).or()
                .like(CatalogDrugInfoUsual::getApprovalNo, searchKey).or()
                .like(CatalogDrugInfoUsual::getManufacturerName, searchKey)));
    }
}