|
@ -31,6 +31,7 @@ import io.searchbox.core.*;
|
|
|
import org.elasticsearch.index.query.BoolQueryBuilder;
|
|
|
import org.elasticsearch.index.query.QueryBuilders;
|
|
|
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.annotation.Transient;
|
|
@ -57,9 +58,7 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
private String esIndex;
|
|
|
@Autowired
|
|
|
private AdminTeamService adminTeamService;
|
|
|
@Autowired
|
|
|
private DoctorRoleDao doctorRoleDao;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private ElasticFactory elasticFactory;
|
|
|
@Autowired
|
|
@ -84,6 +83,8 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
private SignPatientLabelInfoService signPatientLabelInfoService;
|
|
|
@Autowired
|
|
|
private DoctorInfoService doctorInfoService;
|
|
|
@Autowired
|
|
|
private DoctorRoleDao doctorRoleDao;
|
|
|
|
|
|
/**
|
|
|
*
|
|
@ -98,8 +99,8 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
*/
|
|
|
public List<HealthEduArticlePatientModel> pushArticleList(int page, int pagesize, String sendCode, String firstLevelCategoryId,String secondLevelCategoryId,Integer myArticle,Integer sendType,String currentUserRole,
|
|
|
String currentUserRoleLevel,String articleTitle,String sendTimeStart,String sendTimeEnd) throws Exception {
|
|
|
pagesize = page * pagesize;
|
|
|
page = (page - 1) * pagesize;
|
|
|
// pagesize = page * pagesize;
|
|
|
// page = (page - 1) ;
|
|
|
// if(loginType==2){
|
|
|
//
|
|
|
// String sql = "select r.code as roleCode from wlyy_user_role u " +
|
|
@ -142,16 +143,19 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
HealthEduArticlePatientModel heapm = null;
|
|
|
JSONObject article = null;
|
|
|
Doctor doctor = null;
|
|
|
|
|
|
|
|
|
List<HealthEduArticlePatientModel> resultList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
StringBuffer sql3 = null;
|
|
|
for (HealthEduArticleES one : esList) {
|
|
|
|
|
|
|
|
|
article = thirdJkEduArticleService.getArticalById(one.getArticleId(),"");
|
|
|
// if (result.get(one.getArticleId()) != null) {
|
|
|
// heapm = result.get(one.getArticleId());
|
|
|
//
|
|
|
// } else {
|
|
|
heapm = new HealthEduArticlePatientModel();
|
|
|
heapm = new HealthEduArticlePatientModel();
|
|
|
// }
|
|
|
heapm.setSendName(one.getSendName());
|
|
|
heapm.setSendCode(one.getDoctorCode());
|
|
@ -167,6 +171,15 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
heapm.setLevel2TypeName(one.getSecondLevelCategoryName());
|
|
|
heapm.setLevel(article.getString("articlelevel"));
|
|
|
// heapm.setAllCount(heapm.getAllCount() + one.getPatients().size());
|
|
|
sql3 = new StringBuffer();
|
|
|
sql3.append("SELECT COUNT(*) as num FROM "+esType+" WHERE isRead='1' AND batchNo = '"+one.getBatchNo()+"' AND patientCode is not null AND articleId='"+article.getString("articleId")+"'");
|
|
|
Long num = elasticsearchUtil.excuteForLong(sql3.toString(), esType, esIndex);
|
|
|
if(num!=null){
|
|
|
heapm.setReadNumber(num.longValue());
|
|
|
}else{
|
|
|
heapm.setReadNumber(0L);
|
|
|
}
|
|
|
|
|
|
if(!StringUtils.isEmpty(article.getString("browseNumber"))){
|
|
|
heapm.setBrowseNumbere(Integer.valueOf(article.getString("browseNumber")));//文章浏览数
|
|
|
}else{
|
|
@ -177,7 +190,7 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
}else{
|
|
|
heapm.setCommentNumber(0);//文章评论数
|
|
|
}
|
|
|
|
|
|
|
|
|
if(!StringUtils.isEmpty(article.getString("pointNumber"))){
|
|
|
heapm.setPointNumber(Integer.valueOf(article.getString("pointNumber")));//文章点赞数
|
|
|
}else{
|
|
@ -189,7 +202,7 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
}else{
|
|
|
heapm.setCollectionNumber(0);//文章点赞数
|
|
|
}
|
|
|
|
|
|
|
|
|
heapm.setArticleCover(article.getString("articleCover"));//封面
|
|
|
if(article.getString("insertTime")!=null){
|
|
|
heapm.setComputeTime(computeTime(article.getString("insertTime")));
|
|
@ -216,7 +229,7 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public List<HealthEduArticleES> pushArticleListCount(String sendCode, String firstLevelCategoryId,String secondLevelCategoryId,Integer myArticle,Integer sendType,String currentUserRole,
|
|
|
String currentUserRoleLevel,String articleTitle,String sendTimeStart,String sendTimeEnd) throws Exception {
|
|
|
String currentUserRoleLevel,String articleTitle,String sendTimeStart,String sendTimeEnd) throws Exception {
|
|
|
|
|
|
StringBuffer sql2 = new StringBuffer("select * from " + esType +
|
|
|
" where doctorCode='" + sendCode + "' and userType = 2" );
|
|
@ -436,15 +449,15 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
*/
|
|
|
@Transactional
|
|
|
public List<HealthEduArticleES> savePCPushArticle(Set<String> patientSet,
|
|
|
String sendCode,
|
|
|
String sendCode,
|
|
|
// String sendName,
|
|
|
Integer sendType,
|
|
|
String sendMessage,
|
|
|
Long teamId,
|
|
|
String articleId,
|
|
|
String leaveWords,
|
|
|
String currentUserRoleCode,
|
|
|
String currentUserRoleLevel) throws Exception {
|
|
|
Integer sendType,
|
|
|
String sendMessage,
|
|
|
Long teamId,
|
|
|
String articleId,
|
|
|
String leaveWords,
|
|
|
String currentUserRoleCode,
|
|
|
String currentUserRoleLevel) throws Exception {
|
|
|
|
|
|
|
|
|
// String batchNo = UUID.randomUUID().toString();
|
|
@ -508,7 +521,6 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
// healthEduArticlePatient.setBatchNo(batchNo);
|
|
|
// healthEduArticlePatient.setCreateTime(new Date());
|
|
|
//
|
|
|
//
|
|
|
// //通过文章id 获取文章详情
|
|
|
// JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"");
|
|
|
//
|
|
@ -634,7 +646,9 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
|
|
|
//保存到ES中
|
|
|
elastricSearchSave.save(healthEduArticleESList, esIndex, esType);
|
|
|
HealthEduArticleES e = healthEduArticleESList.get(0);
|
|
|
|
|
|
HealthEduArticleES e = new HealthEduArticleES();
|
|
|
BeanUtils.copyProperties(healthEduArticleESList.get(0),e);
|
|
|
e.setUserType(2);
|
|
|
e.setPatientCode(null);
|
|
|
e.setPatientName(null);
|
|
@ -743,14 +757,14 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
if (!StringUtils.isEmpty(labelHealth) || !StringUtils.isEmpty(labelDisease)) {
|
|
|
tableSql += " left join wlyy_sign_patient_label_info l on w.patient=l.patient ";
|
|
|
whereSql += " and l.status=1 ";
|
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(labelHealth) && !StringUtils.isEmpty(labelDisease)) {
|
|
|
whereSql += " and ( (l.label_type = 2 AND l.label in (" + labelHealth + ") ) or (l.label_type = 3 AND l.label in (" + labelDisease + ") ))";
|
|
|
}else {
|
|
|
if(!StringUtils.isEmpty(labelHealth)){
|
|
|
whereSql += " and (l.label_type = 2 AND l.label in (" + labelHealth + "))";
|
|
|
}
|
|
|
|
|
|
|
|
|
if(!StringUtils.isEmpty(labelDisease)){
|
|
|
whereSql += " and (l.label_type = 3 AND l.label in (" + labelDisease + "))";
|
|
|
}
|
|
@ -767,7 +781,7 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
// if (!StringUtils.isEmpty(labelHealth) || !StringUtils.isEmpty(labelDisease)) {
|
|
|
// whereSql += ")";
|
|
|
// }
|
|
|
|
|
|
|
|
|
tableSql += " left join wlyy_patient p on p.code=w.patient AND p.openid IS NOT NULL and p.openid <>''";
|
|
|
if (!StringUtils.isEmpty(labelSex)) {
|
|
|
whereSql += " and p.sex in (" + labelSex + ") ";
|
|
@ -1047,10 +1061,10 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
// }
|
|
|
// patientSet.addAll(resultList);
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void readAllArticle(String patient)throws Exception{
|
|
|
|
|
|
|
|
|
// JestClient jestClient = null;
|
|
|
//
|
|
|
// try {
|
|
@ -1092,16 +1106,16 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
// for (HealthEduArticlePatient healthEduArticlePatient: esList) {
|
|
|
// healthEduArticlePatient.setIsread("1");
|
|
|
// }
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 一键修改居民推送文章的文章为已读
|
|
|
* @param patient
|
|
|
*/
|
|
|
public void readAllArticleNew(String patient,String firstLevelCategoryId){
|
|
|
JestClient jestClient = null;
|
|
|
|
|
|
|
|
|
try {
|
|
|
jestClient = elasticFactory.getJestClient();
|
|
|
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
|
@ -1135,7 +1149,7 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 居民单条文章增加已读状态
|
|
|
* @param patient
|
|
@ -1143,7 +1157,7 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
*/
|
|
|
public void readPatientArticle(String patient,String articleId){
|
|
|
JestClient jestClient = null;
|
|
|
|
|
|
|
|
|
try {
|
|
|
jestClient = elasticFactory.getJestClient();
|
|
|
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
|
@ -1177,23 +1191,22 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public JSONArray pushArticleLogs(int page, int pagesize, String patientCode,String level1Type) throws Exception {
|
|
|
|
|
|
page = (page - 1) * pagesize;
|
|
|
|
|
|
String sql = "SELECT * FROM " + esType + " where patientCode= '" + patientCode + "' and userType = 1";
|
|
|
|
|
|
|
|
|
if(!StringUtils.isEmpty(level1Type)){
|
|
|
sql= sql + " and firstLevelCategoryId = '"+level1Type+"' ";
|
|
|
}
|
|
|
|
|
|
sql += " order by createTime desc ";
|
|
|
if(pagesize !=0){
|
|
|
sql= sql+ " limit " + page + "," + pagesize;
|
|
|
}
|
|
|
|
|
|
|
|
|
List<HealthEduArticleES> esList = elasticsearchUtil.excute(sql, HealthEduArticleES.class, esIndex, esType);
|
|
|
HealthEduArticlePatientModel heapm = null;
|
|
|
JSONObject article = null;
|
|
@ -1291,7 +1304,7 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONObject queryArticlePcList(String firstLevelCategoryId, String secondLevelCategoryId, String insertTimeStart, String insertTimeEnd, String articlelevel, String articleTitle,
|
|
|
String userCode, String currentUserRole, String currentUserRoleLevel, String isAuthentication, Boolean isMyArticle, Integer page, Integer pageSize,Integer sEcho,Integer roleType) throws Exception{
|
|
|
String userCode, String currentUserRole, String currentUserRoleLevel, String isAuthentication, Boolean isMyArticle, Integer page, Integer pageSize,Integer sEcho,Integer roleType) throws Exception{
|
|
|
return thirdJkEduArticleService.queryArticlePcList(firstLevelCategoryId,secondLevelCategoryId,insertTimeStart,insertTimeEnd,articlelevel,isMyArticle,
|
|
|
articleTitle,userCode,isAuthentication,currentUserRole,currentUserRoleLevel,page,pageSize,sEcho,roleType);
|
|
|
}
|
|
@ -1310,7 +1323,7 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONObject queryArticleAPPList(String firstLevelCategoryId, String secondLevelCategoryId, String insertTimeStart, String insertTimeEnd, String articlelevel, String articleTitle,
|
|
|
String userCode, String currentUserRole, String currentUserRoleLevel, String isAuthentication, Boolean isMyArticle, Integer page, Integer pageSize,Integer roleType) throws Exception{
|
|
|
String userCode, String currentUserRole, String currentUserRoleLevel, String isAuthentication, Boolean isMyArticle, Integer page, Integer pageSize,Integer roleType) throws Exception{
|
|
|
return thirdJkEduArticleService.queryArticleAPPList(firstLevelCategoryId,secondLevelCategoryId,insertTimeStart,insertTimeEnd,articlelevel,isMyArticle,
|
|
|
articleTitle,userCode,isAuthentication,currentUserRole,currentUserRoleLevel,page,pageSize,roleType);
|
|
|
}
|
|
@ -1332,7 +1345,7 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONObject authenArticlePCList(String firstLevelCategoryId, String secondLevelCategoryId, String insertTimeStart, String insertTimeEnd, String articleTitle,
|
|
|
String currentUserRole, String currentUserRoleLevel, String isAuthentication,Integer page, Integer pageSize,Integer sEcho) throws Exception{
|
|
|
String currentUserRole, String currentUserRoleLevel, String isAuthentication,Integer page, Integer pageSize,Integer sEcho) throws Exception{
|
|
|
return thirdJkEduArticleService.authenArticlePCList(firstLevelCategoryId,secondLevelCategoryId,insertTimeStart,insertTimeEnd,
|
|
|
articleTitle,isAuthentication,currentUserRole,currentUserRoleLevel,page,pageSize,sEcho);
|
|
|
}
|