| 
					
				 | 
			
			
				@ -3,8 +3,10 @@ package com.yihu.ehr.resource.service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.ehr.query.BaseJpaService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.ehr.redis.client.RedisClient; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.ehr.resource.dao.RsDictionaryEntryDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.ehr.resource.model.RsDictionary; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.ehr.resource.model.RsDictionaryEntry; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.jdbc.core.BeanPropertyRowMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.jdbc.core.JdbcTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.jdbc.core.PreparedStatementCreator; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.jdbc.support.GeneratedKeyHolder; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -35,6 +37,9 @@ public class RsDictionaryEntryService extends BaseJpaService<RsDictionaryEntry, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private RsDictionaryEntryDao dictionaryEntryDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private RsDictionaryService rsDictionaryService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 简化资源字典缓存,默认缓存3600秒 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -49,13 +54,28 @@ public class RsDictionaryEntryService extends BaseJpaService<RsDictionaryEntry, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        RsDictionaryEntry rsDictionaryEntry = dictionaryEntryDao.findByDictcodeAndCode(dict, code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        RsDictionary rsDictionary = rsDictionaryService.findByCode(dict); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (rsDictionary == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        RsDictionaryEntry rsDictionaryEntry; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (rsDictionary.getDynamic() == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rsDictionaryEntry = dictionaryEntryDao.findByDictcodeAndCode(dict, code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sql = "select code, name from (" + rsDictionary.getSql() + ") a where a.code=?"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rsDictionaryEntry = jdbcTemplate.queryForObject( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sql, new Object[]{code}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    new BeanPropertyRowMapper<>(RsDictionaryEntry.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (rsDictionaryEntry == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        redisClient.set(key, rsDictionaryEntry.getName(), 3600); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return rsDictionaryEntry.getName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 |