Sfoglia il codice sorgente

Merge branch 'dev' of huangwenjie/patient-co-management into dev

huangwenjie 7 anni fa
parent
commit
fa840530cb

+ 9 - 1
common/common-entity/src/main/java/com/yihu/es/entity/HealthEduArticlePatient.java

@ -58,6 +58,7 @@ public class HealthEduArticlePatient {
    private String leaveWords;//医生留言
    private String currentUserRoleCode;//当前登录的角色code
    private String currentUserRoleLevel;//当前登录的角色级别
    private String isread;//1已读,0未读
    public String getId() {
        return id;
@ -355,5 +356,12 @@ public class HealthEduArticlePatient {
    public void setCurrentUserRoleLevel(String currentUserRoleLevel) {
        this.currentUserRoleLevel = currentUserRoleLevel;
    }
    
    public String getIsread() {
        return isread;
    }
    
    public void setIsread(String isread) {
        this.isread = isread;
    }
}

+ 1 - 0
edu-article/JkEdu/src/com/yihu/jk/api/ArticleApi.java

@ -163,6 +163,7 @@ public class ArticleApi {
					jsonObj.put("commentNumber", StringUtil.getJSONValue(vbo.getCommentNumber()));
					jsonObj.put("shareNumber", StringUtil.getJSONValue(vbo.getShareNumber()));
					jsonObj.put("collectionNumber", StringUtil.getJSONValue(vbo.getCollectionNumber()));
					jsonObj.put("articleContent",StringUtil.getJSONValue(vbo.getArticleContent()));
					array.add(jsonObj);
				}
			}

+ 63 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java

@ -4,8 +4,10 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPObject;
import com.yihu.edu.entity.RoleWithAuthorityCheck;
import com.yihu.es.entity.FollowupContentESDO;
import com.yihu.es.entity.HealthEduArticlePatient;
import com.yihu.es.entity.RoleVo;
import com.yihu.wlyy.config.es.ElasticFactory;
import com.yihu.wlyy.config.es.ElastricSearchSave;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
@ -24,6 +26,12 @@ import com.yihu.wlyy.util.ElasticsearchUtil;
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.HealthEduArticlePatientModel;
import io.searchbox.client.JestClient;
import io.searchbox.core.Search;
import io.searchbox.core.SearchResult;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.annotation.Transient;
@ -35,6 +43,8 @@ import org.springframework.util.StringUtils;
import java.util.*;
import static org.bouncycastle.asn1.x509.X509ObjectIdentifiers.id;
/**
 * Created by liuwenbin on 2017/8/12.
 * 集美健教
@ -47,6 +57,9 @@ public class JMJkEduArticleService extends BaseService {
    private String esType;
    @Value("${es.index.HealthEduArticlePatient}")
    private String esIndex;
    
    @Autowired
    private ElasticFactory elasticFactory;
    @Autowired
    private ElasticsearchUtil elasticsearchUtil;
    @Autowired
@ -892,6 +905,54 @@ public class JMJkEduArticleService extends BaseService {
//        }
//        patientSet.addAll(resultList);
//    }
    
    
    public void readAllArticle(String patient)throws Exception{
    
//        JestClient jestClient = null;
//
//        try {
//            jestClient = elasticFactory.getJestClient();
//            //先根据条件查找出来
//            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
//            searchSourceBuilder.query(
//                    new BoolQueryBuilder()
//                            .must(QueryBuilders.matchQuery("followup_id", id))
//            );
//            Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType).build();
//            SearchResult result = jestClient.execute(search);
////            logger.info("同步单条随访记录-开始查询ES数据,时间:"+DateUtil.getStringDate());
//            List<com.yihu.es.entity.HealthEduArticlePatient> dataList = result.getSourceAsObjectList(com.yihu.es.entity.HealthEduArticlePatient.class);
////            logger.info("同步单条随访记录-ES数据查询成功,时间:"+DateUtil.getStringDate());
//            if(!dataList.isEmpty()){
//                //删除原有记录
////                logger.info("同步单条随访记录-开始删除ES数据,时间:"+DateUtil.getStringDate());
//                this.esDeleteFollowUpContent(dataList);
////                logger.info("同步单条随访记录-ES数据删除成功,时间:"+DateUtil.getStringDate());
//            }
//            //保存新的随访详情记录
////            logger.info("同步单条随访记录-开始保存ES数据,时间:"+DateUtil.getStringDate());
//            elastricSearchSave.save(newdatalist,esIndex,esType);
////            logger.info("同步单条随访记录-ES数据保存成功,时间:"+DateUtil.getStringDate());
//            jestClient.shutdownClient();
//        }catch (Exception e){
//            logger.error(" save error :" + e.getMessage());
//            e.printStackTrace();
//        } finally {
//            if (jestClient != null) {
//                jestClient.shutdownClient();
//            }
//        }
//
//
//        String sql = "SELECT * FROM " + esType + "  where nested(patients.code)= '" + patient + "' ";
//        List<com.yihu.es.entity.HealthEduArticlePatient> esList = elasticsearchUtil.excute(sql, com.yihu.es.entity.HealthEduArticlePatient.class, esIndex, esType);
//        for (HealthEduArticlePatient healthEduArticlePatient: esList) {
//            healthEduArticlePatient.setIsread("1");
//        }
        
    }
    
    public JSONArray pushArticleLogs(int page, int pagesize, String patientCode,String level1Type) throws Exception {
@ -937,6 +998,8 @@ public class JMJkEduArticleService extends BaseService {
            heapm.setComputeTime(computeTime(article.getString("insertTime")));
            heapm.setOperatorName(article.getString("operatorName"));
            heapm.setSendType(one.getSendType());//发送类型
            heapm.setIsread(one.getIsread());//已读未读标识,1已读,2未读
            heapm.setLeaveWords(one.getLeaveWords());
            doctor = doctorDao.findByCode(one.getDoctorCode());
            heapm.setPhoto(doctor.getPhoto());
            result.add(heapm);

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

@ -37,8 +37,6 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
    @Autowired
    private JMJkEduArticleService jmJkEduArticleService;
    @Autowired
    private ThirdJkEduArticleService thirdJkEduArticleService;
    @Value("${fastDFS.fastdfs_file_url}")
    String fastdfs_file_url;
    @Value("${neiwang.enable}")
@ -153,7 +151,7 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
                    }
                }
                
                JSONArray datas = response.getJSONObject("data").getJSONArray("aaData");
                JSONArray datas = response.getJSONArray("aaData");
                if(datas.size() > 0 && !articleids.isEmpty()){
                    for (int i = 0; i < datas.size(); i++) {
                        String dataarticleid = datas.getJSONObject(i).getString("articleid");
@ -163,7 +161,7 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
                            datas.getJSONObject(i).put("ispush","0");
                        }
                    }
                    response.getJSONObject("data").put("aaData",datas);
                    response.put("aaData",datas);
                }
            }

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

@ -1,12 +1,7 @@
package com.yihu.wlyy.web.third.gateway.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.searchbox.annotations.JestId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.data.annotation.CreatedDate;
import java.util.Date;
/**
 * 推送记录表
@ -46,6 +41,10 @@ public class HealthEduArticlePatientModel {
    private String articleCover="";//封面图
    @ApiModelProperty(value = "发送类型", required = false, access = "response")
    private Integer sendType = 0;//发送类型 1医生发送 2卫纪委发送
    @ApiModelProperty(value = "已读未读标识:1已读,0未读", required = false, access = "response")
    private String isread;//已读未读
    @ApiModelProperty(value = "", required = false, access = "response")
    private String leaveWords;//医生留言
    
    private String computeTime;//时间
    private String photo;//医生头像
@ -202,4 +201,20 @@ public class HealthEduArticlePatientModel {
    public void setSendType(Integer sendType) {
        this.sendType = sendType;
    }
    
    public String getIsread() {
        return isread;
    }
    
    public void setIsread(String isread) {
        this.isread = isread;
    }
    
    public String getLeaveWords() {
        return leaveWords;
    }
    
    public void setLeaveWords(String leaveWords) {
        this.leaveWords = leaveWords;
    }
}

+ 32 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkEduArticle/ThirdJkEduArticleController.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.web.third.jkEduArticle;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.service.jimeiJkEdu.JMJkEduArticleService;
import com.yihu.wlyy.service.third.jkEduArticle.ThirdJkEduArticleService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
@ -14,6 +15,9 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.HashSet;
import java.util.Set;
/**
 * 调用福州健教接口
@ -31,6 +35,8 @@ public class ThirdJkEduArticleController extends BaseController {
    private String articleBaseUrl;
    @Autowired
    private ThirdJkEduArticleService thirdJkEduArticleService;
    @Autowired
    private JMJkEduArticleService jmJkEduArticleService;
    /**********************************福州健康文章接口********************************************/
@ -73,10 +79,34 @@ public class ThirdJkEduArticleController extends BaseController {
                                           @ApiParam(name = "pageSize", value = "每页显示数 ,默认5")
                                           @RequestParam(value = "pageSize", required = false) Integer pageSize,
                                           @ApiParam(name = "userType", value = "用户类型:1医生,2居民",defaultValue = "1")
                                           @RequestParam(value = "userType", required = true) Integer userType){
                                           @RequestParam(value = "userType", required = true) Integer userType,
                                           @ApiParam(name = "patient", value = "居民CODE")
                                           @RequestParam(value = "patient", required = false) String patient){
        try {
            com.alibaba.fastjson.JSONArray response = thirdJkEduArticleService.getCollectionArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,getRepUID(),userType,myArticle);
            com.alibaba.fastjson.JSONArray response = thirdJkEduArticleService.getCollectionArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"rll201703150222",userType,myArticle);
//            com.alibaba.fastjson.JSONArray response = thirdJkEduArticleService.getCollectionArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"812f75071f434fde9a1fb64c6213a897",userType,myArticle);
    
            //判断文章列表是否有推送过该居民
            if(org.apache.commons.lang3.StringUtils.isNotBlank(patient)){
                com.alibaba.fastjson.JSONArray pushresponse = jmJkEduArticleService.pushArticleLogs(0,0,patient,"");
                Set<String> articleids = new HashSet<>();
                if(pushresponse.size() > 0){
                    for (int i = 0; i < pushresponse.size(); i++) {
                        articleids.add(pushresponse.getJSONObject(i).getString("articleId"));
                    }
                }
        
                if(response.size() > 0 && !articleids.isEmpty()){
                    for (int i = 0; i < response.size(); i++) {
                        String dataarticleid = response.getJSONObject(i).getString("articleId");
                        if(articleids.contains(dataarticleid)){
                            response.getJSONObject(i).put("ispush","1");
                        }else{
                            response.getJSONObject(i).put("ispush","0");
                        }
                    }
                }
            }
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();