|
@ -0,0 +1,36 @@
|
|
|
package com.yihu.jw.health;
|
|
|
|
|
|
import com.yihu.jw.entity.base.health.PatientHealthRecordSports;
|
|
|
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.Modifying;
|
|
|
import org.springframework.data.jpa.repository.Query;
|
|
|
import org.springframework.data.repository.PagingAndSortingRepository;
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
public interface PatientHealthRecordSportsDao extends PagingAndSortingRepository<PatientHealthRecordSports, Long>, JpaSpecificationExecutor<PatientHealthRecordSports> {
|
|
|
|
|
|
// 查询患者标识健康记录
|
|
|
@Query("select a from PatientHealthRecordSports a where a.patient = ?1 and a.del = '1'")
|
|
|
Iterable<PatientHealthRecordSports> findByPatient(String patient);
|
|
|
|
|
|
// 查询最近的健康记录
|
|
|
@Query("SELECT a FROM PatientHealthRecordSports a WHERE a.patient = ?1 and a.del = '1' ORDER BY a.recordDate DESC")
|
|
|
Page<PatientHealthRecordSports> findRecentByPatient(String patient, Pageable pageRequest);
|
|
|
|
|
|
@Query("select a from PatientHealthRecordSports a where a.patient = ?1 and a.recordDate >= ?2 and a.recordDate <= ?3 and a.del = '1' order by a.recordDate desc")
|
|
|
Page<PatientHealthRecordSports> findSportsByPatient(String patient, Date start, Date end, Pageable pageRequest);
|
|
|
|
|
|
// 修改运动记录
|
|
|
@Modifying
|
|
|
@Query("update PatientHealthRecordSports a set a.recordDate = ?2,a.sportsTime= ?3 ,a.sportsType = ?4,a.sportsTypeName= ?5,a.sports = ?6 ,a.sportsName= ?7 where a.id= ?1 ")
|
|
|
void modifySports(long id, Date value1, Double value2, String value3, String typeName, String value4, String sportName);
|
|
|
|
|
|
// 删除运动记录
|
|
|
@Modifying
|
|
|
@Query("update PatientHealthRecordSports a set a.del = 0 where a.id= ?1 ")
|
|
|
void deleteSports(long id);
|
|
|
|
|
|
}
|