| 
					
				 | 
			
			
				@ -2,13 +2,16 @@ package com.yihu.jw.care.service.message; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.dao.message.BaseServiceNewsDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.care.message.BaseServiceNews; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.common.IdCardUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.data.domain.PageRequest; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.data.domain.Sort; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.data.domain.Sort.Direction; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.jdbc.core.JdbcTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 * Created with IntelliJ IDEA. 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -22,6 +25,52 @@ public class BaseServiceNewsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BaseServiceNewsDao baseServiceNewsDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private JdbcTemplate jdbcTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 查找机构坐标 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> findOrgLocations(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT code,name,brief,address,photo,mobile,longitude,latitude from base_org WHERE type in ('3','4') and del =1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 按名字查找居民坐标 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> findPatinetByName(String name){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT p.id,p.`name`,p.address,p.photo,p.mobile,p.lat_lon,sex,idcard,CAST(archive_type AS char) type from base_patient p\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "WHERE p.del = 1 and p.name like '%"+name+"%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String,Object> map:list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String idcard = map.get("idcard").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map.put("age", IdCardUtil.getAgeForIdcard(idcard)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 查找所有居民坐标 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 已入学儿童+ 已签约老人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> findPatinetLocations(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT p.id,p.`name`,p.address,p.photo,p.mobile,p.lat_lon,sex,idcard,archive_type type from base_doctor_patient_tmp t,base_patient p " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "WHERE t.patient = p.id and t.del=1 and t.`status`=1 and p.del =1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "UNION  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "SELECT p.id,p.`name`,p.address,p.photo,p.mobile,p.lat_lon,sex,idcard,archive_type type from base_service_package_sign_record t,base_patient p " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "WHERE t.patient = p.id and t.`status`=1 and p.del =1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String,Object> map:list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String idcard = map.get("idcard").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map.put("age", IdCardUtil.getAgeForIdcard(idcard)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 服务动态 
			 |