DrugConsumptionDisplayVO.java 4.5 KB
package com.skua.modules.equipment.vo;

import com.skua.core.util.ConvertUtils;
import com.skua.tool.util.JSUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;

@Data
@ApiModel(value="药耗分析:数据展示", description="药耗分析:数据展示(药耗分析)")
public class DrugConsumptionDisplayVO {


    @ApiModelProperty(value = "药剂code")
    private String drugCode;
    @ApiModelProperty(value = "药剂名称")
    private String drugName;


    @ApiModelProperty(value = "出水量")
    private Double CSL;
    @ApiModelProperty(value = "同比去年出水量")
    private Double tbqnCsl;
    @ApiModelProperty(value = "环比上月出水量")
    private Double hbsyCsl;

    @ApiModelProperty(value = "总药耗")
    private Double zyh;

    @ApiModelProperty(value = "同比去年总药耗")
    private Double tbqnzyh;
    @ApiModelProperty(value = "同比去年总药耗")
    private Double tbqnzyhsl;
    @ApiModelProperty(value = "同比去年总药耗比例")
    private Double tbqnzyhbl;


    @ApiModelProperty(value = "环比上月总药耗")
    private Double hbsyzyh;
    @ApiModelProperty(value = "环比上月总药耗")
    private Double hbsyzyhsl;
    @ApiModelProperty(value = "环比上月总药耗比例")
    private Double hbsyzyhbl;


    @ApiModelProperty(value = "目标吨水药耗")
    private Double mbdsyh = 0.65d;

    @ApiModelProperty(value = "月吨水药耗")
    private Double dsyh;

    @ApiModelProperty(value = "同比去年吨水药耗")
    private Double tbqndsyh;
    @ApiModelProperty(value = "同比去年吨水药耗")
    private Double tbqndsyhsl;
    @ApiModelProperty(value = "同比去年吨水药耗比例")
    private Double tbqndsyhbl;


    @ApiModelProperty(value = "环比上月吨水药耗")
    private Double hbsydsyh;
    @ApiModelProperty(value = "环比上月吨水药耗")
    private Double hbsydsyhsl;
    @ApiModelProperty(value = "环比上月吨水药耗比例")
    private Double hbsydsyhbl;



    @ApiModelProperty(value = "历史最低吨水药耗")
    private String lszddsyh;
    @ApiModelProperty(value = "历史最低吨水药耗--月份")
    private String lszddsyhyf;


    @ApiModelProperty(value = "结论")
    private  String conclusion;
    public DrugConsumptionDisplayVO() {
    }

    public DrugConsumptionDisplayVO(String drugCode, String drugName) {
        this.drugCode = drugCode;
        this.drugName = drugName;
    }


    public DrugConsumptionDisplayVO(Double CSL, Double tbqnCsl, Double hbsyCsl, Double zyh, Double hbsyzyh, Double tbqnzyh) {
        this.CSL = CSL;
        this.tbqnCsl = tbqnCsl;
        this.hbsyCsl = hbsyCsl;
        this.zyh = ConvertUtils.getDouble(zyh,0d);
        this.hbsyzyh = hbsyzyh;
        this.tbqnzyh = tbqnzyh;
        // 计算吨水药耗: 药耗量[kg] / 处理水量[吨]
        this.dsyh = Double.parseDouble(JSUtils.divide(zyh, CSL));
        //同比总药耗
        this.tbqnzyhsl = Double.parseDouble(JSUtils.subtract( zyh, tbqnzyh));
        String expression = "100*( "+zyh+" - "+tbqnzyh+") / "+tbqnzyh;
        this.tbqnzyhbl = Double.parseDouble(JSUtils.executeExpression(expression,"0") );
        //同比吨水药耗
        this.tbqndsyh =  Double.parseDouble( JSUtils.divide(tbqnzyh ,tbqnCsl));
        this.tbqndsyhsl = this.getValue(this.dsyh - this.tbqndsyh);
        expression = "100*( "+this.dsyh+" - "+this.tbqndsyh+") / "+this.tbqnzyh;
        this.tbqndsyhbl = Double.parseDouble( JSUtils.executeExpression( expression, "0"));

        //环比 总药耗
        this.hbsyzyhsl = Double.parseDouble(JSUtils.subtract( this.zyh ,this.hbsyzyh));
        expression = "100*( "+this.zyh+" - "+this.hbsyzyh+") / "+this.hbsyzyh;
        this.hbsyzyhbl = Double.parseDouble(JSUtils.executeExpression(expression,"0") );
        //环比  吨水药耗
        this.hbsydsyh =  Double.parseDouble( JSUtils.divide(this.hbsyzyh ,this.hbsyCsl));
        this.hbsydsyhsl = this.getValue(this.dsyh - this.hbsydsyh);
        expression = "100*( "+this.dsyh+" - "+this.hbsydsyh+") / "+this.hbsydsyh;
        this.hbsydsyhbl = Double.parseDouble( JSUtils.executeExpression( expression, "0"));


    }
    private Double getValue(Double d) {
        try{
            BigDecimal two = new BigDecimal(d);
            double three = two.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue();
            return three;
        }catch(Exception e){
            //e.printStackTrace();
        }
        return null;
    }
}