package com.yihu.wlyy.repository.patient;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.yihu.wlyy.entity.device.PatientDevice;;import java.util.List;

public interface PatientDeviceDao extends PagingAndSortingRepository<PatientDevice, Long>, JpaSpecificationExecutor<PatientDevice> {

    @Query("select a from PatientDevice a where a.user = ?1")
	Iterable<PatientDevice> findByUser(String user);

	List<PatientDevice> findByUser(String user,Pageable pageRequest);

	List<PatientDevice> findByUserAndDoctor(String user,String doctor, Pageable pageRequest);

	List<PatientDevice> findByDeviceSnAndCategoryCode(String deviceSn, String categoryCode);

	PatientDevice findByDeviceSnAndCategoryCodeAndUserType(String deviceSn, String categoryCode,String userType);

	PatientDevice findByDeviceIdAndDeviceSnAndUserType(Long deviceId, String deviceSn,String userType);
}
