|  | @ -8,6 +8,7 @@ package com.yihu.wlyy.repository.consult;
 | 
	
		
			
				|  |  | import org.springframework.data.domain.Page;
 | 
	
		
			
				|  |  | import org.springframework.data.domain.PageRequest;
 | 
	
		
			
				|  |  | import org.springframework.data.domain.Pageable;
 | 
	
		
			
				|  |  | import org.springframework.data.domain.jaxb.PageAdapter;
 | 
	
		
			
				|  |  | import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 | 
	
		
			
				|  |  | import org.springframework.data.jpa.repository.Modifying;
 | 
	
		
			
				|  |  | import org.springframework.data.jpa.repository.Query;
 | 
	
	
		
			
				|  | @ -132,6 +133,10 @@ public interface ConsultTeamDao extends PagingAndSortingRepository<ConsultTeam,
 | 
	
		
			
				|  |  | 	@Query("SELECT SUM(a.doctorRead) FROM ConsultTeam a, ConsultTeamDoctor b WHERE a.consult = b.consult AND b.to = ?1 AND a.del = '1' AND a.status = 0")
 | 
	
		
			
				|  |  | 	int amountAllDoctorUnread(String doctor);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 	// 查询医生所有未读的消息总数
 | 
	
		
			
				|  |  | 	@Query("SELECT a.name,b.czrq FROM ConsultTeam a, ConsultTeamDoctor b WHERE a.consult = b.consult AND b.to = ?1 AND a.del = '1' AND a.status = 0 order by b.czrq desc")
 | 
	
		
			
				|  |  | 	Page<Object> AllDoctorUnreadLast(String doctor,Pageable pageRequest);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 	// 查询带未读数量的所有健康咨询列表
 | 
	
		
			
				|  |  | 	@Query("SELECT a FROM ConsultTeam a, ConsultTeamDoctor b WHERE a.consult = b.consult AND b.to = ?1 AND a.status = 0 and a.type< 3")
 | 
	
		
			
				|  |  | 	Page<ConsultTeam> findListByUnreadDoctor(String doctor, Pageable pageRequest);
 | 
	
	
		
			
				|  | @ -174,19 +179,35 @@ public interface ConsultTeamDao extends PagingAndSortingRepository<ConsultTeam,
 | 
	
		
			
				|  |  | 	ConsultTeam findByParientCodeAndSignTypeAndDoctor(String patientCode, String doctor, int s);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 	//名医咨询 -全部 带symptoms 未处理、未回复
 | 
	
		
			
				|  |  | 	@Query("select a from ConsultTeam a, ConsultTeamDoctor b where a.consult = b.consult and a.type=6 and b.to = ?1 and a.id < ?2 and a.symptoms like ?3 and (a.doctorRead < 1 or b.reply != 1) and a.del = '1' and b.del = '1'")
 | 
	
		
			
				|  |  | 	@Query("select a from ConsultTeam a, ConsultTeamDoctor b where a.consult = b.consult and a.type=6 and b.to = ?1 and a.id < ?2 and a.symptoms like ?3 and a.status = 0 and (a.doctorRead > 0 or b.reply != 1) and a.del = '1' and b.del = '1'")
 | 
	
		
			
				|  |  | 	Page<ConsultTeam> findFamousDoctorUnReplyReadList(String uid, long id,String title, Pageable pageRequest);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 	//名医咨询 -全部 带symptoms 处理、未回复
 | 
	
		
			
				|  |  | 	@Query("select a from ConsultTeam a, ConsultTeamDoctor b where a.consult = b.consult and a.type=6 and b.to = ?1 and a.symptoms like ?2 and (a.doctorRead < 1 or b.reply != 1) and a.del = '1' and b.del = '1'")
 | 
	
		
			
				|  |  | 	@Query("select a from ConsultTeam a, ConsultTeamDoctor b where a.consult = b.consult and a.type=6 and b.to = ?1 and a.symptoms like ?2 and a.status = 0 and (a.doctorRead > 0 or b.reply != 1) and a.del = '1' and b.del = '1'")
 | 
	
		
			
				|  |  | 	Page<ConsultTeam> findFamousDoctorUnReplyReadList(String uid,String title, Pageable pageRequest);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 	//名医咨询 -全部 处理、未回复
 | 
	
		
			
				|  |  | 	@Query("select a from ConsultTeam a, ConsultTeamDoctor b where a.consult = b.consult and a.type=6 and b.to = ?1 and a.id < ?2 and (a.doctorRead < 1 or b.reply != 1) and a.del = '1' and b.del = '1'")
 | 
	
		
			
				|  |  | 	@Query("select a from ConsultTeam a, ConsultTeamDoctor b where a.consult = b.consult and a.type=6 and b.to = ?1 and a.id < ?2 and a.status = 0 and (a.doctorRead > 0 or b.reply != 1) and a.del = '1' and b.del = '1'")
 | 
	
		
			
				|  |  | 	Page<ConsultTeam> findFamousDoctorUnReplyReadNoTitleList(String uid, long id, Pageable pageRequest);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 	//名医咨询 -全部
 | 
	
		
			
				|  |  | 	@Query("select a from ConsultTeam a, ConsultTeamDoctor b where a.consult = b.consult and a.type=6 and b.to = ?1 and (a.doctorRead < 1 or b.reply != 1) and a.del = '1' and b.del = '1'")
 | 
	
		
			
				|  |  | 	@Query("select a from ConsultTeam a, ConsultTeamDoctor b where a.consult = b.consult and a.type=6 and b.to = ?1 and a.status = 0 and (a.doctorRead > 0 or b.reply != 1) and a.del = '1' and b.del = '1'")
 | 
	
		
			
				|  |  | 	Page<ConsultTeam> findFamousDoctorUnReplyReadNoTitleList(String uid, Pageable pageRequest);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 	//名医咨询 -全部 带symptoms 进行中
 | 
	
		
			
				|  |  | 	@Query("select a from ConsultTeam a, ConsultTeamDoctor b where a.consult = b.consult and a.type=6 and b.to = ?1 and a.id < ?2 and a.symptoms like ?3 and a.status = 0 and b.reply = 1 and a.del = '1' and b.del = '1'")
 | 
	
		
			
				|  |  | 	Page<ConsultTeam> findFamousDoctorIngList(String uid, long id,String title, Pageable pageRequest);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 	//名医咨询 -全部 带symptoms 进行中
 | 
	
		
			
				|  |  | 	@Query("select a from ConsultTeam a, ConsultTeamDoctor b where a.consult = b.consult and a.type=6 and b.to = ?1 and a.symptoms like ?2 and a.status = 0 and  b.reply = 1 and a.del = '1' and b.del = '1'")
 | 
	
		
			
				|  |  | 	Page<ConsultTeam> findFamousDoctorIngList(String uid,String title, Pageable pageRequest);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 	//名医咨询 -全部 进行中
 | 
	
		
			
				|  |  | 	@Query("select a from ConsultTeam a, ConsultTeamDoctor b where a.consult = b.consult and a.type=6 and b.to = ?1 and a.id < ?2 and a.status = 0 and  b.reply = 1 and a.del = '1' and b.del = '1'")
 | 
	
		
			
				|  |  | 	Page<ConsultTeam> findFamousDoctorIngNoTitleList(String uid, long id, Pageable pageRequest);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 	//名医咨询 -全部 进行中
 | 
	
		
			
				|  |  | 	@Query("select a from ConsultTeam a, ConsultTeamDoctor b where a.consult = b.consult and a.type=6 and b.to = ?1 and a.status = 0 and b.reply = 1 and a.del = '1' and b.del = '1'")
 | 
	
		
			
				|  |  | 	Page<ConsultTeam> findFamousDoctorIngNoTitleList(String uid, Pageable pageRequest);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |