package com.yihu.jw.hospital.prescription.dao;

import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionCheckDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;


/**
 * Created by wangzhinan on 2020/5/18
 */
public interface PrescriptionCheckDao extends PagingAndSortingRepository<WlyyPrescriptionCheckDO, String>, JpaSpecificationExecutor<WlyyPrescriptionCheckDO> {

    @Query("select a from WlyyPrescriptionCheckDO a where a.prescriptionId = ?1 order by a.createTime desc ")
    List<WlyyPrescriptionCheckDO> findByPrescriptionId(String prescriptionId);

    @Query("select a from WlyyPrescriptionCheckDO a where a.prescriptionId = ?1 and a.status in (1,2,3,4,5) order by a.createTime desc ")
    List<WlyyPrescriptionCheckDO> findByPrescriptionIdAndStatus(String prescriptionId);


    @Query("select a from WlyyPrescriptionCheckDO a where a.prescriptionId = ?1 and a.status=?2 order by a.createTime desc ")
    List<WlyyPrescriptionCheckDO> findByStatus(String prescriptionId,Integer status);

}
