trick9191 7 éve
szülő
commit
cd3d49c81a
24 módosított fájl, 569 hozzáadás és 351 törlés
  1. 67 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/DiseaseConvert.java
  2. 55 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/PrescriptionStatusConvert.java
  3. 26 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/model/PrescriptionDisease.java
  4. 4 4
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/save/es/ElasticFactory.java
  5. 14 4
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/service/ExtractDataService.java
  6. 38 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/util/Contant.java
  7. 8 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/vo/DataModel.java
  8. 57 0
      patient-co/patient-co-statistics-es/src/main/resources/application-dev.yml
  9. 43 0
      patient-co/patient-co-statistics-es/src/main/resources/application-prod.yml
  10. 61 0
      patient-co/patient-co-statistics-es/src/main/resources/application-test.yml
  11. 0 239
      patient-co/patient-co-statistics-es/src/main/resources/application.yml
  12. 5 5
      patient-co/patient-co-statistics/pom.xml
  13. 40 40
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/WebSecurityConfig.java
  14. 1 1
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/dao/QuartzJobConfigDao.java
  15. 10 0
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/mycache/CachePool.java
  16. 1 1
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java
  17. 12 5
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/service/JobService.java
  18. 11 11
      patient-co/patient-co-statistics/src/main/resources/application.yml
  19. 2 2
      patient-co/patient-co-statistics/src/main/resources/quartz.properties
  20. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/EncodingFilter.java
  21. 92 35
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  22. 3 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/system/SystemDictService.java
  23. 17 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java
  24. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

+ 67 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/DiseaseConvert.java

@ -0,0 +1,67 @@
package com.yihu.wlyy.statistics.etl.convert.wlyy;
import com.yihu.wlyy.entity.dimension.WlyyDimensionQuota;
import com.yihu.wlyy.statistics.etl.convert.Convert;
import com.yihu.wlyy.statistics.etl.convert.wlyy.model.HealthLable;
import com.yihu.wlyy.statistics.etl.convert.wlyy.model.PrescriptionDisease;
import com.yihu.wlyy.statistics.vo.DataModel;
import org.springframework.beans.BeanUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 长处方疾病
 * Created by zhangdan on 2017/10/26.
 */
public class DiseaseConvert implements Convert {
    @Override
    public List<DataModel> convert(JdbcTemplate jdbcTemplate, List<DataModel> oneList, String slaveLevel, WlyyDimensionQuota temp) {
        List<DataModel> returnList = new ArrayList<>();
        Map<String, List<String>> prescriptionDiseaseMap = new HashMap<>();//key是处方code value是处方标签 1高血压 2糖尿病
        //初始化标签Map
        initHealthLabesMap(jdbcTemplate, prescriptionDiseaseMap);
        //把标签Map设置到对应的维度里面
        for (DataModel dataModel : oneList) {
            List<String> healthProblems = prescriptionDiseaseMap.get(dataModel.getPrescriptionCode());
            if (healthProblems != null && healthProblems.size() > 0) {
                healthProblems.stream().forEach(str -> {
                    try {
                        DataModel dataModelTemp = new DataModel();
                        BeanUtils.copyProperties(dataModel, dataModelTemp);
                        DataModel.class.getMethod("setSlaveKey" + slaveLevel, String.class).invoke(dataModelTemp, str);
                        returnList.add(dataModelTemp);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                });
            }
        }
        return returnList;
    }
    private void initHealthLabesMap(JdbcTemplate jdbcTemplate, Map<String, List<String>> prescriptionDiseaseMap) {
        //得到长处方的疾病标签(只要高血压 糖尿病)
        String sql = "SELECT " +
                "  health_problem ," +
                "  prescription_code " +
                "FROM " +
                "  wlyy_prescription_diagnosis " +
                "WHERE " +
                "  health_problem = 'HP0047' " +
                "OR health_problem = 'HP0093' ";
        List<PrescriptionDisease> prescriptionDiseases = jdbcTemplate.query(sql, new BeanPropertyRowMapper(PrescriptionDisease.class));
        prescriptionDiseases.stream().forEach(one -> {
            List<String> labels = prescriptionDiseaseMap.get(one.getPrescriptionCode());
            if (labels == null) {
                labels = new ArrayList<String>();
            }
            labels.add(one.getHealthProblem());
            prescriptionDiseaseMap.put(one.getPrescriptionCode(), labels);
        });
    }
}

+ 55 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/PrescriptionStatusConvert.java

@ -0,0 +1,55 @@
package com.yihu.wlyy.statistics.etl.convert.wlyy;
import com.yihu.wlyy.entity.dimension.WlyyDimensionQuota;
import com.yihu.wlyy.statistics.etl.convert.Convert;
import com.yihu.wlyy.statistics.etl.convert.wlyy.model.PrescriptionDisease;
import com.yihu.wlyy.statistics.util.Contant;
import com.yihu.wlyy.statistics.vo.DataModel;
import org.springframework.beans.BeanUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 长处方疾病
 * Created by zhangdan on 2017/10/26.
 */
public class PrescriptionStatusConvert implements Convert {
    public List<DataModel> convert(JdbcTemplate jdbcTemplate, List oneList, String slaveLevel, WlyyDimensionQuota temp ) {
        oneList.stream().forEach(one -> {
            try {
                Object value = DataModel.class.getMethod("get" + temp.getKey()).invoke(one);
                //获取到prescriptionCode,求长处方状态
                String sql ="SELECT status FROM wlyy_prescription WHERE code=?";
                //int status = jdbcTemplate.queryForObject(sql, Integer.class);
                Object[] args = {value};
                int status=jdbcTemplate.queryForObject(sql,args,Integer.class);
                String key = getStatusCode(status);
                DataModel.class.getMethod("setSlaveKey" + slaveLevel, String.class).invoke(one, key);
            } catch (Exception e) {
                e.printStackTrace();
            }
        });
        return oneList;
    }
    public String getStatusCode(Integer status) {
        if (status >= 0 && status <= 100) {
            return Contant.prescriptionStatus.status_1;
        } else if (status==100) {
            return Contant.prescriptionStatus.status_2;
        } else if (status==-2) {
            return Contant.prescriptionStatus.status_3;
        } else if (status==-1) {
            return Contant.prescriptionStatus.status_4;
        } else if (status==-3) {
            return Contant.prescriptionStatus.status_5;
        } else{
            return "0";
        }
    }
}

+ 26 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/model/PrescriptionDisease.java

@ -0,0 +1,26 @@
package com.yihu.wlyy.statistics.etl.convert.wlyy.model;
/**
 * Created by zhangdan on 2017/10/26.
 */
public class PrescriptionDisease {
    private String healthProblem;
    private String prescriptionCode;
    public String getHealthProblem() {
        return healthProblem;
    }
    public void setHealthProblem(String healthProblem) {
        this.healthProblem = healthProblem;
    }
    public String getPrescriptionCode() {
        return prescriptionCode;
    }
    public void setPrescriptionCode(String prescriptionCode) {
        this.prescriptionCode = prescriptionCode;
    }
}

+ 4 - 4
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/save/es/ElasticFactory.java

@ -55,9 +55,9 @@ public class ElasticFactory {
                .multiThreaded(true)
                .maxTotalConnection(50)// 最大链接
                .maxConnectionIdleTime(120, TimeUnit.SECONDS)//链接等待时间
                .connTimeout(30000)
                .discoveryEnabled(true)
                .readTimeout(30000)//30秒
                .connTimeout(60*1000)
               // .discoveryEnabled(true)
                .readTimeout(60*1000)//60秒
                .build());//得到链接
    }
@ -77,7 +77,7 @@ public class ElasticFactory {
    private synchronized void initTranClient() throws UnknownHostException {
        if (transportClient == null) {
            Settings settings = Settings.settingsBuilder()
                    .put("client.transport.sniff", true)//开启嗅探功能
                   // .put("client.transport.sniff", true)//开启嗅探功能
                    .put("cluster.name", StringUtils.isEmpty(clusterName) ? "jkzl" : clusterName)//默认集群名字是jkzl
                    .build();

+ 14 - 4
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/service/ExtractDataService.java

@ -11,8 +11,12 @@ import io.searchbox.core.*;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
@ -35,19 +39,25 @@ public class ExtractDataService {
    @Value("${es.index}")
    private String esIndex;
    @Autowired
    private WlyyQuotaResultDao wlyyQuotaResultDao;
    @Autowired
    private ElastricSearchSave elastricSearchSave;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    private Logger logger= LoggerFactory.getLogger(ExtractDataService.class);
    public void extractOneDate(String date) {
        List<WlyyQuotaResult> quotaResults = wlyyQuotaResultDao.findByDate(date);
        String sql = "select * from wlyy_quota_result w where w.level1_type=1  and w.quato_code !=18 and w.quato_code !=19 and quota_date='" + date + "' ";
        List<WlyyQuotaResult> quotaResults = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyQuotaResult.class));
        save2es(quotaResults, date, null);
        logger.info("date:"+date+" all quota      success");
    }
    public void extractOneDateWithId(String date, String quotaId) {
        List<WlyyQuotaResult> quotaResults = wlyyQuotaResultDao.findByDateAndId(date, quotaId);
        String sql = "select * from wlyy_quota_result w where w.level1_type=1  and w.quato_code !=18 and w.quato_code !=19 and quota_date='" + date + "' and quato_code='" + quotaId + "'";
        List<WlyyQuotaResult> quotaResults = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyQuotaResult.class));
        save2es(quotaResults, date, quotaId);
        logger.info("date:"+date+",quotaId:"+quotaId+"      success");
    }
    public void extractDate2Date(String start, String end) throws Exception {

+ 38 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/util/Contant.java

@ -139,4 +139,42 @@ public class Contant {
        public static String level_age_5_name="51~65";
        public static String level_age_6_name=">65";
    }
    public static class prescriptionStatus{
        public static String status_1="1";
        public static String status_2="2";
        public static String status_3="3";
        public static String status_4="4";
        public static String status_5="5";
        public static String status_6="6";
        public static String status_7="7";
        public static String status_8="8";
        public static String status_9="9";
        public static String status_10="10";
        public static String status_11="11";
        public static String status_12="12";
        public static String status_13="13";
//        public static String status_1_name="续方取消";
//        public static String status_2_name="审核不通过";
//        public static String status_3_name="审核中";
//        public static String status_4_name="药师审核中";
//        public static String status_5_name="药师审核失败";
//        public static String status_6_name="开方中/药师审核成功";
//        public static String status_7_name="开方失败/预结算失败";
//        public static String status_8_name="待支付";
//        public static String status_9_name="支付成功/待配药";
//        public static String status_10_name="等待领药";
//        public static String status_11_name="配送中";
//        public static String status_12_name="已完成";
//        public static String status_13_name="进行中";
        public static String status_1_name="进行中";//大于0小于100
        public static String status_2_name="已完成";//100
        public static String status_3_name="已取消";//患者取消,-2
        public static String status_4_name="审核不通过";//-1;
        public static String status_5_name="其他原因取消";//支付超时,-3;
    }
}

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

@ -22,6 +22,8 @@ public class DataModel {
    private String serverType;//服务类型
    private String healthLable;//健康标签
    private Double num=1.0;//分数 如果是累加的计算 默认是1 如果是分数从数据库拿
    private String prescriptionCode;//处方code
    public String getHealthLable() {
        return healthLable;
@ -173,4 +175,10 @@ public class DataModel {
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getPrescriptionCode() { return prescriptionCode; }
    public void setPrescriptionCode(String prescriptionCode) {
        this.prescriptionCode = prescriptionCode;
    }
}

+ 57 - 0
patient-co/patient-co-statistics-es/src/main/resources/application-dev.yml

@ -0,0 +1,57 @@
spring:
  profiles: dev
  datasource:
    primaryReadWrite: #只读库 主库
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
#       url: jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#       username: linzhou
#       password: linzhou
    primaryRead: #只读库 从库
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
#       url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#       username: linzhou
#       password: linzhou
    im: #im库
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
  followupMessage:
    cron : 0 5 0 * * ?
    jobId : FOLLOWUP_PLAN_JOB
fv:
  jdbc:
    driver: com.mysql.jdbc.Driver
    url: jdbc:mysql://172.19.103.77/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    username: root
    password: 123456
systemConfig:
  msg_push_server: http://172.19.103.76:3000
es:
  index: wlyy_quota_dev
  type: wlyy_quota_dev
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  clusterName: jkzl
wlyy:
  im:
    databaseName: im_new
quartz:
  name: schedulerFactoryBean_dev

+ 43 - 0
patient-co/patient-co-statistics-es/src/main/resources/application-prod.yml

@ -0,0 +1,43 @@
spring:
  profiles: prod
  datasource:
    primaryReadWrite:
      url: jdbc:mysql://59.61.92.90:8079/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
    primaryRead:
      url: jdbc:mysql://59.61.92.90:8079/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
    im: #im库:
      url: jdbc:mysql://59.61.92.90:8079/im?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: im
      password: im!)123
  redis:
    host: 27.155.101.77 # Redis server host.
    port: 6380 # Redis server port.
    password: jkzl_ehr
  followupMessage:
    cron : 0 5 0 * * ?
    jobId : FOLLOWUP_PLAN_JOB
systemConfig:
  msg_push_server: http://127.0.0.1:3000
es:
  index: wlyy_quota_prod
  type: wlyy_quota_prod
  host:  59.61.92.90
  port: 9067
  tPort: 9068
  clusterName: jkzl
wlyy:
  im:
    databaseName: im
quartz:
  name: schedulerFactoryBean_es_prod

+ 61 - 0
patient-co/patient-co-statistics-es/src/main/resources/application-test.yml

@ -0,0 +1,61 @@
spring:
  profiles: test
  datasource:
#    primaryReadWrite:
#      url: jdbc:mysql://172.19.103.85/data_for_stats?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: linzhou
#      password: linzhou
#    primaryRead:
#      url: jdbc:mysql://172.19.103.85/data_for_stats?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: linzhou
#      password: linzhou
#    im: #im库
#      url: jdbc:mysql://172.17.110.160/im_new?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: linzhou
#      password: linzhou
    primaryReadWrite:
      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
    primaryRead:
      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
    im: #im库
      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
  followupMessage:
    cron : 0 5 0 * * ?
    jobId : FOLLOWUP_PLAN_JOB
fv:
  jdbc:
    driver: com.mysql.jdbc.Driver
    url: jdbc:mysql://172.17.110.160/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    username: ssgg
    password: ssgg
systemConfig:
  msg_push_server: http://127.0.0.1:3000
es:
  index: wlyy_quota_test
  type: wlyy_quota_test
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  clusterName: jkzl
wlyy:
  im:
    databaseName: im_new
quartz:
  name: schedulerFactoryBean_cwd

+ 0 - 239
patient-co/patient-co-statistics-es/src/main/resources/application.yml

@ -96,242 +96,3 @@ security:
logging:
  level:
    root: INFO
redis:
  quota:
    current:
      expire: 24 #实时统计redis 的过期时间 默认是2小时
---
spring:
  profiles: test
  datasource:
#    primaryReadWrite:
#      url: jdbc:mysql://172.19.103.85/data_for_stats?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: linzhou
#      password: linzhou
#    primaryRead:
#      url: jdbc:mysql://172.19.103.85/data_for_stats?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: linzhou
#      password: linzhou
#    im: #im库
#      url: jdbc:mysql://172.17.110.160/im_new?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: linzhou
#      password: linzhou
    primaryReadWrite:
      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
    primaryRead:
      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
    im: #im库
      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
  followupMessage:
    cron : 0 5 0 * * ?
    jobId : FOLLOWUP_PLAN_JOB
fv:
  jdbc:
    driver: com.mysql.jdbc.Driver
    url: jdbc:mysql://172.17.110.160/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    username: ssgg
    password: ssgg
systemConfig:
  msg_push_server: http://127.0.0.1:3000
es:
  index: wlyy_quota_test
  type: wlyy_quota_test
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  clusterName: jkzl
wlyy:
  im:
    databaseName: im_new
quartz:
  name: schedulerFactoryBean_cwd
---
spring:
  profiles: prod
  datasource:
    primaryReadWrite:
      url: jdbc:mysql://59.61.92.94:3306/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
    primaryRead:
      url: jdbc:mysql://59.61.92.94:8883/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
    im: #im库:
      url: jdbc:mysql://59.61.92.94/im?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: im
      password: im!)123
  redis:
    host: 120.41.253.95 # Redis server host.
    port: 6380 # Redis server port.
    password: jkzl_ehr
  followupMessage:
    cron : 0 5 0 * * ?
    jobId : FOLLOWUP_PLAN_JOB
fv:
  jdbc:
    driver: com.mysql.jdbc.Driver
    url: jdbc:mysql://59.61.92.94:8883/fv?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: wlyy
    password: jkzlehr@123
systemConfig:
  msg_push_server: http://127.0.0.1:3000
es:
  host: 192.168.1.1
wlyy:
  im:
    databaseName: im
quartz:
  name: schedulerFactoryBean_prod
---
spring:
  profiles: dev
  datasource:
    primaryReadWrite: #只读库 主库
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
#       url: jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#       username: linzhou
#       password: linzhou
    primaryRead: #只读库 从库
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
#       url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#       username: linzhou
#       password: linzhou
    im: #im库
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
  followupMessage:
    cron : 0 5 0 * * ?
    jobId : FOLLOWUP_PLAN_JOB
fv:
  jdbc:
    driver: com.mysql.jdbc.Driver
    url: jdbc:mysql://172.19.103.77/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    username: root
    password: 123456
systemConfig:
  msg_push_server: http://172.19.103.76:3000
es:
  index: wlyy_quota_dev
  type: wlyy_quota_dev
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  clusterName: jkzl
wlyy:
  im:
    databaseName: im_new
quartz:
  name: schedulerFactoryBean_dev
---
spring:
  profiles: local
  datasource:
    primaryReadWrite: #只读库 主库
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
#       url: jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#       username: linzhou
#       password: linzhou
    primaryRead: #只读库 从库
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
#       url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#       username: linzhou
#       password: linzhou
    im: #im库
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
  followupMessage:
    cron : 0 5 0 * * ?
    jobId : FOLLOWUP_PLAN_JOB
fv:
  jdbc:
    driver: com.mysql.jdbc.Driver
    url: jdbc:mysql://172.19.103.77/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    username: root
    password: 123456
systemConfig:
  msg_push_server: http://172.19.103.76:3000
es:
  index: wlyy_quota_local
  type: wlyy_quota_local
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  clusterName: jkzl
wlyy:
  im:
    databaseName: im_new
quartz:
  name: schedulerFactoryBean_local

+ 5 - 5
patient-co/patient-co-statistics/pom.xml

@ -351,11 +351,11 @@
            <artifactId>spring-boot-starter-jdbc</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>org.springframework.boot</groupId>-->
            <!--<artifactId>spring-boot-starter-security</artifactId>-->
            <!--<version>${version.spring-boot}</version>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>

+ 40 - 40
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/WebSecurityConfig.java

@ -1,40 +1,40 @@
//package com.yihu.wlyy.statistics.config;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
//
///**
// * Created by Administrator on 2016.10.17.
// */
//@Configuration
//@EnableWebSecurity
//public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
//
//    @Value("${security.basic.username}")
//    String username;
//    @Value("${security.basic.password}")
//    String password;
//
//    protected void configure(HttpSecurity http) throws Exception {
//        http.csrf().disable().authorizeRequests()
//                .anyRequest().authenticated()
//                .and()
//                .formLogin().defaultSuccessUrl("/swagger-ui.html").failureUrl("/login") //登录成功之后的跳转
//                .permitAll()
//                .and()
//                .logout().logoutSuccessUrl("/login")
//                .permitAll();
//    }
//
//    @Autowired
//    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
//            auth.inMemoryAuthentication()
//                .withUser(username).password(password).roles("USER");
//    }
//
//}
package com.yihu.wlyy.statistics.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
/**
 * Created by Administrator on 2016.10.17.
 */
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    @Value("${security.basic.username}")
    String username;
    @Value("${security.basic.password}")
    String password;
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable().authorizeRequests()
                .anyRequest().authenticated()
                .and()
                .formLogin().defaultSuccessUrl("/swagger-ui.html").failureUrl("/login") //登录成功之后的跳转
                .permitAll()
                .and()
                .logout().logoutSuccessUrl("/login")
                .permitAll();
    }
    @Autowired
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
            auth.inMemoryAuthentication()
                .withUser(username).password(password).roles("USER");
    }
}

+ 1 - 1
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/dao/QuartzJobConfigDao.java

@ -18,7 +18,7 @@ public interface QuartzJobConfigDao extends PagingAndSortingRepository<QuartzJob
    @Query(" FROM QuartzJobConfig a WHERE a.status=?1 and a.del='1'")
    List<QuartzJobConfig> findByAll(String s);
    @Query(" FROM QuartzJobConfig a WHERE  a.del='1' ")
    @Query(" FROM QuartzJobConfig a WHERE  a.del='1' and a.id != 11")
    List<QuartzJobConfig> findByIds();
    @Query(" FROM QuartzJobConfig a WHERE a.id=?1 and a.del='1'")

+ 10 - 0
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/mycache/CachePool.java

@ -262,6 +262,15 @@ public class CachePool {
        diseaseGroup.clear();
        healthGroup.clear();
        serverGroup.clear();
        arriveRenewSignOrgOutMap.clear();
        arriveRenewSignTeamOutMap.clear();
        arriveRenewSignTownOutMap.clear();
        arriveRenewTotalCityMap.clear();
        arriveRenewTotalOrgMap.clear();
        arriveRenewTotalTeamMap.clear();
        arriveRenewTotalTownMap.clear();
        renewDiseaseGroup.clear();;
    }
    public static Map<String, CacheModel> getArriveSignFamilyExpenseStatus1Map() {
@ -335,6 +344,7 @@ public class CachePool {
        if (model == null) {
            model = new RenewCacheModel();
            String sql=" select fr.sign_code code,fr.hospital ,fr.admin_team_id ,fr.patient " +
                    "   from wlyy_sign_family_renew_log fr " +
                    "   where " +

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

@ -337,7 +337,7 @@ public class CurrentDayAllQuotaJob implements Job {
        computequota_8(sql, signFamilies, null);//统计今天的签约患者年龄
        computequota_9();//统计今天的待签约
        computequota_10();//统计今天的改签
        computequota_12(sql, signFamilies, null);//统计今天的签约下按年龄分组后再
       // computequota_12(sql, signFamilies, null);//统计今天的签约下按年龄分组后再  无效
        computequota_13(sql, signFamilies, null);//统计今天的签约量
        computequota_16_1(sql, signFamilies, null);//统计今天的签约数的扣费钱
        computequota_15(sql, signFamilies, null);//统计今天的健康分布统计

+ 12 - 5
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/service/JobService.java

@ -20,6 +20,8 @@ import com.yihu.wlyy.statistics.model.signfamily.SignFamily;
import com.yihu.wlyy.statistics.vo.WlyyJobConfigVO;
import com.yihu.wlyy.statistics.vo.WlyyQuotaVO;
import org.quartz.SchedulerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -37,6 +39,8 @@ import java.util.*;
 */
@Service
public class JobService {
    private Logger logger= LoggerFactory.getLogger(JobService.class);
    @Autowired
    private QuartzHelper quartzHelper;
@ -54,6 +58,8 @@ public class JobService {
    @Autowired
    private CachePool cachePool;
    private Long sleepTime=60000L;
    @Transactional
    public void stopById(String id) throws Exception {
        QuartzJobConfig quartzJobConfig = wlyyJobConfigDao.findById(id, "1");
@ -164,7 +170,7 @@ public class JobService {
                params.put("yesterday", getYesterday(0 - i));
                if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                    quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
                    Thread.sleep(60000L);
                    Thread.sleep(sleepTime);
                }
            }
        }
@ -206,7 +212,8 @@ public class JobService {
            params.put("yesterday", yesterday);
            if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
                Thread.sleep(60000L);
                logger.info(quartzJobConfig.getId());
                Thread.sleep(sleepTime);
            }
        }
@ -252,7 +259,7 @@ public class JobService {
        params.put("yesterday", yesterday);
        if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
            quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
            Thread.sleep(60000L);
            Thread.sleep(sleepTime);
        }
    }
@ -283,7 +290,7 @@ public class JobService {
            params.put("yesterday", getYesterday(0 - i));
            if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
                Thread.sleep(60000L);
                Thread.sleep(sleepTime);
            }
        }
    }
@ -418,7 +425,7 @@ public class JobService {
        params.put("now", yesterday);
        params.put("yesterday", day);
        quartzHelper.startNow(HealthMessageJob.class, HealthMessageJob.jobKey + UUID.randomUUID().toString().replace("-", ""), params);
        Thread.sleep(60000L);
        Thread.sleep(sleepTime);
    }
    public void productHealthDataByDayToDay(String start, String end) throws Exception {

+ 11 - 11
patient-co/patient-co-statistics/src/main/resources/application.yml

@ -167,17 +167,17 @@ spring:
  datasource:
    primaryReadWrite:
      url: jdbc:mysql://10.95.22.7:3306/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
    primaryRead:
      url: jdbc:mysql://10.95.22.7:3306/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
    im: #im库:
      url: jdbc:mysql://10.95.22.7:3306/im?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: im
      password: im!)123
       url: jdbc:mysql://59.61.92.90:8079/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
       username: wlyy
       password: jkzlehr@123
     primaryRead:
       url: jdbc:mysql://59.61.92.90:8079/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
       username: wlyy
       password: jkzlehr@123
     im: #im库:
       url: jdbc:mysql://59.61.92.90:8079/im?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
       username: im
       password: im!)123
  redis:
    host: 10.95.22.142 # Redis server host.

+ 2 - 2
patient-co/patient-co-statistics/src/main/resources/quartz.properties

@ -9,11 +9,11 @@ org.quartz.scheduler.rmi.proxy: false
org.quartz.scheduler.wrapJobExecutionInUserTransaction: false
 
org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount: 20
org.quartz.threadPool.threadCount: 50
org.quartz.threadPool.threadPriority: 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread: true
 
org.quartz.jobStore.misfireThreshold: 60000
org.quartz.jobStore.misfireThreshold: 600000
 
#============================================================================
# Configure JobStore

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/EncodingFilter.java

@ -39,7 +39,7 @@ public class EncodingFilter implements Filter {
                newRequest.addParameter(key, URLDecoder.decode((value),"utf-8"));
            }
        }
        //logger.info(" reqURL:"+request.getRequestURI());
        logger.debug(" reqURL:"+request.getRequestURI());
        chain.doFilter(newRequest, response);
    }

+ 92 - 35
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java

@ -5,6 +5,7 @@ import com.yihu.wlyy.entity.address.Town;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionDispensaryCode;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
import com.yihu.wlyy.entity.statistics.PopulationBase;
import com.yihu.wlyy.repository.address.TownDao;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
@ -189,7 +190,7 @@ public class StatisticsESService {
    public long getIntervalIncrement(String startDate, String endDate, String area, int level, String index) throws Exception {
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(startDate,endDate,area,level,index,"1");
        return saveModel.getResult2().longValue();
        return saveModel.getResult2();
    }
//    /**
@ -270,7 +271,7 @@ public class StatisticsESService {
        }else{
            saveModel = elasticsearchUtil.findOneDateQuotaLevel0(startDate,endDate,area,level,index,"1");
        }
        return saveModel.getResult2().longValue();
        return saveModel.getResult2();
    }
    /**
@ -321,9 +322,9 @@ public class StatisticsESService {
                map.put("code",saveModel.getTeam());
                map.put("name",saveModel.getCityName());
            }
            map.put("amount",saveModel.getResult2().longValue());
            map.put("amount",Long.parseLong(saveModel.getResult2()+""));
            map.put("rate",df.format((saveModel.getResult2() * 1.0000) / populationBase.getNum() * 100));
            map.put("rateString",saveModel.getResult2().longValue()+"/"+populationBase.getNum());
            map.put("rateString",saveModel.getResult2()+"/"+populationBase.getNum());
            resultList.add(map);
        }
        Collections.sort(resultList, new Comparator<Map<String, Object>>() {
@ -359,7 +360,7 @@ public class StatisticsESService {
            Map<String, Object> map = new HashMap<>();
            map.put("code",saveModel.getSlaveKey1());
            map.put("name",saveModel.getSlaveKey1Name());
            map.put("amount",saveModel.getResult2().longValue());
            map.put("amount",Long.parseLong(saveModel.getResult2()+""));
            if (index.equals("7")) {
                // 分组指标总数算法
                String code = saveModel.getSlaveKey2();
@ -441,7 +442,7 @@ public class StatisticsESService {
            endDate = elasticsearchUtil.getQuotaTime();
        }
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate,area,level,index,timeLevel);
        return saveModel.getResult2().longValue();
        return saveModel.getResult2();
    }
    /**
@ -455,7 +456,7 @@ public class StatisticsESService {
    public long getWeiJiaoFei(String endDate, String area, int level) throws Exception{
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel1(endDate,area,level,"16","2","0");
        return saveModel.getResult2().longValue();
        return saveModel.getResult2();
    }
@ -477,12 +478,12 @@ public class StatisticsESService {
        }
        String timeKey = elasticsearchUtil.getQuotaTime();
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(timeKey,area,Integer.parseInt(level),renewIndex,"2");
        int renewNum = saveModel.getResult2().intValue();
        int renewNum = saveModel.getResult2();
        //根据年度获取去年的签约数 签约指标是1
        String date = year + "-06-30";
        String index = "1";
        SaveModel saveModel2 = elasticsearchUtil.findOneDateQuotaLevel0(date,area,Integer.parseInt(level),index,"2");
        int signNum = saveModel2.getResult2().intValue();
        int signNum = saveModel2.getResult2();
        JSONObject jo = new JSONObject();
        jo.put("yesterYearSign", signNum);//去年的签约量
        jo.put("thisYearRenew", renewNum);//今年的续签量
@ -501,7 +502,7 @@ public class StatisticsESService {
    public JSONObject getSignRate(String endDate, String area, int level, String year) throws Exception {
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate,area,level,"13","2");
        long signAmount = saveModel.getResult2().longValue();
        long signAmount = saveModel.getResult2();
        PopulationBase peopleNum = getPopulationBase(area, year);
        JSONObject json = new JSONObject();
        DecimalFormat df = new DecimalFormat("0.0000");
@ -532,7 +533,7 @@ public class StatisticsESService {
            endDate = elasticsearchUtil.getQuotaTime();
        }
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate,area,level,"13","2");
        long signAmount = saveModel.getResult2().longValue();
        long signAmount = saveModel.getResult2();
        PopulationBase peopleNum = getPopulationBase(area, year);
        DecimalFormat df = new DecimalFormat("0.0000");
        JSONObject json = new JSONObject();
@ -563,7 +564,7 @@ public class StatisticsESService {
        List<SaveModel> list = elasticsearchUtil.findDateQuotaLevel1(endDate,endDate,area,level,"17","2",lowCode,null,null);
        long total = 0;
        if(list.size()>0){
            total = list.get(0).getResult2().longValue();
            total = list.get(0).getResult2();
        }
        int num = 0;
        int taskNum = 0;
@ -675,7 +676,7 @@ public class StatisticsESService {
            endDate = elasticsearchUtil.getQuotaTime();
        }
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel1(endDate,area,level,"8","2","6");
        return saveModel.getResult2().longValue();
        return saveModel.getResult2();
    }
    /**
@ -727,7 +728,7 @@ public class StatisticsESService {
        for (SaveModel saveModel:list) {
            JSONObject range = new JSONObject();
            range.put("range", df.format(saveModel.getQuotaDate()));
            range.put("amount", saveModel.getResult2().longValue());
            range.put("amount", saveModel.getResult2());
            result.add(range);
        }
        json.put("data", new ArrayList<>(result));
@ -1026,7 +1027,7 @@ public class StatisticsESService {
        if (esModelList != null && esModelList.size() > 0) {
            for (SaveModel one : esModelList) {
                Map<String, Object> maps = new HashMap<String, Object>();
                maps.put("amount", one.getResult2().longValue());
                maps.put("amount", one.getResult1());
                if (low_level.equals("3")) {
                    maps.put("code", one.getTown());
                    maps.put("name", one.getTownName());
@ -1250,7 +1251,7 @@ public class StatisticsESService {
                    JSONObject jo = new JSONObject();
                    jo.put("name", one.getTownName());
                    jo.put("code", one.getTown());
                    jo.put("avgCount", getRangeDouuble(one.getResult1(), one.getResult2().intValue(), 2));
                    jo.put("avgCount", getRangeDouuble(one.getResult1(), one.getResult2(), 2));
                    ja.put(jo);
                });
            } else {
@ -1259,7 +1260,7 @@ public class StatisticsESService {
                    JSONObject jo = new JSONObject();
                    jo.put("name", one.getHospitalName());
                    jo.put("code", one.getHospital());
                    jo.put("avgCount", getRangeDouuble(one.getResult1(), one.getResult2().intValue(), 2));
                    jo.put("avgCount", getRangeDouuble(one.getResult1(), one.getResult2(), 2));
                    ja.put(jo);
                });
            }
@ -1269,7 +1270,7 @@ public class StatisticsESService {
                JSONObject jo = new JSONObject();
                jo.put("name", one.getHospitalName());
                jo.put("code", one.getHospital());
                jo.put("avgCount", getRangeDouuble(one.getResult1(), one.getResult2().intValue(), 2));
                jo.put("avgCount", getRangeDouuble(one.getResult1(), one.getResult2(), 2));
                ja.put(jo);
            });
        } else if (level == 2) {
@ -1279,7 +1280,7 @@ public class StatisticsESService {
                JSONObject jo = new JSONObject();
                jo.put("name", one.getTeam());
                jo.put("code", one.getTeamName());
                jo.put("avgCount", getRangeDouuble(one.getResult1(), one.getResult2().intValue(), 2));
                jo.put("avgCount", getRangeDouuble(one.getResult1(), one.getResult2(), 2));
                ja.put(jo);
            });
            translateTeamLeaderName(ja);
@ -1311,7 +1312,7 @@ public class StatisticsESService {
        if (esModelList != null && esModelList.size() > 0) {
            for (SaveModel one : esModelList) {
                Map<String, Object> maps = new HashMap<String, Object>();
                maps.put("amount", one.getResult2().intValue());
                maps.put("amount", one.getResult1());
                if (low_level.equals("3")) {
                    maps.put("code", one.getTown());
                    maps.put("name", one.getTownName());
@ -1405,7 +1406,7 @@ public class StatisticsESService {
        if (esModelList != null && esModelList.size() > 0) {
            for (SaveModel one : esModelList) {
                Map<String, Object> maps = new HashMap<String, Object>();
                maps.put("amount", one.getResult2().intValue());
                maps.put("amount", one.getResult1());
                if (low_level.equals("3")) {
                    maps.put("code", one.getTown());
                    maps.put("name", one.getTownName());
@ -1680,9 +1681,9 @@ public class StatisticsESService {
                continue;
            }
            //合并结果集
            Integer totalNm = totalRs.getResult2().intValue();
            Integer relyNm = relyRs.getResult2().intValue();
            Integer noRelyNm = onRelyRs.getResult2().intValue();
            Integer totalNm = totalRs.getResult2();
            Integer relyNm = relyRs.getResult2();
            Integer noRelyNm = onRelyRs.getResult2();
//            rs.put("name", relyRs.get(area+"Name"));
            if(level==4){
                rs.put("name", relyRs.getHospitalName());
@ -1875,9 +1876,9 @@ public class StatisticsESService {
        //合并结果集
        Map<String, Object> rs = new HashMap<>();
        Integer totalNm = total.getResult2().intValue();
        Integer relyNm = rely.getResult2().intValue();
        Integer noRelyNm = onRely.getResult2().intValue();
        Integer totalNm = total.getResult2();
        Integer relyNm = rely.getResult2();
        Integer noRelyNm = onRely.getResult2();
//        rs.put("name", rely.get(area + "Name"));
        if (SaveModel.cityLevel.equals(level+"")) {
            rs.put("code", rely.getCity());
@ -1970,8 +1971,8 @@ public class StatisticsESService {
                //转签量
                switchSaveModel=elasticsearchUtil.findOneDateQuotaLevel0(timeKey,area,level,renewIndex,"2");
            }
            int renewNum = renewSaveModel.getResult2().intValue();
            int switchNum = switchSaveModel.getResult2().intValue();
            int renewNum = renewSaveModel.getResult2();
            int switchNum = switchSaveModel.getResult2();
            //根据年度获取去年的签约数 签约指标是1
            if(StringUtils.isNoneBlank(lowCode)){
@ -1991,7 +1992,7 @@ public class StatisticsESService {
                signSaveModel=elasticsearchUtil.findOneDateQuotaLevel0(date,area,level,signIndex,"2");
            }
            //签约量
            int signNum = signSaveModel.getResult2().intValue();
            int signNum = signSaveModel.getResult2();
            jo.put("yesterYearSign", signNum);//去年的签约量
            jo.put("thisYearRenew", renewNum);//今年的续签量
            jo.put("thisYearSwithch", switchNum);//今年的转签量
@ -2056,7 +2057,7 @@ public class StatisticsESService {
    private int getLevel1NumForRedis(String index, String level, String code, String timeKey) throws Exception{
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(timeKey,code,Integer.parseInt(level),index,"2");
        return saveModel.getResult2().intValue();
        return saveModel.getResult2();
    }
    /**
     * 通用的方法 获取二级维度的数据列表
@ -2214,11 +2215,11 @@ public class StatisticsESService {
        if (renewSaveModels != null && renewSaveModels.size() > 0) {
            for (SaveModel saveModel : renewSaveModels) {
                if ("3".equals(low_level)) {
                    renewMap.put(saveModel.getTown(), saveModel.getResult2().intValue());
                    renewMap.put(saveModel.getTown(), saveModel.getResult2());
                } else if ("4".equals(low_level)) {
                    renewMap.put(saveModel.getHospital(), saveModel.getResult2().intValue());
                    renewMap.put(saveModel.getHospital(), saveModel.getResult2());
                } else if ("5".equals(low_level)) {
                    renewMap.put(saveModel.getTeam(), saveModel.getResult2().intValue());
                    renewMap.put(saveModel.getTeam(), saveModel.getResult2());
                } else {
                    continue;
                }
@ -2267,7 +2268,7 @@ public class StatisticsESService {
                    int signNum = 0;
                    int renewNum = renewMap.get(reMap.get("code").toString());
                    if (one != null) {
                        signNum = one.getResult2().intValue();
                        signNum = Integer.valueOf(one.getResult2());
                    }
                    reMap.put("rate", getRange(renewNum, signNum, 2));//续签率是 续签量/去年的签约数
                    reMap.put("signNum", signNum);
@ -2378,4 +2379,60 @@ public class StatisticsESService {
        Double avgCout = saveModel2.getResult1()/(Integer)map.get("num");
        return null;
    }
    public Map<String,Object> getPrescriptionCount(int level,String area,String disease) throws Exception{
        String index ="58";
        Map<String,Object> rs = new HashedMap();
        //总数
        List<SaveModel> totalList =  elasticsearchUtil.findListDateQuotaLevel1(null,area,level,index,"2",null,disease);
        //进行中
        List<SaveModel> processingList =  elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"1");
        //已完成
        List<SaveModel> finishedList =  elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"2");
        //已经取消
        List<SaveModel> canceledList =  elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"3");
        //审核不通过
        List<SaveModel> unPassList =  elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"4");
        //其他原因取消
        List<SaveModel> otherList =  elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"5");
        //总数
        if(totalList!=null && totalList.size()>0){
            rs.put("total",totalList.get(0).getResult2());
        }else{
            rs.put("total",0);
        }
        //进行中
        if(processingList!=null && processingList.size()>0){
            rs.put("processingCount",processingList.get(0).getResult2());
        }else {
            rs.put("processingCount", 0);
        }
        //已完成
        if(finishedList!=null && finishedList.size()>0){
            rs.put("finishCount",finishedList.get(0).getResult2());
        }else {
            rs.put("finishCount", 0);
        }
        //已取消
        if(canceledList!=null && canceledList.size()>0){
            rs.put("patientCancelCount",canceledList.get(0).getResult2());
        }else {
            rs.put("patientCancelCount", 0);
        }
        //审核不通过
        if(unPassList!=null && unPassList.size()>0){
            rs.put("noReviewedCount",unPassList.get(0).getResult2());
        }else {
            rs.put("noReviewedCount", 0);
        }
        //其他原因取消
        if(otherList!=null && otherList.size()>0){
            rs.put("payOuttimeCount",otherList.get(0).getResult2());
        }else {
            rs.put("payOuttimeCount", 0);
        }
        return rs;
    }
}

+ 3 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/system/SystemDictService.java

@ -47,9 +47,9 @@ public class SystemDictService {
                    re = redisTemplate.opsForValue().get("systemDict:" + dictName + ":" + code);
                    if(StringUtils.isEmpty(re)){
                        re = systemDictDao.findByDictNameAndCode(dictName,code);
                        if (StringUtils.isEmpty(re)) {
                            redisTemplate.opsForValue().set("systemDict:" + dictName + ":" + code, re);
                        }
//                        if (!StringUtils.isEmpty(re)) {
//                            redisTemplate.opsForValue().set("systemDict:" + dictName + ":" + code, re);
//                        }
                    }
                } else {
                    List<SystemDict> list = systemDictDao.findByDictName(dictName);

+ 17 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java

@ -9,6 +9,7 @@ import com.yihu.wlyy.util.ValueComparator;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.quota.vo.SaveModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
@ -1589,4 +1590,20 @@ public class EsStatisticsController extends BaseController {
            return error(-1, "查询失败");
        }
    }
    //=================================长处方分析===============================================
    @RequestMapping("/getPrescriptionCount")
    @ResponseBody
    @ApiOperation("订单统计-顶部总数获取")
    public String getPrescriptionCount(@ApiParam(name="level", value="级别") @RequestParam(required = true)String level,
                                       @ApiParam(name="area", value="级别对应编码") @RequestParam(required = true)String area,
                                       @ApiParam(name="disease", value="疾病类型") @RequestParam(required = false)String disease){
        try{
            return write(200, "查询成功", "data", statisticsESService.getPrescriptionCount(elasticsearchUtil.changeLevel(Integer.valueOf(level)),area,disease));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
}

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

@ -1670,6 +1670,7 @@ public class StatisticsController extends BaseController {
    @RequestMapping("/getPrescriptionCount")
    @ResponseBody
    @ApiOperation("订单统计-顶部总数获取")
    @Deprecated
    public String getPrescriptionCount(@ApiParam(name="level", value="级别") @RequestParam(required = true)String level,
                                       @ApiParam(name="area", value="级别对应编码") @RequestParam(required = true)String area,
                                       @ApiParam(name="disease", value="疾病类型") @RequestParam(required = false)String disease){