DrugConsumptionAnalysisController.java 9.4 KB
package com.skua.modules.equipment.controller;

import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.modules.equipment.service.IDrugConsumptionAnalysisService;
import com.skua.modules.equipment.vo.CorrelationAnalysisVO;
import com.skua.modules.equipment.vo.DrugConsumptionDisplayVO;
import com.skua.modules.equipment.vo.DrugConsumptionTrendChartVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

@Slf4j
@Api(tags = "药耗分析")
@RestController
@RequestMapping("/drug/consumption/analysis")
public class DrugConsumptionAnalysisController {

    @Autowired
    private IDrugConsumptionAnalysisService drugConsumptionAnalysisService;

    @AutoLog(value = "数据展示")
    @ApiOperation(value = "数据展示", notes = "数据展示")
    @GetMapping("/data/display")
    public Result<DrugConsumptionDisplayVO> dataDisplay(String time, String departId) {
        Result<DrugConsumptionDisplayVO> result = new Result<>();
        DrugConsumptionDisplayVO data = drugConsumptionAnalysisService.dataDisplay(time,departId);
        result.setResult(data);
        return result;
    }
    // 2411112:总药耗趋势 --->吨水药费
    @AutoLog(value = "总药耗趋势")
    @ApiOperation(value = "总药耗趋势", notes = "总药耗趋势")
    @GetMapping("/data/drugConsumptionTrend")
    public Result<List<DrugConsumptionTrendChartVO>> drugConsumptionTrend(String time, String departId) {
        Result<List<DrugConsumptionTrendChartVO>> result = new Result<>();
        List<DrugConsumptionTrendChartVO> data = drugConsumptionAnalysisService.drugConsumptionTrend(time,departId);
        result.setResult(data);
        return result;
    }
    @AutoLog(value = "吨水药耗趋势")
    @ApiOperation(value = "吨水药耗趋势", notes = "吨水药耗趋势")
    @GetMapping("/data/consumptionTonOfWaterTrend")
    public Result<List<DrugConsumptionTrendChartVO>> consumptionTonOfWaterTrend(String time, String departId) {
        Result<List<DrugConsumptionTrendChartVO>> result = new Result<>();
        List<DrugConsumptionTrendChartVO>  data = drugConsumptionAnalysisService.consumptionTonOfWaterTrend(time,departId);
        result.setResult(data);
        return result;
    }
    @AutoLog(value = "药剂占比统计")
    @ApiOperation(value = "药剂占比统计 type 1.按明细 2.按类型", notes = "药剂占比统计 type 1.按明细 2.按类型")
    @GetMapping("/data/proportionStatistics")
    public Result<List<DrugConsumptionDisplayVO>> proportionStatistics(String time, String departId) {
        Result<List<DrugConsumptionDisplayVO>> result = new Result<>();
        List<DrugConsumptionDisplayVO> data = drugConsumptionAnalysisService.proportionStatistics(time ,departId);
        result.setResult(data);
        return result;
    }


    @AutoLog(value = "相关性分析")
    @ApiOperation(value = "相关性分析 统计类型下拉框", notes = "相关性分析 统计类型下拉框")
    @GetMapping("/correlation/analysisType")
    public Result<List<DrugConsumptionDisplayVO>> analysisType() {
        Result<List<DrugConsumptionDisplayVO>> result = new Result<>();
        List<DrugConsumptionDisplayVO> dataList = drugConsumptionAnalysisService.analysisType();
        result.setResult(dataList);
        return result;
    }
    @AutoLog(value = "相关性分析")
    @ApiOperation(value = "相关性分析 type 1.絮凝剂 2.碳源 3.除磷剂", notes = "相关性分析 type 1.絮凝剂 2.碳源 3.除磷剂")
    @GetMapping("/correlation/analysis")
    public Result<List<CorrelationAnalysisVO>> correlationAnalysis(String time, String  drugCode, String departId) {
        Result<List<CorrelationAnalysisVO>> result = new Result<>();
        if(StringUtils.isEmpty(drugCode)){
            List<DrugConsumptionDisplayVO> dataList = drugConsumptionAnalysisService.analysisType();
            if(dataList != null && !dataList.isEmpty() ){
                drugCode = dataList.get(0).getDrugCode();
            }
        }
        if(StringUtils.isEmpty(drugCode)){
            result.error500("参数不识别");
        }else{
            List<CorrelationAnalysisVO> list = drugConsumptionAnalysisService.correlationAnalysis(time,drugCode ,departId);
            result.setResult(list);
        }
        return result;
    }

  /*  @AutoLog(value = "数据展示")
    @ApiOperation(value = "数据展示", notes = "数据展示")
    @RequestMapping(value = "/data/display", method = RequestMethod.GET)
    public Result<Map<String, Object>> dataDisplay(String time,String departId) {
        Result<Map<String, Object>> result = new Result<>();
        Map<String, Object> data = drugConsumptionAnalysisService.dataDisplay(time,departId);
        result.setResult(data);
        result.setSuccess(true);
        return result;
    }




    @AutoLog(value = "总药耗趋势")
    @ApiOperation(value = "总药耗趋势", notes = "总药耗趋势")
    @RequestMapping(value = "/drug/consumption/trend", method = RequestMethod.GET)
    public Result<Map<String, Object>> drugConsumptionTrend(String time,String departId) {
        Result<Map<String, Object>> result = new Result<>();
        Map<String, Object> data = drugConsumptionAnalysisService.drugConsumptionTrend(time,departId);
        result.setResult(data);
        result.setSuccess(true);
        return result;
    }

    @AutoLog(value = "吨水药耗趋势")
    @ApiOperation(value = "吨水药耗趋势", notes = "吨水药耗趋势")
    @RequestMapping(value = "/consumption/ton/of/water/trend", method = RequestMethod.GET)
    public Result<Map<String, Object>> consumptionTonOfWaterTrend(String time ,String departId) {
        Result<Map<String, Object>> result = new Result<>();
        Map<String, Object> data = drugConsumptionAnalysisService.consumptionTonOfWaterTrend(time ,departId);
        result.setResult(data);
        result.setSuccess(true);
        return result;
    }

    @AutoLog(value = "药剂占比统计 type 1.按明细 2.按类型")
    @ApiOperation(value = "药剂占比统计 type 1.按明细 2.按类型", notes = "药剂占比统计 type 1.按明细 2.按类型")
    @RequestMapping(value = "/proportion/statistics", method = RequestMethod.GET)
    public Result<Map<String, Object>> proportionStatistics(String time,Integer type,String departId) {
        Result<Map<String, Object>> result = new Result<>();
        Map<String, Object> data = drugConsumptionAnalysisService.proportionStatistics(time,type,departId);
        result.setResult(data);
        result.setSuccess(true);
        return result;
    }

    @AutoLog(value = "药剂占比统计列表 type 1.按明细 2.按类型")
    @ApiOperation(value = "药剂占比统计列表 type 1.按明细 2.按类型", notes = "药剂占比统计列表 type 1.按明细 2.按类型")
    @RequestMapping(value = "/proportion/statistics/detail", method = RequestMethod.GET)
    public Result<Map<String, Object>> proportionStatisticsDetail(String time,Integer type,String departId) {
        Result<Map<String, Object>> result = new Result<>();
        Map<String, Object> data = drugConsumptionAnalysisService.proportionStatisticsDetail(time,type,departId);
        result.setResult(data);
        result.setSuccess(true);
        return result;
    }

    @AutoLog(value = "相关性分析 type 1.絮凝剂 2.碳源 3.除磷剂")
    @ApiOperation(value = "相关性分析 type 1.絮凝剂 2.碳源 3.除磷剂", notes = "相关性分析 type 1.絮凝剂 2.碳源 3.除磷剂")
    @RequestMapping(value = "/correlation/analysis", method = RequestMethod.GET)
    public Result<Map<String, Object>> correlationAnalysis(String time,Integer type,String departId) {
        Result<Map<String, Object>> result = new Result<>();
        Map<String, Object> data = drugConsumptionAnalysisService.correlationAnalysis(time,type ,departId);
        result.setResult(data);
        result.setSuccess(true);
        return result;
    }

    @AutoLog(value = "总药耗趋势详情")
    @ApiOperation(value = "总药耗趋势详情", notes = "总药耗趋势详情")
    @RequestMapping(value = "/drug/consumption/trend/detail", method = RequestMethod.GET)
    public Result<Map<String, Object>> drugConsumptionTrendDetail(DrugDto drugDto) {
        Result<Map<String, Object>> result = new Result<>();
        Map<String, Object> data = drugConsumptionAnalysisService.drugConsumptionTrendDetail(drugDto);
        result.setResult(data);
        result.setSuccess(true);
        return result;
    }

    @AutoLog(value = "相关性分析药剂明细 type 1.絮凝剂 2.碳源 3.除磷剂")
    @ApiOperation(value = "相关性分析药剂明细 type 1.絮凝剂 2.碳源 3.除磷剂", notes = "相关性分析药剂明细 type 1.絮凝剂 2.碳源 3.除磷剂")
    @RequestMapping(value = "/correlation/analysis/detail", method = RequestMethod.GET)
    public Result<Map<String, Object>> correlationAnalysisDetail(String time,Integer type,String departId) {
        Result<Map<String, Object>> result = new Result<>();
        Map<String, Object> data = drugConsumptionAnalysisService.correlationAnalysisDetail(time,type ,departId);
        result.setResult(data);
        result.setSuccess(true);
        return result;
    }*/
}