|
@ -29,8 +29,7 @@ import com.yihu.wlyy.web.third.gateway.service.GcLabelService;
|
|
import com.yihu.wlyy.web.third.gateway.vo.DictModel;
|
|
import com.yihu.wlyy.web.third.gateway.vo.DictModel;
|
|
import com.yihu.wlyy.web.third.gateway.vo.HealthEduArticlePatientModel;
|
|
import com.yihu.wlyy.web.third.gateway.vo.HealthEduArticlePatientModel;
|
|
import io.searchbox.client.JestClient;
|
|
import io.searchbox.client.JestClient;
|
|
import io.searchbox.core.Search;
|
|
|
|
import io.searchbox.core.SearchResult;
|
|
|
|
|
|
import io.searchbox.core.*;
|
|
import org.elasticsearch.index.query.BoolQueryBuilder;
|
|
import org.elasticsearch.index.query.BoolQueryBuilder;
|
|
import org.elasticsearch.index.query.QueryBuilders;
|
|
import org.elasticsearch.index.query.QueryBuilders;
|
|
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
|
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
|
@ -1041,35 +1040,72 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 一键修改居民推送文章的文章为已读
|
|
|
|
* @param patient
|
|
|
|
*/
|
|
|
|
public void readAllArticleNew(String patient){
|
|
|
|
JestClient jestClient = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
jestClient = elasticFactory.getJestClient();
|
|
|
|
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
|
|
|
searchSourceBuilder.query(
|
|
|
|
new BoolQueryBuilder()
|
|
|
|
.must(QueryBuilders.matchQuery("patientCode", patient))
|
|
|
|
);
|
|
|
|
Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType).build();
|
|
|
|
SearchResult result = jestClient.execute(search);
|
|
|
|
List<HealthEduArticleES> dataList = result.getSourceAsObjectList(HealthEduArticleES.class);
|
|
|
|
if(!dataList.isEmpty()){
|
|
|
|
//根据id批量删除
|
|
|
|
Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
|
|
|
|
for (HealthEduArticleES obj : dataList) {
|
|
|
|
Delete index = new Delete.Builder(obj.getId()).build();
|
|
|
|
bulk.addAction(index);
|
|
|
|
}
|
|
|
|
BulkResult br = jestClient.execute(bulk.build());
|
|
|
|
}
|
|
|
|
for (HealthEduArticleES healthEduArticleES:dataList) {
|
|
|
|
healthEduArticleES.setIsRead(1);
|
|
|
|
}
|
|
|
|
elastricSearchSave.save(dataList,esIndex,esType);
|
|
|
|
jestClient.shutdownClient();
|
|
|
|
}catch (Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
} finally {
|
|
|
|
if (jestClient != null) {
|
|
|
|
jestClient.shutdownClient();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public JSONArray pushArticleLogs(int page, int pagesize, String patientCode,String level1Type) throws Exception {
|
|
public JSONArray pushArticleLogs(int page, int pagesize, String patientCode,String level1Type) throws Exception {
|
|
|
|
|
|
pagesize = page * pagesize;
|
|
pagesize = page * pagesize;
|
|
page = (page - 1) * pagesize;
|
|
page = (page - 1) * pagesize;
|
|
//
|
|
|
|
// StringBuffer sql2 = new StringBuffer("select * from " + esType +
|
|
|
|
// " where sendCode='" + sendCode + "' ");
|
|
|
|
// sql2.append(" order by createTime limit " + page + "," + pagesize);
|
|
|
|
String sql = "SELECT * FROM " + esType + " where nested(patients.code)= '" + patientCode + "' ";
|
|
|
|
|
|
|
|
|
|
String sql = "SELECT * FROM " + esType + " where patientCode= '" + patientCode + "' ";
|
|
|
|
|
|
if(!StringUtils.isEmpty(level1Type)){
|
|
if(!StringUtils.isEmpty(level1Type)){
|
|
sql= sql + " and level1Type = '"+level1Type+"' ";
|
|
|
|
|
|
sql= sql + " and firstLevelCategoryId = '"+level1Type+"' ";
|
|
}
|
|
}
|
|
|
|
|
|
if(page !=0 && pagesize !=0){
|
|
if(page !=0 && pagesize !=0){
|
|
sql= sql+ " order by createTime desc limit " + page + "," + pagesize;
|
|
sql= sql+ " order by createTime desc limit " + page + "," + pagesize;
|
|
}
|
|
}
|
|
|
|
|
|
List<com.yihu.es.entity.HealthEduArticlePatient> esList = elasticsearchUtil.excute(sql, com.yihu.es.entity.HealthEduArticlePatient.class, esIndex, esType);
|
|
|
|
|
|
List<HealthEduArticleES> esList = elasticsearchUtil.excute(sql, HealthEduArticleES.class, esIndex, esType);
|
|
HealthEduArticlePatientModel heapm = null;
|
|
HealthEduArticlePatientModel heapm = null;
|
|
com.alibaba.fastjson.JSONObject article = null;
|
|
com.alibaba.fastjson.JSONObject article = null;
|
|
List<HealthEduArticlePatientModel> result = new ArrayList<>();
|
|
List<HealthEduArticlePatientModel> result = new ArrayList<>();
|
|
Doctor doctor = null;
|
|
Doctor doctor = null;
|
|
for (HealthEduArticlePatient one : esList) {
|
|
|
|
|
|
for (HealthEduArticleES one : esList) {
|
|
article = thirdJkEduArticleService.getArticalById(one.getArticleId(),"");
|
|
article = thirdJkEduArticleService.getArticalById(one.getArticleId(),"");
|
|
heapm = new HealthEduArticlePatientModel();
|
|
heapm = new HealthEduArticlePatientModel();
|
|
heapm.setSendName(one.getSendName());
|
|
heapm.setSendName(one.getSendName());
|
|
heapm.setSendCode(one.getDoctorCode());
|
|
|
|
|
|
heapm.setSendCode(one.getSendCode());
|
|
heapm.setCreateTime(DateUtil.dateToStrLong(one.getCreateTime()));
|
|
heapm.setCreateTime(DateUtil.dateToStrLong(one.getCreateTime()));
|
|
heapm.setArticleId(article.getString("articleId"));
|
|
heapm.setArticleId(article.getString("articleId"));
|
|
heapm.setAttachedTitle(article.getString("articleTitle"));
|
|
heapm.setAttachedTitle(article.getString("articleTitle"));
|
|
@ -1078,7 +1114,7 @@ public class JMJkEduArticleService extends BaseService {
|
|
heapm.setLevel1Type(article.getString("firstLevelCategoryId"));
|
|
heapm.setLevel1Type(article.getString("firstLevelCategoryId"));
|
|
heapm.setLevel2Type(article.getString("secondLevelCategoryId"));
|
|
heapm.setLevel2Type(article.getString("secondLevelCategoryId"));
|
|
heapm.setLevel(article.getString("articlelevel"));
|
|
heapm.setLevel(article.getString("articlelevel"));
|
|
heapm.setAllCount(heapm.getAllCount() + one.getPatients().size());
|
|
|
|
|
|
// heapm.setAllCount(heapm.getAllCount() + one.getPatients().size());
|
|
heapm.setBrowseNumbere(Integer.valueOf(article.getString("browseNumber")));//文章浏览数
|
|
heapm.setBrowseNumbere(Integer.valueOf(article.getString("browseNumber")));//文章浏览数
|
|
heapm.setCommentNumber(Integer.valueOf(article.getString("commentNumber")));//文章评论数
|
|
heapm.setCommentNumber(Integer.valueOf(article.getString("commentNumber")));//文章评论数
|
|
heapm.setPointNumber(Integer.valueOf(article.getString("pointNumber")));//文章点赞数
|
|
heapm.setPointNumber(Integer.valueOf(article.getString("pointNumber")));//文章点赞数
|
|
@ -1086,9 +1122,9 @@ public class JMJkEduArticleService extends BaseService {
|
|
heapm.setComputeTime(computeTime(article.getString("insertTime")));
|
|
heapm.setComputeTime(computeTime(article.getString("insertTime")));
|
|
heapm.setOperatorName(article.getString("operatorName"));
|
|
heapm.setOperatorName(article.getString("operatorName"));
|
|
heapm.setSendType(one.getSendType());//发送类型
|
|
heapm.setSendType(one.getSendType());//发送类型
|
|
heapm.setIsread(one.getIsread());//已读未读标识,1已读,2未读
|
|
|
|
heapm.setLeaveWords(one.getLeaveWords());
|
|
|
|
doctor = doctorDao.findByCode(one.getDoctorCode());
|
|
|
|
|
|
heapm.setIsread(String.valueOf(one.getIsRead()));//已读未读标识,1已读,2未读
|
|
|
|
heapm.setLeaveWords(one.getLeaveWords());//医生留言
|
|
|
|
doctor = doctorDao.findByCode(one.getSendCode());
|
|
heapm.setPhoto(doctor.getPhoto());
|
|
heapm.setPhoto(doctor.getPhoto());
|
|
result.add(heapm);
|
|
result.add(heapm);
|
|
// heapm.setTime();//时间 xx小时前 2017-10-11
|
|
// heapm.setTime();//时间 xx小时前 2017-10-11
|