| 
					
				 | 
			
			
				@ -42,12 +42,13 @@ public class HealthEduArticleService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 保存福州健康教育文章 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param result xml格式 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public int saveHealthEduArticles(String result) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,String>> listmap= Xml2ListMap.xml2List(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, String>> listmap = Xml2ListMap.xml2List(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String code = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String title = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String imgUrl = null; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -55,13 +56,13 @@ public class HealthEduArticleService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String keyWord = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String type = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int rows = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(Map<String,String> temp : listmap){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String, String> temp : listmap) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            code = temp.get("xml.Result.MessageId"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            title = temp.get("xml.Result.MessageTitle"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            imgUrl = temp.get("xml.Result.ImageUrlSmall"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            content = temp.get("xml.Result.MessageContent"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            keyWord = temp.get("xml.Result.MessageType"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            switch (keyWord){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            switch (keyWord) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case "1": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    keyWord = "高血压"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    type = "2"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -101,15 +102,19 @@ public class HealthEduArticleService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sql = "INSERT INTO wlyy_health_edu_article  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "VALUES(NULL,?,?,?,?,NULL,?,?)"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rows = jdbcTemplate.update(sql,code,title,imgUrl,content,keyWord,type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rows+=rows; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "VALUES(NULL,?,?,?,?,?,NULL,?,?)"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String summary = content.replaceAll("</?[^>]+>", "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    .replaceAll("<a>\\s*|\t|\r|\n</a>", "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    .replaceAll(" ", "").replaceAll(" ", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rows = jdbcTemplate.update(sql, code, title, summary, imgUrl, content, keyWord, type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rows += rows; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return rows; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 由请求参数获取福州健康教育文章 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param params 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -120,19 +125,19 @@ public class HealthEduArticleService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//      获取远程地址url 、App Key 和 App secret   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String prixUrl = SystemConf.getInstance().getYihuOpenPlatformUrl(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        String prixUrl ="http://apitest.yihu.com.cn/OpenPlatform/cgiBin/1.0/"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String appId =SystemConf.getInstance().getYihuOpenPlatformAppId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String appId = SystemConf.getInstance().getYihuOpenPlatformAppId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        String appId = "9000276"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String secret = SystemConf.getInstance().getYihuOpenPlatformSecret(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        String secret = "OKC8BS1KGXTDE9GPP1EO4VYLUXF8DJ7QUP72H613ZXA"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//      请求参数(i健康接口说明文档)正式接口 由prixUrl获取apixUrl 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String apiUrl = prixUrl+"jkjy/JkjyImpl/queryHealtheducationForIHealth"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String apiUrl = prixUrl + "jkjy/JkjyImpl/queryHealtheducationForIHealth"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//      获取加密后参数集合 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,String> param = httpClientUtil.getSecretParams(params,appId,secret); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, String> param = httpClientUtil.getSecretParams(params, appId, secret); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//      拼接请求URL (加密签名+apiUrl) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//      获取返回数据( HTTP post请求,参数需要utf-8编码) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String  results = httpClientUtil.httpPost(apiUrl,param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String results = httpClientUtil.httpPost(apiUrl, param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return results; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -164,7 +169,7 @@ public class HealthEduArticleService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Object> params = new ArrayList<Object>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        StringBuffer sql = new StringBuffer(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql.append("select a.id,a.code,a.title,a.url,a.czrq,a.content,a.keyword"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql.append("select a.id,a.code,a.title,a.url,a.czrq,a.summary content,a.keyword"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql.append(",(select count(1) from wlyy_health_edu_article_op_history c where c.code = a.code and c.status = 1) as readAmount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql.append(",(select count(1) from wlyy_health_edu_article_op_history c where c.code = a.code and c.status = 2) as collectionAmount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql.append(",(select count(1) from wlyy_health_edu_article_op_history c where c.code = a.code and c.status = 3) as repeatAmount"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -212,7 +217,7 @@ public class HealthEduArticleService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    ,a.title" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    ,a.url" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    ,a.czrq" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    ,a.content" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    ,a.summary content" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    ,d.code" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    ,d.name" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    ,d.photo" + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -224,9 +229,9 @@ public class HealthEduArticleService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    a.doctor = d.code " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    and a.patient = ?" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    and a.admin_team_code = ?" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  order by a.czrq desc limit " + page*pageSize + "," + pageSize; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  order by a.czrq desc limit " + page * pageSize + "," + pageSize; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> result = jdbcTemplate.queryForList(sql,new Object[]{patient,teamCode}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> result = jdbcTemplate.queryForList(sql, new Object[]{patient, teamCode}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 |