瀏覽代碼

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

trick9191 7 年之前
父節點
當前提交
e954aeaa58

+ 8 - 0
patient-co/patient-co-statistics-es/pom.xml

@ -441,6 +441,14 @@
            <artifactId>elasticsearch-sql</artifactId>
            <version>2.4.1.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>common-entity</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>common-entity</artifactId>
        </dependency>
    </dependencies>
    <build>

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

@ -2,10 +2,14 @@ package com.yihu.wlyy.statistics.util;
import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.expr.SQLQueryExpr;
import com.alibaba.druid.sql.parser.ParserException;
import com.alibaba.druid.sql.parser.SQLExprParser;
import com.alibaba.druid.sql.parser.Token;
import com.yihu.wlyy.statistics.etl.save.es.ElasticFactory;
import com.yihu.wlyy.statistics.vo.SaveModel;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.search.SearchHit;
import org.nlpcn.es4sql.domain.Select;
import org.nlpcn.es4sql.jdbc.ObjectResult;
import org.nlpcn.es4sql.jdbc.ObjectResultsExtractor;
@ -254,7 +258,7 @@ public class ElasticsearchUtil {
        StringBuffer groupBy = new StringBuffer();
        //根据 childAreaLevel   group by
        if (SaveModel.teamLevel.equals(childAreaLevel)) {
            sql.append("select team,teamName,result1,result2 from wlyy_quota_test where  '");
            sql.append("select team,teamName,result1,result2 from wlyy_quota_test where  ");
        } else if (SaveModel.OrgLevel.equals(childAreaLevel)) {
            sql.append("select hospital,hospitalName,sum(result1) result1,sum(result2) result2 from wlyy_quota_test where  ");
            groupBy.append(" group by hospital,hospitalName");
@ -305,7 +309,9 @@ public class ElasticsearchUtil {
            SQLExprParser parser = new ElasticSqlExprParser(sql);
            SQLExpr expr = parser.expr();
            SQLQueryExpr queryExpr = (SQLQueryExpr) expr;
//            if (parser.getLexer().token() != Token.EOF) {
//                throw new ParserException("illegal sql expr : " + sql);
//            }
            Select select = null;
            select = new SqlParser().parseSelect(queryExpr);
@ -319,11 +325,13 @@ public class ElasticsearchUtil {
                requestBuilder = action.explain();
            } else {
                //封装成自己的Select对象
                queryAction = new DefaultQueryAction(elasticFactory.getTransportClient(), select);
                Client client = elasticFactory.getTransportClient();
                queryAction = new DefaultQueryAction(client, select);
                requestBuilder = queryAction.explain();
            }
            SearchResponse response = (SearchResponse) requestBuilder.get();
            ObjectResult temp = new ObjectResultsExtractor(true, true, true).extractResults(response.getAggregations(), true);
//            ObjectResult temp = new ObjectResultsExtractor(true, true, true).extractResults(response.getAggregations(), true);
            ObjectResult temp = new ObjectResultsExtractor(true, true, true).extractResults(response.getHits(), true);
            List<String> heads = temp.getHeaders();
            temp.getLines().stream().forEach(one -> {
                try {
@ -331,6 +339,9 @@ public class ElasticsearchUtil {
                    for (int i = 0; i < one.size(); i++) {
                        String key = null;
                        Object value = one.get(i);
                        if(heads.get(i).startsWith("_")){
                            continue;
                        }
                        if (heads.get(i).contains("date_histogram")) {
                            key = "setQuotaDate";
                            value=DateUtil.strToDate(String.valueOf(value),"yyyy-MM-dd HH:mm:ss");

二進制
patient-co/patient-co-statistics/doc/业务文档/统计指标流程.docx


二進制
patient-co/patient-co-wlyy/doc/接口文档/对外接口文档/集美健康教育/集美健康教育对外接口文档.docx


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

@ -82,8 +82,8 @@ public class StatisticsController extends BaseController {
            if (index != null) {
                for (String idx : indexes) {
//                    result.put("index_" + idx, statisticsESService.getDateIncrementDetail(startDate, endDate, interval, area, level, idx, level2_type));
                    result.put("index_" + idx, statisticsService.getDateIncrementDetail(startDate, endDate, interval, area, Integer.parseInt(level), idx, level2_type));
                    result.put("index_" + idx, statisticsESService.getDateIncrementDetail(startDate, endDate, interval, area, level, idx, level2_type));
//                    result.put("index_" + idx, statisticsService.getDateIncrementDetail(startDate, endDate, interval, area, Integer.parseInt(level), idx, level2_type));
                }
            }

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/doctor/GcLableController.java

@ -125,7 +125,7 @@ public class GcLableController extends BaseController {
    @RequestMapping(value = "/unitLabels", method = RequestMethod.GET)
    @ApiOperation("根据地区查找卫计委下属单位标签")
    public ResultListModel<List<PatientLabelModel>> unitLabels(
            @ApiParam(name = "areas", value = "", required = true) @RequestParam(value = "areas", required = true) String areas
            @ApiParam(name = "areas", value = "地区code,多个地区用逗号分隔", required = true) @RequestParam(value = "areas", required = true) String areas
    ) {
        try {
            List<DictModel> dictModels = labelService.getUnitLabels(areas);