PatientDiseaseDao.java 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package com.yihu.wlyy.repository.patient;
  2. import com.yihu.wlyy.entity.patient.PatientDisease;
  3. import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
  4. import org.springframework.data.jpa.repository.Modifying;
  5. import org.springframework.data.jpa.repository.Query;
  6. import org.springframework.data.repository.PagingAndSortingRepository;
  7. import java.util.List;
  8. /**
  9. * 患者疾病Dao
  10. *
  11. * Created by lyr on 2016/09/09.
  12. */
  13. public interface PatientDiseaseDao extends PagingAndSortingRepository<PatientDisease, Long>, JpaSpecificationExecutor<PatientDisease> {
  14. /**
  15. * 根据居民code获取居民疾病
  16. *
  17. * @param patient
  18. * @return
  19. */
  20. List<PatientDisease> findByPatient(String patient);
  21. /**
  22. * 根据居民code获取居民疾病
  23. *
  24. * @param patient
  25. * @return
  26. */
  27. List<PatientDisease> findByPatientAndSignType(String patient,String signType);
  28. /**
  29. * 根据居民code获取居民疾病
  30. *
  31. * @param patient
  32. * @return
  33. */
  34. @Query("select a from PatientDisease a where a.patient = ?1 and a.signType = '1' and a.del ='1' ")
  35. List<PatientDisease> findByPatientSsDisease(String patient);
  36. /**
  37. * 删除患者疾病
  38. *
  39. * @param patient
  40. * @return
  41. */
  42. int deleteByPatient(String patient);
  43. @Modifying
  44. @Query("update PatientDisease set del = '0' where patient = ?1 and del = '1' and signType = '2' ")
  45. int updateDiseaseDel(String patient);
  46. }