ConsultDao.java 1.9 KB

123456789101112131415161718192021222324252627282930313233
  1. package com.yihu.wlyy.repository.consult;
  2. import org.springframework.data.domain.Page;
  3. import org.springframework.data.domain.Pageable;
  4. import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
  5. import org.springframework.data.jpa.repository.Query;
  6. import org.springframework.data.repository.PagingAndSortingRepository;
  7. import com.yihu.wlyy.entity.consult.Consult;
  8. public interface ConsultDao extends PagingAndSortingRepository<Consult, Long>, JpaSpecificationExecutor<Consult> {
  9. Consult findByCode(String code);
  10. // 查询患者咨询记录
  11. @Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status from Consult a,ConsultTeam b where a.code = b.consult and a.patient = ?1 and a.del = '1' and a.symptoms like ?2 order by a.czrq desc")
  12. Page<Object> findByPatient(String patient,String title, Pageable pageRequest);
  13. // 查询患者咨询记录
  14. @Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status from Consult a,ConsultTeam b where a.code = b.consult and a.patient = ?1 and a.id < ?3 and a.del = '1'and a.symptoms like ?2 order by a.czrq desc")
  15. Page<Object> findByPatient(String patient,String title, long id, Pageable pageRequest);
  16. // 查询患者咨询记录
  17. @Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status from Consult a,ConsultTeam b where a.code = b.consult and a.patient = ?1 and a.del = '1' order by a.czrq desc")
  18. Page<Object> findByPatient(String patient, Pageable pageRequest);
  19. // 查询患者咨询记录
  20. @Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status from Consult a,ConsultTeam b where a.code = b.consult and a.patient = ?1 and a.id < ?2 and a.del = '1'order by a.czrq desc")
  21. Page<Object> findByPatient(String patient, long id, Pageable pageRequest);
  22. @Query("select count(a) from Consult a,ConsultTeamDoctor b where a.code = b.consult and a.patient=?1 and b.to=?2 ")
  23. Integer findByPatient(String patientCode,String doctorCode);
  24. }