Pārlūkot izejas kodu

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

huangwenjie 7 gadi atpakaļ
vecāks
revīzija
9e6131e10a

+ 2 - 1
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/extract/db/ESExtract.java

@ -26,7 +26,8 @@ public class ESExtract<T> {
     * @return
     */
    public List<DataModel> extract(QuartzJobConfig wlyyJobConfigVO) {
        //这边是直接查询 后面还用扩展ES 维度查询
        //扩展维度
        String sql= initSql(wlyyJobConfigVO.getSql(),wlyyJobConfigVO.getStartTime(),wlyyJobConfigVO.getEndTime());

+ 3 - 1
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/EsToEsQuotaJob.java

@ -165,10 +165,12 @@ public class EsToEsQuotaJob implements Job {
    }
    private List<SaveModel> data2save(List<DataModel> dataModels) {
        //初始化维度的数据
        Map<String,DataModel> dataModelMap=new HashMap<>();
        if(dataModels!=null){
            for(DataModel dataModel:dataModels){
                dataModelMap.put(dataModel.getAdminTeamCode(),dataModel);
                dataModelMap.put(dataModel.getTeam(),dataModel);
            }
        }

+ 1 - 1
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/util/ElasticsearchUtil.java

@ -433,7 +433,7 @@ public class ElasticsearchUtil {
                        }
                        try {
                            if (value instanceof String) {
                                DataModel.class.getMethod(key, String.class).invoke(dataModel, value);
                                 DataModel.class.getMethod(key, String.class).invoke(dataModel, value);
                            } else if (value instanceof Integer) {
                                DataModel.class.getMethod(key, Integer.class).invoke(dataModel, value);
                            } else if (value instanceof Double) {

+ 9 - 11
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/vo/DataModel.java

@ -4,6 +4,9 @@ package com.yihu.wlyy.statistics.vo;
import org.elasticsearch.common.collect.HppcMaps;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by chenweida on 2017/6/1.
 */
@ -13,7 +16,6 @@ public class DataModel {
    private String town;//区代码 350206
    private String hospital;//机构code
    private String team;//团队的code
    private String adminTeamCode;//
    private String slaveKey1;//从维度  1级维度
    private String slaveKey2;//从维度  2级维度
    private String slaveKey3;//从维度  3级维度
@ -23,12 +25,12 @@ public class DataModel {
    private String idcard;// 身份证
    private String serverType;//服务类型
    private String healthLable;//健康标签
    private Double num=1.0;//分数 如果是累加的计算 默认是1 如果是分数从数据库拿
    private Double num = 1.0;//分数 如果是累加的计算 默认是1 如果是分数从数据库拿
    private String prescriptionCode;//处方code
    private String healthProblem;//诊断标签
    private Double result1=0.0; //从ES统计的时候的数目
    private Double result1 = 0.0; //从ES统计的时候的数目
    public String getHealthLable() {
@ -159,6 +161,7 @@ public class DataModel {
        return null;
    }
    @Override
    public String toString() {
        return "DataModel{" +
@ -182,7 +185,9 @@ public class DataModel {
        this.patient = patient;
    }
    public String getPrescriptionCode() { return prescriptionCode; }
    public String getPrescriptionCode() {
        return prescriptionCode;
    }
    public void setPrescriptionCode(String prescriptionCode) {
        this.prescriptionCode = prescriptionCode;
@ -204,11 +209,4 @@ public class DataModel {
        this.result1 = result1;
    }
    public String getAdminTeamCode() {
        return adminTeamCode;
    }
    public void setAdminTeamCode(String adminTeamCode) {
        this.adminTeamCode = adminTeamCode;
    }
}

+ 87 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/jimeiJkEdu/PatientJMJkEduArticleController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.patient.jimeiJkEdu;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.service.jimeiJkEdu.JMJkEduArticleService;
import com.yihu.wlyy.web.BaseController;
@ -14,6 +15,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashSet;
import java.util.Set;
/**
 * Created by Trick on 2017/11/14.
 */
@ -96,4 +100,87 @@ public class PatientJMJkEduArticleController extends BaseController {
            return error(-1,"查询失败!");
        }
    }
    /**
     * 查询pc端文章列表
     * @param firstLevelCategoryId
     * @param secondLevelCategoryId
     * @param insertTimeStart
     * @param insertTimeEnd
     * @param articlelevel
     * @param articleTitle
     * @return
     */
    @RequestMapping(value = "queryArticlePcList", method = RequestMethod.GET)
    @ApiOperation("查询pc端文章列表")
    public  String queryArticlePcList(@ApiParam(name = "firstLevelCategoryId", value = "文章一级分类")
                                      @RequestParam(value = "firstLevelCategoryId", required = false) String firstLevelCategoryId,
                                      @ApiParam(name = "secondLevelCategoryId", value = "文章二级分类")
                                      @RequestParam(value = "secondLevelCategoryId", required = false) String secondLevelCategoryId,
                                      @ApiParam(name = "insertTimeStart", value = "新增文章开始时间")
                                      @RequestParam(value = "insertTimeStart", required = false) String insertTimeStart,
                                      @ApiParam(name = "insertTimeEnd", value = "新增文章结束时间")
                                      @RequestParam(value = "insertTimeEnd", required = false) String insertTimeEnd,
                                      @ApiParam(name = "articlelevel", value = "文章级别")
                                      @RequestParam(value = "articlelevel", required = false) String articlelevel,
                                      @ApiParam(name = "articleTitle", value = "文章标题关键字")
                                      @RequestParam(value = "articleTitle", required = false) String articleTitle,
                                      @ApiParam(name = "currentUserRole", value = "当前登录的角色")
                                      @RequestParam(value = "currentUserRole", required = false) String currentUserRole,
                                      @ApiParam(name = "currentUserRoleLevel", value = "当前登录的角色级别")
                                      @RequestParam(value = "currentUserRoleLevel", required = false )String currentUserRoleLevel,
                                      @ApiParam(name = "isAuthentication", value = "是否认证")
                                      @RequestParam(value = "isAuthentication", required = false) String isAuthentication,
                                      @ApiParam(name = "isMyArticle", value = "是否过滤我的文章")
                                      @RequestParam(value = "isMyArticle", required = false,defaultValue = "false") Boolean isMyArticle,
                                      @ApiParam(name = "iDisplayStart", value = "当前页") @RequestParam(value = "iDisplayStart", required = true) Integer page,
                                      @ApiParam(name = "iDisplayLength", value = "是否过滤我的文章") @RequestParam(value = "iDisplayLength", required = true) Integer pageSize,
                                      @ApiParam(name = "sEcho", value = "插件自带")
                                      @RequestParam(value = "sEcho", required = false) Integer sEcho,
                                      @ApiParam(name = "roleType", value = "1、普通医生,2、管理员")
                                      @RequestParam(value = "archive", required = false) Integer roleType,
                                      @ApiParam(name = "patient", value = "居民CODE")
                                      @RequestParam(value = "patient", required = false) String patient){
        try {
            if(StringUtils.isEmpty(currentUserRole)){
                currentUserRole=getCurrentRoleCode();
            }
            if(StringUtils.isEmpty(currentUserRoleLevel)){
                currentUserRoleLevel=getCurrentRoleLevel();
            }
            JSONObject response = jmJkEduArticleService.queryArticlePcList(firstLevelCategoryId,secondLevelCategoryId,insertTimeStart,insertTimeEnd,articlelevel,articleTitle,
                    getUID(),currentUserRole,currentUserRoleLevel,isAuthentication,isMyArticle,page,pageSize,sEcho,roleType);
            //判断文章列表是否有推送过该居民
            if(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"));
                    }
                }
                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");
                        if(articleids.contains(dataarticleid)){
                            datas.getJSONObject(i).put("ispush","1");
                        }else{
                            datas.getJSONObject(i).put("ispush","0");
                        }
                    }
                    response.put("aaData",datas);
                }
            }
            return write(200,"查询成功!","data",response);
        } catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败!");
        }
    }
}