|
@ -1088,6 +1088,48 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 居民单条文章增加已读状态
|
|
|
* @param patient
|
|
|
* @param articleId
|
|
|
*/
|
|
|
public void readPatientArticle(String patient,String articleId){
|
|
|
JestClient jestClient = null;
|
|
|
|
|
|
try {
|
|
|
jestClient = elasticFactory.getJestClient();
|
|
|
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
|
|
searchSourceBuilder.query(
|
|
|
new BoolQueryBuilder()
|
|
|
.must(QueryBuilders.matchQuery("patientCode", patient))
|
|
|
.must(QueryBuilders.matchQuery("articleId", articleId))
|
|
|
);
|
|
|
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 {
|
|
|
|