package com.yihu.jw.patient.dao;

import com.yihu.jw.entity.base.patient.BasePatientBusinessDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

/**
 *
 */
public interface BasePatientBusinessDao extends PagingAndSortingRepository<BasePatientBusinessDO, String>, JpaSpecificationExecutor<BasePatientBusinessDO> {
    @Query("select a from BasePatientBusinessDO a where a.del=1 and a.id=?1")
    BasePatientBusinessDO findByIdAndDel(String id);

    @Query("select a from BasePatientBusinessDO a where a.del=1 and a.patient=?1 and a.relationCode=?2")
    BasePatientBusinessDO findByPatientAndRelationCodeAndDel(String patient,String relationCode);

    @Query("from BasePatientBusinessDO a where a.del=1 and a.patient=?1 and a.relationCode=?2 and a.doctor = ?3")
    BasePatientBusinessDO findByDoctorPatientRelationCode(String patient,String relationCode,String doctor);

}
