Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

wangjun 4 years ago
parent
commit
3a5ab0a992

+ 124 - 1
business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java

@ -12,8 +12,10 @@ import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.es.util.ElasticsearchUtil;
import com.yihu.jw.es.util.SaveModel;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.evaluate.score.service.BaseEvaluateScoreService;
import com.yihu.jw.util.date.DateUtil;
@ -59,6 +61,8 @@ public class StatisticsEsService {
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private BaseOrgDao orgDao;
    @Autowired
    private BaseEvaluateScoreService baseEvaluateScoreService;
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
@ -442,7 +446,7 @@ public class StatisticsEsService {
        //问诊量
        JSONObject object = new JSONObject();
        if (interval==1){
            JSONArray array = dateTotalStatistics3(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL,null);
            JSONArray array = dateTotalStatistics3(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL,level2_type);
            object.put("data",array);
            JSONArray array1 = dateTotalStatistics3(startDate,endDate,area,level,index,"3",SaveModel.timeLevel_ZL,null);
            object.put("specialistData",array1);
@ -546,6 +550,10 @@ public class StatisticsEsService {
                                        jsonObject.put("code",doctorHospitalDO.getDeptCode());
                                        jsonObject.put("name",doctorHospitalDO.getDeptName());
                                    }
                                }else if (level==4){
                                    BaseOrgDO orgDO = orgDao.findByCode(area);
                                    jsonObject.put("code",area);
                                    jsonObject.put("name",orgDO.getName());
                                }else {
                                    DictHospitalDeptDO dictHospitalDeptDO =  hospitalDeptDao.findByCode(area);
                                    jsonObject.put("code",area);
@ -594,6 +602,10 @@ public class StatisticsEsService {
                                    jsonObject.put("code",doctorHospitalDO.getDeptCode());
                                    jsonObject.put("name",doctorHospitalDO.getDeptName());
                                }
                            }else if (level==4){
                                BaseOrgDO orgDO = orgDao.findByCode(area);
                                jsonObject.put("code",area);
                                jsonObject.put("name",orgDO.getName());
                            }else {
                                DictHospitalDeptDO dictHospitalDeptDO =  hospitalDeptDao.findByCode(area);
                                jsonObject.put("code",area);
@ -640,6 +652,10 @@ public class StatisticsEsService {
                                    jsonObject.put("code",doctorHospitalDO.getDeptCode());
                                    jsonObject.put("name",doctorHospitalDO.getDeptName());
                                }
                            }else if (level==4){
                                BaseOrgDO orgDO = orgDao.findByCode(area);
                                jsonObject.put("code",area);
                                jsonObject.put("name",orgDO.getName());
                            }else {
                                DictHospitalDeptDO dictHospitalDeptDO =  hospitalDeptDao.findByCode(area);
                                jsonObject.put("code",area);
@ -685,6 +701,10 @@ public class StatisticsEsService {
                                    jsonObject.put("code",doctorHospitalDO.getDeptCode());
                                    jsonObject.put("name",doctorHospitalDO.getDeptName());
                                }
                            }else if (level==4){
                                BaseOrgDO orgDO = orgDao.findByCode(area);
                                jsonObject.put("code",area);
                                jsonObject.put("name",orgDO.getName());
                            }else {
                                DictHospitalDeptDO dictHospitalDeptDO =  hospitalDeptDao.findByCode(area);
                                jsonObject.put("code",area);
@ -710,6 +730,7 @@ public class StatisticsEsService {
                jsonObject.put("total",decimalFormat.format(total));//总和
                array.add(jsonObject);
            }
            object.put("excelData",array);
        }
        return object;
@ -4483,4 +4504,106 @@ public class StatisticsEsService {
        object.put("synergyTotal",synergyTotal.getResult1());
        return object;
    }
    public  JSONObject appPriceHead(String startDate, String endDate, String area,int level, String index) throws Exception {
        JSONObject object = new JSONObject();
        DecimalFormat decimalFormat = new DecimalFormat("0.00");
        //图文复诊
        SaveModel topicTotal = elasticsearchUtil.findOneDateQuotaLevel2(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"1","1");
        object.put("topicTotal",decimalFormat.format(topicTotal.getResult1()));
        //视频复诊
        SaveModel videoTotal = elasticsearchUtil.findOneDateQuotaLevel2(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"1","2");
        object.put("videoTotal",decimalFormat.format(videoTotal.getResult1()));
        //专家咨询
        SaveModel specialistTotal = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"3");
        object.put("specialistTotal",decimalFormat.format(specialistTotal.getResult1()));
        //专科协同
        SaveModel synergyTotal = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"2");
        object.put("synergyTotal",decimalFormat.format(synergyTotal.getResult1()));
        //总收入
        SaveModel totalPrice = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level, index, SaveModel.timeLevel_DDL);
        object.put("totalPrice",decimalFormat.format(totalPrice.getResult1()));
        return object;
    }
    public  JSONObject appPrescriptionHead(String startDate, String endDate, String area,int level, String index) throws Exception {
        JSONObject object = new JSONObject();
        //图文复诊
        SaveModel topicTotal = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"1");
        object.put("topicTotal",topicTotal.getResult1());
        //视频复诊
        SaveModel videoTotal = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"2");
        object.put("videoTotal",videoTotal.getResult1());
        //总计
        SaveModel specialistTotal = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL);
        object.put("total",specialistTotal.getResult1());
        return object;
    }
    public JSONObject appCenterCircular(String startDate, String endDate, String area, int level, String index) throws Exception {
        JSONObject object = new JSONObject();
        if (index.equalsIgnoreCase("3")||index.equalsIgnoreCase("3,21")||index.equalsIgnoreCase("21")){
            //协同门诊
            SaveModel saveModel1 = null;
            saveModel1 = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL, "2");
            //图文复诊
            SaveModel saveModel2 = null;
            //saveModel2 = elasticsearchUtil.findOneDateQuotaLevel2(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "1","1");
            saveModel2 = elasticsearchUtil.findOneDateQuotaLevel2(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL, "1","1");
            //视频复诊
            SaveModel saveModel3 = null;
/*
    saveModel3 = elasticsearchUtil.findOneDateQuotaLevel2(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "1","2");
*/
            saveModel3 = elasticsearchUtil.findOneDateQuotaLevel2(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL, "1","2");
            Double specialistCount =0.0;
            //专科咨询
            SaveModel saveModel4 = null;
            saveModel4 = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL, "3");
            specialistCount = saveModel4.getResult1();//专家咨询数量
            //总量
            SaveModel saveModel5 = null;
            saveModel5 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL);
            Double synergyCount = saveModel1.getResult1();//协同门诊数量
            Double topicCount = saveModel2.getResult1();//图文复诊数量
            Double videoCount = saveModel3.getResult1();//视频复诊数量
            Double total = saveModel5.getResult1();//总量
            DecimalFormat decimalFormat = new DecimalFormat("0.00");
            object.put("specialistCount",decimalFormat.format(specialistCount));//专家咨询数
            object.put("specialistRate",getRange(specialistCount.intValue(),total.intValue(),0));
            object.put("synergyCount",decimalFormat.format(synergyCount));//专家咨询数
            object.put("synergyRate",getRange(synergyCount.intValue(),total.intValue(),0));
            object.put("topicCount",decimalFormat.format(topicCount));//图文复诊数量
            object.put("topicRate",getRange(topicCount.intValue(),total.intValue(),0));
            object.put("videoCount",decimalFormat.format(videoCount));//视频复诊数量
            object.put("videoRate",getRange(videoCount.intValue(),total.intValue(),0));
            object.put("total",decimalFormat.format(total));
        }else if (index.equalsIgnoreCase("20")){
            //图文复诊
            SaveModel saveModel2 = null;
            saveModel2 = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL, "1");
            //视频复诊
            SaveModel saveModel3 = null;
            saveModel3 = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(startDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "2");
            //总数
            SaveModel saveModel1 = null;
            saveModel1 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level, index, SaveModel.timeLevel_DDL);
            Double topicCount = saveModel2.getResult1();//图文复诊数量
            Double videoCount = saveModel3.getResult1();//视频复诊数量
            Double total = saveModel1.getResult1();//总量
            object.put("topicCount",topicCount);//图文复诊数量
            object.put("topicRate",getRange(topicCount.intValue(),total.intValue(),0));
            object.put("videoCount",videoCount);//视频复诊数量
            object.put("videoRate",getRange(videoCount.intValue(),total.intValue(),0));
            object.put("total",total);
        }
        return object;
    }
}

+ 21 - 0
business/es-service/src/main/java/com/yihu/jw/es/util/ElasticsearchUtil.java

@ -1167,6 +1167,27 @@ public class ElasticsearchUtil {
        return (SaveModel) list.get(0);
    }
    /**
     * 根据2级维度的2级指标去聚合 没有一级维度
     * 查询某一天某一个2级维度的某个1级维度和2级维度下的指标  例如查询65岁以上的高血压患者
     *
     * @param startDate 时间 yyyy-mm-dd
     * @param endDate 时间 yyyy-mm-dd
     * @param area      code  厦门市 350200
     * @param level     等级 1 省 2 市 3 区县 4 机构 5团队
     * @param index     指标code
     * @param timelevel // 1日 2年
     * @param slaveKey2 二级维度的key
     * @return
     */
    public SaveModel findOneDateQuotaLevel2NoSlaveKey1(String startDate,String endDate, String area, int level, String index, String timelevel, String slaveKey2) throws Exception {
        if (org.springframework.util.StringUtils.isEmpty(slaveKey2)) {
            slaveKey2 = commonParams;
        }
        List list = findDateQuotaLevel2(startDate, endDate, area, level, index, timelevel, null, slaveKey2, null, null);
        return (SaveModel) list.get(0);
    }
    /**
     * 根据2级维度的1级指标去聚合 没有2级维度
     * 查询某一天某一个2级维度的某个1级维度和2级维度下的指标  例如查询65岁以上的高血压患者

+ 3 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java

@ -1327,6 +1327,9 @@ public class BaseHospitalRequestMapping {
        public static final String indexTotalApp = "/indexTotalApp";
        public static final String appIndexHead = "/appIndexHead";
        public static final String appIndexCenter ="/appIndexCenter";
        public static final String appCenterCircular ="/appCenterCircular";
        public static final String appPriceHead ="/appPriceHead";
        public static final String appPrescriptionHead="/appPrescriptionHead";
    }

+ 81 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/statistics/EsStatisticsEndpoint.java

@ -886,4 +886,85 @@ public class EsStatisticsEndpoint extends EnvelopRestEndpoint {
        return success(result);
    }
    /**
     * app收入统计-头部
     * @param startDate
     * @param endDate
     * @param area
     * @param level 2 市  3区  4医院 5科室 6医生
     * @param index
     * @return
     */
    @GetMapping(value = BaseHospitalRequestMapping.Statistics.appPriceHead)
    @ApiOperation(value = "app收入统计-头部")
    public ObjEnvelop appPriceHead(
            @RequestParam(required = true) String startDate,
            @RequestParam(required = true) String endDate,
            @RequestParam(required = true) String area,
            @RequestParam(required = true) int level,
            @RequestParam(required = true) String index) {
        JSONObject result = new JSONObject();
        try {
            result= statisticsEsService.appPriceHead(startDate, endDate, area, level, index);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return success(result);
    }
    /**
     * app收入统计-头部
     * @param startDate
     * @param endDate
     * @param area
     * @param level 2 市  3区  4医院 5科室 6医生
     * @param index
     * @return
     */
    @GetMapping(value = BaseHospitalRequestMapping.Statistics.appPrescriptionHead)
    @ApiOperation(value = "app处方统计-头部")
    public ObjEnvelop appPrescriptionHead(
            @RequestParam(required = true) String startDate,
            @RequestParam(required = true) String endDate,
            @RequestParam(required = true) String area,
            @RequestParam(required = true) int level,
            @RequestParam(required = true) String index) {
        JSONObject result = new JSONObject();
        try {
            result= statisticsEsService.appPrescriptionHead(startDate, endDate, area, level, index);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return success(result);
    }
    /**
     * app收入统计-头部
     * @param startDate
     * @param endDate
     * @param area
     * @param level 2 市  3区  4医院 5科室 6医生
     * @param index
     * @return
     */
    @GetMapping(value = BaseHospitalRequestMapping.Statistics.appCenterCircular)
    @ApiOperation(value = "app处方统计-头部")
    public ObjEnvelop appCenter(
            @RequestParam(required = true) String startDate,
            @RequestParam(required = true) String endDate,
            @RequestParam(required = true) String area,
            @RequestParam(required = true) int level,
            @RequestParam(required = true) String index) {
        JSONObject result = new JSONObject();
        try {
            result= statisticsEsService.appCenterCircular(startDate, endDate, area, level, index);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return success(result);
    }
}