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 and a.del =?2")
	Iterable<PatientDevice> findByUser(String user,int del);

	List<PatientDevice> findByUserAndDel(String user,int del,Pageable pageRequest);

	List<PatientDevice> findByUserAndDoctorAndDel(String user,String doctor,int del, Pageable pageRequest);

	List<PatientDevice> findByDeviceSnAndCategoryCodeAndDel(String deviceSn, String categoryCode,int del);

	PatientDevice findByDeviceSnAndCategoryCodeAndUserTypeAndDel(String deviceSn, String categoryCode,String userType,int del);

	PatientDevice findByDeviceIdAndDeviceSnAndUserTypeAndDel(Long deviceId, String deviceSn,String userType,int del);
}
