/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.wlyy.repository.patient;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.yihu.wlyy.entity.patient.PatientHealthStandard;

public interface PatientHealthStandardDao extends PagingAndSortingRepository<PatientHealthStandard, Long>, JpaSpecificationExecutor<PatientHealthStandard> {
	// 查询患者健康指标预警值
	Iterable<PatientHealthStandard> findByPatient(String patient);

	@Modifying
	@Query("delete PatientHealthStandard a where a.patient = ?1")
	int deleteByPatient(String patient);

	@Query("select a from PatientHealthStandard a where a.patient = ?1 and a.type = ?2")
	PatientHealthStandard findByPatientType(String patient, int type);
}
