|
@ -6,9 +6,7 @@ import com.yihu.wlyy.entity.education.HealthEduArticlePatient;
|
|
import com.yihu.wlyy.repository.education.HealthEduArticleDao;
|
|
import com.yihu.wlyy.repository.education.HealthEduArticleDao;
|
|
import com.yihu.wlyy.repository.education.HealthEduArticlePatientDao;
|
|
import com.yihu.wlyy.repository.education.HealthEduArticlePatientDao;
|
|
import com.yihu.wlyy.service.BaseService;
|
|
import com.yihu.wlyy.service.BaseService;
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
|
|
import com.yihu.wlyy.util.SystemConf;
|
|
|
|
import com.yihu.wlyy.util.Xml2ListMap;
|
|
|
|
|
|
import com.yihu.wlyy.util.*;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
@ -54,6 +52,7 @@ public class HealthEduArticleService extends BaseService {
|
|
String content = null;
|
|
String content = null;
|
|
String keyWord = null;
|
|
String keyWord = null;
|
|
String type = null;
|
|
String type = null;
|
|
|
|
String summary = null;
|
|
int rows = 0;
|
|
int rows = 0;
|
|
for(Map<String,String> temp : listmap){
|
|
for(Map<String,String> temp : listmap){
|
|
code = temp.get("xml.Result.MessageId");
|
|
code = temp.get("xml.Result.MessageId");
|
|
@ -61,6 +60,14 @@ public class HealthEduArticleService extends BaseService {
|
|
imgUrl = temp.get("xml.Result.ImageUrlSmall");
|
|
imgUrl = temp.get("xml.Result.ImageUrlSmall");
|
|
content = temp.get("xml.Result.MessageContent");
|
|
content = temp.get("xml.Result.MessageContent");
|
|
keyWord = temp.get("xml.Result.MessageType");
|
|
keyWord = temp.get("xml.Result.MessageType");
|
|
|
|
|
|
|
|
String str = Html2Text.Html2Text(content);
|
|
|
|
if(str.length()>50){
|
|
|
|
summary = str.substring(0,50).replace("\n","").replace(" ","").replace(" ","");
|
|
|
|
}else {
|
|
|
|
summary = str.replace("\n","").replace(" ","").replace(" ","");
|
|
|
|
}
|
|
|
|
|
|
switch (keyWord){
|
|
switch (keyWord){
|
|
case "1":
|
|
case "1":
|
|
keyWord = "高血压";
|
|
keyWord = "高血压";
|
|
@ -101,8 +108,10 @@ public class HealthEduArticleService extends BaseService {
|
|
}
|
|
}
|
|
|
|
|
|
String sql = "INSERT INTO wlyy_health_edu_article " +
|
|
String sql = "INSERT INTO wlyy_health_edu_article " +
|
|
"VALUES(NULL,?,?,?,?,NULL,?,?)";
|
|
|
|
rows = jdbcTemplate.update(sql,code,title,imgUrl,content,keyWord,type);
|
|
|
|
|
|
"VALUES(NULL,?,?,?,?,?,NULL,?,?)";
|
|
|
|
/* String sql = "INSERT INTO wlyy_health_article " +
|
|
|
|
"VALUES(NULL,?,?,?,?,?,NULL,?,?)";*/
|
|
|
|
rows = jdbcTemplate.update(sql,code,title,summary,imgUrl,content,keyWord,type);
|
|
rows+=rows;
|
|
rows+=rows;
|
|
}
|
|
}
|
|
return rows;
|
|
return rows;
|