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

import com.yihu.jw.entity.hospital.family.BasePatientMemberDictDO;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.entity.hospital.message.BaseBannerDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;

public interface WlyyPatientFamilyMemberDao extends PagingAndSortingRepository<WlyyPatientFamilyMemberDO, String>, JpaSpecificationExecutor<WlyyPatientFamilyMemberDO> {
    @Query("from WlyyPatientFamilyMemberDO t where t.patient=?1 and t.familyRelation=?2 and t.isDel = 1")
    List<WlyyPatientFamilyMemberDO> findByPatientAndFamilyRelation(String patient,String familyRelation);
    @Query("from WlyyPatientFamilyMemberDO t where t.id=?1  and t.isDel = 1")
    WlyyPatientFamilyMemberDO findByIdAndDel(String id);
    @Query("from WlyyPatientFamilyMemberDO t where t.cardNo=?1 and t.patient=?2  and t.isDel =1")
    WlyyPatientFamilyMemberDO findbyCardNoAndPatient(String idCard,String patient);
    @Query("from WlyyPatientFamilyMemberDO t where t.patient=?1  and t.isDel =1")
    List<WlyyPatientFamilyMemberDO> findbyPatient(String patient);

    /**
     * 查询居民的某个成员
     *
     * @param patient 居民
     * @param member 成员
     * @return
     */
    WlyyPatientFamilyMemberDO findByPatientAndFamilyMember(String patient,String member);
}
