| 
					
				 | 
			
			
				@ -9,28 +9,32 @@ import org.springframework.data.repository.PagingAndSortingRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.entity.consult.Consult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				public interface ConsultDao extends PagingAndSortingRepository<Consult, Long>, JpaSpecificationExecutor<Consult> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					Consult findByCode(String code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					// 查询患者咨询记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					@Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status,b.doctor,b.team 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") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					Page<Object> findByPatient(String patient,String title, Pageable pageRequest); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    Consult findByCode(String code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					// 查询患者咨询记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					@Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status,b.doctor,b.team 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") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					Page<Object> findByPatient(String patient,String title, long id, Pageable pageRequest); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    // 查询患者咨询记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status,b.doctor,b.team 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") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    Page<Object> findByPatient(String patient, String title, Pageable pageRequest); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					// 查询患者咨询记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					@Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status,b.doctor,b.team from Consult a,ConsultTeam b where a.code = b.consult and a.patient = ?1 and a.del = '1' order by a.czrq desc") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					Page<Object> findByPatient(String patient, Pageable pageRequest); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    // 查询患者咨询记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status,b.doctor,b.team 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") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    Page<Object> findByPatient(String patient, String title, long id, Pageable pageRequest); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					// 查询患者咨询记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					@Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status,b.doctor,b.team 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") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					Page<Object> findByPatient(String patient, long id, Pageable pageRequest); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    // 查询患者咨询记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status,b.doctor,b.team from Consult a,ConsultTeam b where a.code = b.consult and a.patient = ?1 and a.del = '1' order by a.czrq desc") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    Page<Object> findByPatient(String patient, Pageable pageRequest); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					@Query("select count(a) from Consult a,ConsultTeamDoctor b  where a.code = b.consult and a.patient=?1 and b.to=?2 and b.from is null") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					Integer findByPatient(String patientCode,String doctorCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    // 查询患者咨询记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status,b.doctor,b.team 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") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    Page<Object> findByPatient(String patient, long id, Pageable pageRequest); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					@Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status,b.adminTeamId,b.team from Consult a,ConsultTeam b where a.code = b.consult and a.patient = ?1 and b.adminTeamId = ?2 and a.del = '1' order by a.czrq desc") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					Page<Object> findByPatientAndTeam(String patient,Long team, Pageable pageRequest); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Query("select count(a) from Consult a,ConsultTeamDoctor b  where a.code = b.consult and a.patient=?1 and b.to=?2 and b.from is null") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    Integer findByPatient(String patientCode, String doctorCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status,b.adminTeamId,b.team from Consult a,ConsultTeam b where a.code = b.consult and a.patient = ?1 and b.adminTeamId = ?2 and a.del = '1' order by a.czrq desc") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    Page<Object> findByPatientAndTeam(String patient, Long team, Pageable pageRequest); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //获取咨询的状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Query("select a.type from Consult a,ConsultTeam b where a.code = b.consult and a.code = ?1 ") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    int findTypeByCode(String code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |