package com.fs.his.mapper;

import java.util.List;

import com.fs.his.domain.FsDoctorPrescribeDrug;
import com.fs.his.domain.FsPrescribe;
import com.fs.his.domain.FsPrescribeDrug;
import com.fs.his.domain.FsStoreProduct;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

/**
 * 处方药品Mapper接口
 *
 * @author fs
 * @date 2023-06-13
 */
public interface FsPrescribeDrugMapper
{
    /**
     * 查询处方药品
     *
     * @param drugId 处方药品主键
     * @return 处方药品
     */
    public FsPrescribeDrug selectFsPrescribeDrugByDrugId(Long drugId);

    /**
     * 查询处方药品列表
     *
     * @param fsPrescribeDrug 处方药品
     * @return 处方药品集合
     */
    public List<FsPrescribeDrug> selectFsPrescribeDrugList(FsPrescribeDrug fsPrescribeDrug);

    /**
     * 新增处方药品
     *
     * @param fsPrescribeDrug 处方药品
     * @return 结果
     */
    public int insertFsPrescribeDrug(FsPrescribeDrug fsPrescribeDrug);

    /**
     * 修改处方药品
     *
     * @param fsPrescribeDrug 处方药品
     * @return 结果
     */
    public int updateFsPrescribeDrug(FsPrescribeDrug fsPrescribeDrug);

    /**
     * 删除处方药品
     *
     * @param drugId 处方药品主键
     * @return 结果
     */
    public int deleteFsPrescribeDrugByDrugId(Long drugId);

    /**
     * 批量删除处方药品
     *
     * @param drugIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteFsPrescribeDrugByDrugIds(Long[] drugIds);
    @Select("SELECT * FROM fs_prescribe WHERE `status`=0")
    List<FsPrescribe> selectFsPrescribeNoAudit();
    @Select("SELECT * FROM fs_prescribe_drug WHERE drug_img_url is not NULL AND drug_img_url!='' AND drug_img_url LIKE '%htj-1258038825.cos.ap-beijing.myqcloud.com%' ")
    List<FsPrescribeDrug> selectFsPrescribeDrugListByImg();
    @Select("SELECT * FROM fs_doctor_prescribe_drug WHERE drug_img_url is not NULL AND drug_img_url!='' AND drug_img_url LIKE '%htj-1258038825.cos.ap-beijing.myqcloud.com%' ")
    List<FsDoctorPrescribeDrug> selectFsPrescribeDrugListByImg2();
    @Select("select * from fs_store_product where product_name=#{drugName} and store_id=#{storeId} LIMIT 1 ")
    FsStoreProduct selectFsPrescribeDrugCode(@Param("drugName") String drugName, @Param("storeId")Long storeId);
}
