| 
					
				 | 
			
			
				@ -13,13 +13,12 @@ import com.yihu.jw.entity.base.patient.BasePatientDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.care.sign.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.patient.dao.BasePatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.PageEnvelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.rm.base.BaseRequestMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.common.IdCardUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.StringUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.mysql.query.BaseJpaService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.collections.map.HashedMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.elasticsearch.common.recycler.Recycler; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.jdbc.core.BeanPropertyRowMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.jdbc.core.JdbcTemplate; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -56,6 +55,45 @@ public class CapacityAssessmentRecordService extends BaseJpaService<CapacityAsse 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private CapacityAssessmentSocialAbilityDao CASocialAbilityDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取居民统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param doctorId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String,Object> getPatientNum(String doctorId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> res = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //能力完好(0级) 轻度失能(1级) 中度失能(2级) 重度失能(3级) 新生儿 10 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("0",0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("1",0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("2",0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("3",0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT COUNT(DISTINCT ar.patient),level_conclusion from  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "base_capacity_assessment_record ar, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "base_service_package_sign_record sr,base_service_package_record r,  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "                base_service_package_item i,base_team_member m  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "                WHERE sr.id = r.sign_id and r.service_package_id = i.service_package_id  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "                and i.del = 1 and m.team_code = i.team_code and ar.patient = sr.patient " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "                and m.doctor_code = '"+doctorId+"' and m.del = '1' and sr.`status`=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "GROUP BY ar.level_conclusion" ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> countMapList = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(Map<String,Object> map:countMapList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int c = Integer.valueOf(map.get("count").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res.put(String.valueOf(map.get("status")),c); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql2 = "SELECT COUNT(DISTINCT ar.id) from base_patient ar, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "base_service_package_sign_record sr,base_service_package_record r,  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "                base_service_package_item i,base_team_member m  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "                WHERE sr.id = r.sign_id and r.service_package_id = i.service_package_id  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "                and i.del = 1 and m.team_code = i.team_code and ar.id = sr.patient and ar.archive_type = 2 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "                and m.doctor_code = '"+doctorId+"' and m.del = '1' and sr.`status`=1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer count = jdbcTemplate.queryForObject(sql2,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res.put("10",count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public PageEnvelop<List<Map<String,Object>>> assessmentPage(String doctorId,String name, int page, int size, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    Integer status,Integer levelConclusion,Integer servicePackageStatus){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT c.id,c.patient,c.assessment_time,c.service_package_status servicePackageStatus, " + 
			 |