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

import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionLogDO;
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 Trick on 2019/5/17.
 */
public interface PrescriptionLogDao extends PagingAndSortingRepository<WlyyPrescriptionLogDO, String>, JpaSpecificationExecutor<WlyyPrescriptionLogDO> {

    List<WlyyPrescriptionLogDO> findByOutpatientIdOrderByCreateTimeDesc(String outpatientId);

    List<WlyyPrescriptionLogDO> findByPrescriptionCodeOrderByCreateTimeDesc(String prescriptionCode);

    @Query("select a from WlyyPrescriptionLogDO a where a.prescriptionCode = ?1 and a.status in(20,30,10,100)  order by a.createTime asc ")
    List<WlyyPrescriptionLogDO> findByPrescriptionCodeByStatus(String prescriptionCode);
}
