| 
					
				 | 
			
			
				@ -12,6 +12,7 @@ import com.yihu.jw.util.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.data.redis.core.StringRedisTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.jdbc.core.BeanPropertyRowMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.jdbc.core.JdbcTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.stereotype.Service; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -43,6 +44,8 @@ public class SpecialistService{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private JdbcTemplate jdbcTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Value("${basedb.name}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private String basedb; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private StringRedisTemplate redisTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop<Boolean, Boolean> createSpecialistsPatientRelation(SpecialistPatientRelationDO specialistPatientRelationDO){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        specialistPatientRelationDao.save(specialistPatientRelationDO); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -504,6 +507,9 @@ public class SpecialistService{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            relation.setHealthAssistantName(health_assistant_name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            relation.setSignDate(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            specialistPatientRelationDao.save(relation); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //签约成功之后,将签约关系保存在redis中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String key = "specialist_patient_relation:" + relation.getPatient() +"_"+ ":text"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            redisTemplate.opsForValue().set(key,"true"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccess(SpecialistMapping.api_success,relation); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -911,7 +917,24 @@ public class SpecialistService{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        specialistPatientRelationDO.setSignYear(String.valueOf(DateUtil.getNowYear())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        specialistPatientRelationDO.setSignDate(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        specialistPatientRelationDO = specialistPatientRelationDao.save(specialistPatientRelationDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //签约成功之后,将签约关系保存在redis中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String key = "specialist_patient_relation:" + specialistPatientRelationDO.getPatient() +"_"+ ":text"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        redisTemplate.opsForValue().set(key,"true"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return ObjEnvelop.getSuccess("success", specialistPatientRelationDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Integer updateRedisFindPatientTeamList(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<SpecialistPatientRelationDO> specialistPatientRelationDOList=specialistPatientRelationDao.findAllBySignStatus("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<SpecialistPatientRelationDO> unique = specialistPatientRelationDOList.stream().collect( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Collectors.collectingAndThen( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(SpecialistPatientRelationDO::getPatient))), ArrayList::new) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        unique.stream().forEach(item->{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //签约成功之后,将签约关系保存在redis中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String key = "specialist_patient_relation:" + item.getPatient() +"_"+ ":text"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            redisTemplate.opsForValue().set(key,"true"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return null==unique?0:unique.size(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |