| 
					
				 | 
			
			
				@ -1,9 +1,14 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				package com.yihu.figure.service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.figure.dao.HealthIndexDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.figure.dao.HealthIndexStatisticsDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.figure.model.HealthIndex; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.figure.model.HealthIndexStatistics; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.figure.util.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.figure.util.ETLConstantData; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.figure.util.IdCardUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.json.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.jdbc.core.JdbcTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.stereotype.Component; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -13,7 +18,7 @@ import java.text.DecimalFormat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 * 随访服务 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 * 居民体征 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 * @author ysj add 2017-03-06 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 */ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -25,9 +30,76 @@ public class HealthIndexService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private JdbcTemplate jdbcTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private HealthIndexDao healthIndexDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private HealthIndexStatisticsDao healthIndexStatisticsDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private DecimalFormat df = new DecimalFormat("#.0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取居民体征数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patient 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param type 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject healthIndex(String patient, String type, String bloodType, String timeType) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int limit = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("1".equals(timeType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            limit = 30; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if("2".equals(timeType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            limit = 182; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if("3".equals(timeType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            limit = 365; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql1 = "select date_format(record_date,'%Y-%c-%d %H:%i:%s') recordDate, "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("1".equals(type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //血糖 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql1 += "value1 value  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   "from wlyy_health_index " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   "where user = '"+patient+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   "and type="+type+" " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   "and value2='"+bloodType+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   "order by record_date desc " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   "limit "+limit; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //血压 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("9".equals(bloodType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql1 +=" value1 value "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else if("8".equals(bloodType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql1 +=" value2 value "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else if("10".equals(bloodType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql1 +=" value3 value "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql1 += "from wlyy_health_index " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "where user = '"+patient+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "and type="+type+" " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "order by record_date desc " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "limit "+limit; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list1 = jdbcTemplate.queryForList(sql1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql2 = "select high,normal,low  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "from wlyy_health_index_statistics " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "where user = '"+patient+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "and time_type="+timeType+" " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "and blood_type='"+bloodType+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "limit 1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list2 = jdbcTemplate.queryForList(sql2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> map = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list2.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map = list2.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map.put("high",0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map.put("normal",0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map.put("low",0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("healths",list1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("statistics",map); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return json; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 自动生成居民一年的体征数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patient 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -70,6 +142,13 @@ public class HealthIndexService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param idcard 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<HealthIndex> xuetang(String patient, String deviceSn, String idcard, List<HealthIndex> list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String startTime = DateUtil.getStringDateShort()+" 00:00:00"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String endTime = DateUtil.getStringDateShort()+" 23:59:59"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HealthIndex healthIndex = healthIndexDao.findByPatientAndType(patient,"1",startTime,endTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(healthIndex!=null){//判断是否已经生成过数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Calendar cal = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String fasting = "07:00:00"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -91,9 +170,18 @@ public class HealthIndexService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HealthIndex healthIndex6 = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HealthIndex healthIndex7 = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        double high = 11.1,normal=7.0,low = 4.0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int high1=0,normal1=0,low1=0,high2=0,normal2=0,low2=0,high3=0,normal3=0,low3=0;//1为近一个月,2为近半年,3为近一年 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int month = 30;//一个月取30天 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int halfYear = 182;//半年取182天 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        double high = 11.1,normal=7.0,low = 4.0;//(空腹4.0-7.0为正常,餐后7.0-11.0为正常) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int high11=0,normal11=0,low11=0,high12=0,normal12=0,low12=0,high13=0,normal13=0,low13=0;//1为近一个月,2为近半年,3为近一年 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int high21=0,normal21=0,low21=0,high22=0,normal22=0,low22=0,high23=0,normal23=0,low23=0;//1为近一个月,2为近半年,3为近一年 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int high31=0,normal31=0,low31=0,high32=0,normal32=0,low32=0,high33=0,normal33=0,low33=0;//1为近一个月,2为近半年,3为近一年 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int high41=0,normal41=0,low41=0,high42=0,normal42=0,low42=0,high43=0,normal43=0,low43=0;//1为近一个月,2为近半年,3为近一年 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int high51=0,normal51=0,low51=0,high52=0,normal52=0,low52=0,high53=0,normal53=0,low53=0;//1为近一个月,2为近半年,3为近一年 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int high61=0,normal61=0,low61=0,high62=0,normal62=0,low62=0,high63=0,normal63=0,low63=0;//1为近一个月,2为近半年,3为近一年 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int high71=0,normal71=0,low71=0,high72=0,normal72=0,low72=0,high73=0,normal73=0,low73=0;//1为近一个月,2为近半年,3为近一年 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Random random = new Random(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<HealthIndexStatistics> statisticsList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (int i = 0;i<365;i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            value1 = 6.0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            value2 = 10.0; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -231,7 +319,159 @@ public class HealthIndexService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthIndex7.setValue2("7"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //统计数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int flag1 = ETLConstantData.xueTangBefore(value1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int flag2 = ETLConstantData.xueTangAfter(value2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int flag3 = ETLConstantData.xueTangBefore(value3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int flag4 = ETLConstantData.xueTangAfter(value4); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int flag5 = ETLConstantData.xueTangBefore(value5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int flag6 = ETLConstantData.xueTangAfter(value6); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int flag7 = ETLConstantData.xueTangBefore(value7); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(flag1>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high11 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high12 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high13 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else if(flag1<0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low11 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low12 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low13 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //正常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal11 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal12 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal13 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(flag2>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high21 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high22 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high23 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else if(flag2<0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low21 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low22 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low23 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //正常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal21 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal22 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal23 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(flag3>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high31 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high32 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high33 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else if(flag3<0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low31 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low32 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low33 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //正常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal31 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal32 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal33 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(flag4>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high41 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high42 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high43 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else if(flag4<0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low41 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low42 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low43 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //正常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal41 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal42 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal43 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(flag5>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high51 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high52 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high53 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else if(flag5<0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low51 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low52 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low53 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //正常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal51 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal52 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal53 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(flag6>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high61 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high62 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high63 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else if(flag6<0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low61 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low62 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low63 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //正常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal61 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal62 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal63 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(flag7>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high71 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high72 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high73 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else if(flag7<0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low71 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low72 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low73 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //正常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal71 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal72 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal73 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(i==29){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics1 = new HealthIndexStatistics(patient,high11,normal11,low11,1,1,1,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics2 = new HealthIndexStatistics(patient,high21,normal21,low21,1,2,1,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics3 = new HealthIndexStatistics(patient,high31,normal31,low31,1,3,1,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics4 = new HealthIndexStatistics(patient,high41,normal41,low41,1,4,1,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics5 = new HealthIndexStatistics(patient,high51,normal51,low51,1,5,1,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics6 = new HealthIndexStatistics(patient,high61,normal61,low61,1,6,1,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics7 = new HealthIndexStatistics(patient,high71,normal71,low71,1,7,1,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics4); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics6); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics7); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(i==181){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics1 = new HealthIndexStatistics(patient,high12,normal12,low12,1,1,2,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics2 = new HealthIndexStatistics(patient,high22,normal22,low22,1,2,2,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics3 = new HealthIndexStatistics(patient,high32,normal32,low32,1,3,2,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics4 = new HealthIndexStatistics(patient,high42,normal42,low42,1,4,2,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics5 = new HealthIndexStatistics(patient,high52,normal52,low52,1,5,2,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics6 = new HealthIndexStatistics(patient,high62,normal62,low62,1,6,2,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics7 = new HealthIndexStatistics(patient,high72,normal72,low72,1,7,2,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics4); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics6); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics7); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(i==364){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics1 = new HealthIndexStatistics(patient,high13,normal13,low13,1,1,3,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics2 = new HealthIndexStatistics(patient,high23,normal23,low23,1,2,3,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics3 = new HealthIndexStatistics(patient,high33,normal33,low33,1,3,3,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics4 = new HealthIndexStatistics(patient,high43,normal43,low43,1,4,3,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics5 = new HealthIndexStatistics(patient,high53,normal53,low53,1,5,3,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics6 = new HealthIndexStatistics(patient,high63,normal63,low63,1,6,3,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics7 = new HealthIndexStatistics(patient,high73,normal73,low73,1,7,3,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics4); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics6); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics7); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            list.add(healthIndex1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            list.add(healthIndex2); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -242,6 +482,7 @@ public class HealthIndexService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            list.add(healthIndex7); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            cal.add(Calendar.DAY_OF_YEAR,-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthIndexStatisticsDao.save(statisticsList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -252,13 +493,25 @@ public class HealthIndexService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param idcard 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<HealthIndex> xueya(String patient, String deviceSn, String idcard, int age, String sex, List<HealthIndex> list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String startTime = DateUtil.getStringDateShort()+" 00:00:00"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String endTime = DateUtil.getStringDateShort()+" 23:59:59"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HealthIndex healthIndex = healthIndexDao.findByPatientAndType(patient,"2",startTime,endTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(healthIndex!=null){//判断是否已经生成过数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Calendar cal = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int value1,value2,value3,value4,intValue1,intValue2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //140/90mmHg至160/95mmHg之间,不能确定为高血压 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //成年人收缩压90-139.舒张压60-89为正常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HealthIndex healthIndex = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int high=140,normal=90,low=60; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int high11=0,normal11=0,low11=0,high12=0,normal12=0,low12=0,high13=0,normal13=0,low13=0;//1为近一个月,2为近半年,3为近一年 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int high21=0,normal21=0,low21=0,high22=0,normal22=0,low22=0,high23=0,normal23=0,low23=0;//1为近一个月,2为近半年,3为近一年 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int high31=0,normal31=0,low31=0,high32=0,normal32=0,low32=0,high33=0,normal33=0,low33=0;//1为近一个月,2为近半年,3为近一年 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Random random = new Random(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int month = 30;//一个月取30天 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int halfYear = 182;//半年取182天 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        age = age>65?65:age; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("2".equals(sex)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            intValue1 = 82+age; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -275,6 +528,8 @@ public class HealthIndexService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                intValue2 = 81-random.nextInt(3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<HealthIndexStatistics> statisticsList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (int i = 0;i<365;i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            value1 = intValue1;//收缩压 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            value2 = intValue2;//舒张压 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -294,7 +549,77 @@ public class HealthIndexService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            value3 = random.nextInt(2)==1?(value2+random.nextInt(9)):(value2-random.nextInt(9));//心率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            value4 = random.nextInt(10)>8?1:0;//心率是否不齐 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            value4 = random.nextInt(100)>96?1:0;//心率是否不齐 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //统计数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int flag1 = ETLConstantData.ssy(value1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int flag2 = ETLConstantData.szy(value2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int flag3 = ETLConstantData.heartRate(value3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(flag1>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high11 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high12 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high13 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else if(flag1<0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low11 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low12 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low13 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal11 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal12 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal13 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(flag2>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high21 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high22 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high23 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else if(flag2<0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low21 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low22 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                low23 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal21 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal22 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal23 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(flag3>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high31 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high32 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                high33 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            else if(flag3<0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                low31 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                low31 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                low31 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal31 += i<month?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal32 += i<halfYear?1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                normal33 ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(i==29){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics1 = new HealthIndexStatistics(patient,high11,normal11,low11,2,8,1,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics2 = new HealthIndexStatistics(patient,high21,normal21,low21,2,9,1,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics3 = new HealthIndexStatistics(patient,high31,normal31,low31,2,10,1,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(i==181){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics1 = new HealthIndexStatistics(patient,high12,normal12,low12,2,8,2,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics2 = new HealthIndexStatistics(patient,high22,normal22,low22,2,9,2,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics3 = new HealthIndexStatistics(patient,high32,normal32,low32,2,10,2,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(i==364){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics1 = new HealthIndexStatistics(patient,high13,normal13,low13,2,8,3,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics2 = new HealthIndexStatistics(patient,high23,normal23,low23,2,9,3,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthIndexStatistics healthIndexStatistics3 = new HealthIndexStatistics(patient,high33,normal33,low33,2,10,3,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                statisticsList.add(healthIndexStatistics3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthIndex.setCzrq(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthIndex.setDel("1"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -310,6 +635,7 @@ public class HealthIndexService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            list.add(healthIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            cal.add(Calendar.DAY_OF_YEAR,-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthIndexStatisticsDao.save(statisticsList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -320,6 +646,13 @@ public class HealthIndexService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param idcard 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<HealthIndex> weight(String patient, String deviceSn, String idcard, int age, String sex, List<HealthIndex> list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String startTime = DateUtil.getStringDateShort()+" 00:00:00"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String endTime = DateUtil.getStringDateShort()+" 23:59:59"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HealthIndex healthIndex = healthIndexDao.findByPatientAndType(patient,"3",startTime,endTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(healthIndex!=null){//判断是否已经生成过数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Calendar cal = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        cal.set(Calendar.HOUR_OF_DAY,0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        cal.set(Calendar.MINUTE,0); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -348,7 +681,6 @@ public class HealthIndexService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        double weight = weiht; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Random random = new Random(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int top = random.nextInt(4); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HealthIndex healthIndex = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (int i = 0;i<52;i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthIndex = new HealthIndex(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Date recordDate = cal.getTime(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -433,13 +765,19 @@ public class HealthIndexService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param idcard 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<HealthIndex> yaowei(String patient, String deviceSn, String idcard, int age, String sex, List<HealthIndex> list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String startTime = DateUtil.getStringDateShort()+" 00:00:00"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String endTime = DateUtil.getStringDateShort()+" 23:59:59"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HealthIndex healthIndex = healthIndexDao.findByPatientAndType(patient,"4",startTime,endTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(healthIndex!=null){//判断是否已经生成过数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Calendar cal = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        cal.set(Calendar.HOUR_OF_DAY,0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        cal.set(Calendar.MINUTE,0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        cal.set(Calendar.SECOND,0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        double yaowei = "2".equals(sex)?86:78; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HealthIndex healthIndex = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Random random = new Random(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (int i = 0;i<52;i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthIndex = new HealthIndex(); 
			 |