浏览代码

每日推送接口BUG修改

huangwenjie 7 年之前
父节点
当前提交
0d5e763a98

+ 16 - 14
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java

@ -116,10 +116,10 @@ public class JMJkEduArticleService extends BaseService {
            sql2.append(" and sendType='"+sendType+"' ");
        }
        if(!StringUtils.isEmpty(firstLevelCategoryId)){
            sql2.append("and level1Type="+firstLevelCategoryId);
            sql2.append("and firstLevelCategoryId="+firstLevelCategoryId);
        }
        if(!StringUtils.isEmpty(secondLevelCategoryId)){
            sql2.append("and level2Type="+secondLevelCategoryId);
            sql2.append("and secondLevelCategoryId="+secondLevelCategoryId);
        }
        if(myArticle==1){
            sql2.append(" and operatorId="+sendCode);
@ -138,7 +138,7 @@ public class JMJkEduArticleService extends BaseService {
            sql2.append(" and createTime <='"+sendTimeEnd+"'");
        }
        sql2.append("  order by createTime limit " + page + "," + pagesize);
        List<com.yihu.es.entity.HealthEduArticlePatient> esList = elasticsearchUtil.excute(sql2.toString(), com.yihu.es.entity.HealthEduArticlePatient.class, esIndex, esType);
        List<HealthEduArticleES> esList = elasticsearchUtil.excute(sql2.toString(), HealthEduArticleES.class, esIndex, esType);
        Map<String, HealthEduArticlePatientModel> result = new HashMap<>();
        HealthEduArticlePatientModel heapm = null;
        com.alibaba.fastjson.JSONObject article = null;
@ -146,7 +146,7 @@ public class JMJkEduArticleService extends BaseService {
    
        List<HealthEduArticlePatientModel> resultList = new ArrayList<>();
        
        for (HealthEduArticlePatient one : esList) {
        for (HealthEduArticleES one : esList) {
            article = thirdJkEduArticleService.getArticalById(one.getArticleId(),"");
            if (result.get(one.getArticleId()) != null) {
                heapm = result.get(one.getArticleId());
@ -161,10 +161,12 @@ public class JMJkEduArticleService extends BaseService {
            heapm.setAttachedTitle(article.getString("articleTitle"));
            heapm.setAttachedContent(article.getString("articleContent"));
            heapm.setArticleType(article.getString("articleType"));
            heapm.setLevel1Type(article.getString("firstLevelCategoryId"));
            heapm.setLevel2Type(article.getString("secondLevelCategoryId"));
            heapm.setLevel1Type(one.getFirstLevelCategoryId());
            heapm.setLevel1TypeName(one.getFirstLevelCategoryName());
            heapm.setLevel2Type(one.getSecondLevelCategoryId());
            heapm.setLevel2TypeName(one.getSecondLevelCategoryName());
            heapm.setLevel(article.getString("articlelevel"));
            heapm.setAllCount(heapm.getAllCount() + one.getPatients().size());
//            heapm.setAllCount(heapm.getAllCount() + one.getPatients().size());
            if(article.getString("browseNumber") != null){
                heapm.setBrowseNumbere(Integer.valueOf(article.getString("browseNumber")));//文章浏览数
            }
@ -200,20 +202,20 @@ public class JMJkEduArticleService extends BaseService {
     * @return
     * @throws Exception
     */
    public List<HealthEduArticlePatient> pushArticleListCount(String sendCode,  String firstLevelCategoryId,String secondLevelCategoryId,Integer myArticle,Integer sendType,String currentUserRole,
    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 {
        StringBuffer sql2 = new StringBuffer("select *  from   " + esType +
                " where  doctorCode='" + sendCode + "'");
                " where  sendCode='" + sendCode + "'");
        if(sendType==1){
            sql2.append(" and sendType='"+sendType+"' ");
        }
        if(!StringUtils.isEmpty(firstLevelCategoryId)){
            sql2.append("and level1Type="+firstLevelCategoryId);
            sql2.append("and firstLevelCategoryId="+firstLevelCategoryId);
        }
        if(!StringUtils.isEmpty(secondLevelCategoryId)){
            sql2.append("and level2Type="+secondLevelCategoryId);
            sql2.append("and secondLevelCategoryId="+secondLevelCategoryId);
        }
        if(myArticle==1){
            sql2.append(" and operatorId="+sendCode);
@ -231,7 +233,7 @@ public class JMJkEduArticleService extends BaseService {
            sendTimeEnd = elasticsearchUtil.changeTime(sendTimeEnd);
            sql2.append(" and createTime <='"+sendTimeEnd+"'");
        }
        List<HealthEduArticlePatient> esList = elasticsearchUtil.excute(sql2.toString(), com.yihu.es.entity.HealthEduArticlePatient.class, esIndex, esType);
        List<HealthEduArticleES> esList = elasticsearchUtil.excute(sql2.toString(),HealthEduArticleES.class, esIndex, esType);
        return esList;
    }
@ -1105,7 +1107,7 @@ public class JMJkEduArticleService extends BaseService {
            article = thirdJkEduArticleService.getArticalById(one.getArticleId(),"");
            heapm = new HealthEduArticlePatientModel();
            heapm.setSendName(one.getSendName());
            heapm.setSendCode(one.getSendCode());
            heapm.setSendCode(one.getDoctorCode());
            heapm.setCreateTime(DateUtil.dateToStrLong(one.getCreateTime()));
            heapm.setArticleId(article.getString("articleId"));
            heapm.setAttachedTitle(article.getString("articleTitle"));
@ -1124,7 +1126,7 @@ public class JMJkEduArticleService extends BaseService {
            heapm.setSendType(one.getSendType());//发送类型
            heapm.setIsread(String.valueOf(one.getIsRead()));//已读未读标识,1已读,2未读
            heapm.setLeaveWords(one.getLeaveWords());//医生留言
            doctor = doctorDao.findByCode(one.getSendCode());
            doctor = doctorDao.findByCode(one.getDoctorCode());
            heapm.setPhoto(doctor.getPhoto());
            result.add(heapm);
            // heapm.setTime();//时间  xx小时前  2017-10-11

+ 2 - 11
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEduPC/DoctorJMJkEduArticlePCController.java

@ -2,15 +2,10 @@ package com.yihu.wlyy.web.doctor.jimeiJkEduPC;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.es.entity.HealthEduArticlePatient;
import com.yihu.es.entity.HealthEduArticleES;
import com.yihu.wlyy.service.jimeiJkEdu.JMJkEduArticleService;
import com.yihu.wlyy.service.third.jkEduArticle.ThirdJkEduArticleService;
import com.yihu.wlyy.util.fastdfs.FastDFSUtil;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.third.gateway.vo.HealthEduArticlePatientModel;
import com.yihu.wlyy.web.third.gateway.vo.base.BaseResultModel;
import com.yihu.wlyy.web.third.gateway.vo.base.ResultPageListModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -19,10 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.InputStream;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@ -285,7 +276,7 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
            }
            List<HealthEduArticlePatientModel> eduArticlePatients = jmJkEduArticleService.pushArticleList(page, pagesize, getUID(),firstLevelCategoryId,secondLevelCategoryId,myArticle,sendType,currentRoleCode,currentRoleLevel,articleTitle,sendTimeStart,sendTimeEnd);
//            Long count = jmJkEduArticleService.pushArticleListCount(getUID(),2);
            List<HealthEduArticlePatient> eduArticlePatientsCount = jmJkEduArticleService.pushArticleListCount(getUID(),firstLevelCategoryId,secondLevelCategoryId,myArticle,sendType,currentRoleCode,
            List<HealthEduArticleES> eduArticlePatientsCount = jmJkEduArticleService.pushArticleListCount(getUID(),firstLevelCategoryId,secondLevelCategoryId,myArticle,sendType,currentRoleCode,
                    currentRoleLevel, articleTitle,sendTimeStart, sendTimeEnd);
            net.sf.json.JSONObject obj = new net.sf.json.JSONObject();
            obj.put("Code", 100);

+ 20 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/vo/HealthEduArticlePatientModel.java

@ -25,8 +25,12 @@ public class HealthEduArticlePatientModel {
    private String articleType;//文章类别
    @ApiModelProperty(value = "1级类别", required = false, access = "response")
    private String level1Type;//1级类别
    @ApiModelProperty(value = "1级类别名称", required = false, access = "response")
    private String level1TypeName;//1级类别
    @ApiModelProperty(value = "2级类别", required = false, access = "response")
    private String level2Type;//2级类别
    @ApiModelProperty(value = "2级类别名称", required = false, access = "response")
    private String level2TypeName;//2级类别
    @ApiModelProperty(value = "等级", required = false, access = "response")
    private String level;//等级
    @ApiModelProperty(value = "所有的推送数目", required = false, access = "response")
@ -217,4 +221,20 @@ public class HealthEduArticlePatientModel {
    public void setLeaveWords(String leaveWords) {
        this.leaveWords = leaveWords;
    }
    
    public String getLevel1TypeName() {
        return level1TypeName;
    }
    
    public void setLevel1TypeName(String level1TypeName) {
        this.level1TypeName = level1TypeName;
    }
    
    public String getLevel2TypeName() {
        return level2TypeName;
    }
    
    public void setLevel2TypeName(String level2TypeName) {
        this.level2TypeName = level2TypeName;
    }
}