Przeglądaj źródła

[task-1766] 性能验证模块 开发 (二期) / 【后端】验证报告的接口开发

Li Yuan 1 rok temu
rodzic
commit
37c3130a6d
17 zmienionych plików z 719 dodań i 426 usunięć
  1. 0 33
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/CalcVO.java
  2. 0 180
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/EP15PrecisionVO.java
  3. 0 117
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/EP6ALinearRangeVO.java
  4. 18 28
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/InspectionItemVO.java
  5. 2 1
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/ItemCalcVO.java
  6. 2 1
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/SpecimensCalcVO.java
  7. 64 0
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/CalcVO.java
  8. 195 0
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/EP15PrecisionVO.java
  9. 8 21
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/EP15TruenessPatientVO.java
  10. 10 7
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/EP15TruenessReferneceVO.java
  11. 253 0
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/EP6ALinearRangeVO.java
  12. 57 18
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/PVItemBuilder.java
  13. 8 1
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/regression/PolynomialRegression.java
  14. 18 2
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/report/ReportDataDTO.java
  15. 10 8
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/report/ReportFactory.java
  16. 61 0
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/report/TableDTO.java
  17. 13 9
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/service/impl/PerformanceVerificationServiceImpl.java

+ 0 - 33
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/CalcVO.java

@@ -1,33 +0,0 @@
-package com.lc.ibps.components.verification.model;
-
-import org.apache.commons.math3.distribution.TDistribution;
-
-import java.math.BigDecimal;
-import java.text.DecimalFormat;
-
-public class CalcVO {
-
-    public static double format(double d,int scale){
-        return Double.parseDouble(String.format("%."+scale+"f", d));
-//        return new BigDecimal(d).setScale(scale,BigDecimal.ROUND_HALF_UP).doubleValue();
-    }
-
-
-    public static double getT(double degreesOfFreedom,double p){
-        TDistribution t = new TDistribution(degreesOfFreedom);
-        double value = t.inverseCumulativeProbability(1 - p/2);
-//        double value = t.inverseCumulativeProbability(1 - 0.01/2);
-        return format(value,2);
-    }
-
-
-    private  double[][] transposeMatrix(double[][] before) {
-        double[][] after = new double[before[0].length][before.length];
-        for (int i = 0; i < before.length; i++) {
-            for (int j = 0; j < before[i].length; j++) {
-                after[i][j] = before[j][i];
-            }
-        }
-        return after;
-    }
-}

+ 0 - 180
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/EP15PrecisionVO.java

@@ -1,180 +0,0 @@
-package com.lc.ibps.components.verification.model;
-
-import com.lc.ibps.components.verification.funcs.xAverage;
-import com.lc.ibps.components.verification.funcs.xFuncStdevVar;
-import com.lc.ibps.components.verification.funcs.xValue;
-
-import java.util.Arrays;
-
-public class EP15PrecisionVO extends CalcVO{
-
-    private SpecimensCalcVO[] data;
-
-/*
-
-    Number of replicates 	3
-    Number of days				5
-    A       B       C       D       E           F       G
-            Rep 1	Rep 2	Rep 3	Run mean	Run SD	Variance
-5   Day 1	3.3	    3.23	3.43	3.320	    0.101	0.010
-6   Day 2	3.21	3.45	3.42	3.360	    0.131	0.017
-7   Day 3	3.21	3.24	3.45	3.300	    0.131	0.017
-8   Day 4	3.5	    3.45	3.51	3.487	    0.032	0.001
-9   Day 5	3.33	3.45	3.32	3.367	    0.072	0.005
-
-11  Over all mean [ Average E5:E9]	        3.367       总均值
-12  Within run variance Vr [ average G5:G9]	0.010
-13 Within run SD [SQRT(B12)]	            0.101       批内标准差(Sr)
-14  Between run SD [SD(E5:E9)]	            0.073
-15  Between run variance Vb [B14*B14]	    0.005       批间方差
-16  Ratio Vr/Vb  [+B12/B15]	                1.928
-17  Total variance [((B2-1)/B2)*B12+B15]	0.012
-18  Laboratory SD [SQRT B17]	            0.110       室内标准差
-19  Laboratory CV[ (B18/B11)*100]	        3.259
-*/
-    private double mean;
-    private double sr;
-    private double vb;
-    private double s1;
-
-    private double cvr;
-    private double cv1;
-    private double n;
-    private int decimal;
-
-    private double allowableCvr;
-    private double allowableCv1;
-    private double allowableSr;
-    private double allowableS1;
-
-    public EP15PrecisionVO(SpecimensCalcVO[] data, int repeatNum, double allowableCvr, double allowableCv1, int decimal) {
-        this.data = data;
-        this.n = repeatNum;
-        this.allowableCvr = allowableCvr;
-        this.allowableCv1 = allowableCv1;
-        this.decimal = decimal;
-        calculate();
-    }
-
-    public double getSr() {
-        return sr;
-    }
-
-    public double getVb() {
-        return vb;
-    }
-
-    public double getMean() {
-        return mean;
-    }
-
-    public void setMean(double mean) {
-        this.mean = mean;
-    }
-
-    public void setSr(double sr) {
-        this.sr = sr;
-    }
-
-    public void setVb(double vb) {
-        this.vb = vb;
-    }
-
-    public double getS1() {
-        return s1;
-    }
-
-    public void setS1(double s1) {
-        this.s1 = s1;
-    }
-
-    public double getCvr() {
-        return cvr;
-    }
-
-    public void setCvr(double cvr) {
-        this.cvr = cvr;
-    }
-
-    public double getCv1() {
-        return cv1;
-    }
-
-    public void setCv1(double cv1) {
-        this.cv1 = cv1;
-    }
-
-
-    public double getAllowableCvr() {
-        return allowableCvr;
-    }
-
-    public void setAllowableCvr(double allowableCvr) {
-        this.allowableCvr = allowableCvr;
-    }
-
-    public double getAllowableCv1() {
-        return allowableCv1;
-    }
-
-    public void setAllowableCv1(double allowableCv1) {
-        this.allowableCv1 = allowableCv1;
-    }
-
-    public double getAllowableSr() {
-        return allowableSr;
-    }
-
-    public void setAllowableSr(double allowableSr) {
-        this.allowableSr = allowableSr;
-    }
-
-    public double getAllowableS1() {
-        return allowableS1;
-    }
-
-    public void setAllowableS1(double allowableS1) {
-        this.allowableS1 = allowableS1;
-    }
-
-    public void calculate() {
-        //批内标准差
-        xValue[] vrs = Arrays.stream(data).map(SpecimensCalcVO::getVariance).toArray(xValue[]::new);
-        double withinVr = xAverage.eval(vrs).getDoub();
-        sr = Math.sqrt(withinVr);
-        //总均值
-        xValue[] means = Arrays.stream(data).map(SpecimensCalcVO::getMean).toArray(xValue[]::new);
-        mean = xAverage.eval(means).getDoub();
-        //批间方差
-        xValue x = xFuncStdevVar.evalArgs(means, xFuncStdevVar.iSTDEV);
-        vb = Math.pow(x.getDoub(), 2);
-
-        //室内标准差
-        double v = (n - 1) / n;
-        s1 = Math.sqrt(v * withinVr + vb);
-
-        cvr = (sr/mean) * 100;
-        cv1 = (s1/mean) * 100;
-
-        //实验室允许不精密度
-        allowableSr = allowableCvr * mean/100;
-        allowableS1 = allowableCv1 * mean/100;
-
-        //format
-        allowableSr = format(allowableSr,decimal);
-        allowableS1 = format(allowableS1,decimal);
-        cv1 = format(cv1,decimal);
-        cvr = format(cvr,decimal);
-        vb = format(vb,decimal);
-        mean = format(mean,decimal);
-        sr = format(sr,decimal);
-        s1 = format(s1,decimal);
-    }
-    public double[][] getData(){
-        double[][] d = new double[data.length][];
-        for (int i = 0; i<data.length;i++){
-            d[i] = data[i].getStoreData();
-        }
-        return d;
-    }
-}

+ 0 - 117
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/EP6ALinearRangeVO.java

@@ -1,117 +0,0 @@
-package com.lc.ibps.components.verification.model;
-
-import com.lc.ibps.components.verification.regression.PolynomialRegression;
-import org.apache.commons.math3.stat.StatUtils;
-import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
-
-import java.util.Arrays;
-
-public class EP6ALinearRangeVO extends CalcVO{
-
-    private double[][] data;
-
-    private double[] means;
-    private double[][] diffs;
-    private double[][] dli;
-    private double maxDli;
-    private double mean;
-    private double[] standardDeviations;
-
-    private double high;
-    private double low;
-    private double[] targetValues;
-
-    private int specimensNum;
-    private int repeatNum;
-    private PolynomialRegression pr1 = new PolynomialRegression();
-    private PolynomialRegression pr2 = new PolynomialRegression();
-    private PolynomialRegression pr3 = new PolynomialRegression();
-    private PolynomialRegression prBest;
-
-
-    private double sdr;
-    private double cvr;
-
-    public EP6ALinearRangeVO(double[][] data, double high, double low){
-        this.data = data;
-        this.high = high;
-        this.low = low;
-        this.specimensNum = data.length;
-        this.repeatNum = data[0].length;
-        this.means = new double[this.specimensNum];
-        this.diffs = new double[5][this.specimensNum];
-        this.dli = new double[5][this.specimensNum];
-        this.standardDeviations = new double[this.specimensNum];
-        this.targetValues = new double[this.specimensNum];
-        calculate();
-    }
-
-    public void calculate() {
-        calcTarget();
-        for (int i = 0; i < specimensNum; i++) {
-            DescriptiveStatistics stat = new DescriptiveStatistics(data[i]);
-            means[i] = format(stat.getMean(),2);
-            standardDeviations[i] = stat.getStandardDeviation();
-            if(repeatNum == 2){
-                diffs[1][i] = data[i][0] - data[i][1];  //diff
-                diffs[2][i] = Math.pow(diffs[1][i],2) /2; //diff * diff / 2
-                diffs[3][i] = diffs[1][i] / means[i] ;  //%diff
-                diffs[4][i] = Math.pow(diffs[3][i],2) /2; //%diff * %diff /2
-            }
-
-        }
-        diffs[0] = means;
-        mean = StatUtils.mean(means);
-        sdr = Math.sqrt(StatUtils.mean(diffs[2]))*100;
-        cvr = Math.sqrt(StatUtils.mean(diffs[4]))*100;
-        //TODO: check cvr
-
-        pr1.addData(targetValues, means, repeatNum,1);
-        pr2.addData(targetValues, means, repeatNum,2);
-        pr3.addData(targetValues, means, repeatNum,3);
-
-        if(pr2.isNonlinear() && pr3.isNonlinear()){
-            if(pr2.getStdError() > pr3.getStdError()) prBest = pr3;
-            else prBest = pr2;
-        } else if(pr2.isNonlinear()) {
-            prBest = pr2;
-        }
-        else if (pr3.isNonlinear()) {
-            prBest = pr3;
-        }
-        //calc dli
-        if(prBest != null) {
-            dli[0] = targetValues;
-            for (int i = 0; i < specimensNum; i++) {
-                dli[1][i] = prBest.calcFunc(targetValues[i]);
-                dli[2][i] = pr1.calcFunc(targetValues[i]);
-                dli[3][i] = dli[1][i] - dli[2][i];
-                dli[4][i] = 100 * dli[3][i] / dli[0][i];
-            }
-
-            maxDli = Arrays.stream(dli[4]).max().getAsDouble();
-        }
-//
-//        double s1 = pr1.getStdError() / mean;
-//        double s2 = pr2.getStdError() /mean;
-//        double s3 = pr3.getStdError() /mean;
-//        pr1.getParameters();
-    }
-
-    private void calcTarget(){
-        targetValues[0] = low;
-        targetValues[specimensNum -1] = high;
-        int range = specimensNum - 1;
-        for (int i = 1; i < range; i++) {
-            targetValues[i] = format(low * (range -i)/range + high * i/range,2);
-        }
-    }
-
-    public static void main(String[] args){
-        double[][] data = {{-0.01,-0.01},{5.00,4.99},{10.18,10.05},{14.65,14.65},{19.57,19.65},{24.02,24.09}};
-        EP6ALinearRangeVO ep6 = new EP6ALinearRangeVO(data,24.56,0);
-        System.out.println(ep6);
-//        ep6.getT()
-
-    }
-}

+ 18 - 28
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/InspectionItemVO.java

@@ -10,6 +10,7 @@ import com.lc.ibps.components.poi.excel.entity.vo.BaseEntityTypeConstants;
 import com.lc.ibps.components.verification.excel.PVExcelExportStyler;
 import com.lc.ibps.components.verification.excel.PVExcelUtil;
 import com.lc.ibps.components.verification.funcs.xValue;
+import com.lc.ibps.components.verification.model2.*;
 import com.lc.ibps.components.verification.report.ReportDataDTO;
 import org.apache.poi.ss.usermodel.Workbook;
 
@@ -38,6 +39,8 @@ public class InspectionItemVO {
     @JSONField(serialize = false)
     private Map<String, CalcVO> record2 = new HashMap<>();
 
+    private CalcVO calcVO;
+
 
     @JSONField(serialize = false)
     private ItemCalcVO itemCalcVO;
@@ -194,45 +197,24 @@ public class InspectionItemVO {
             dataPass = true;
         }
 
+        double[][] dataArrays = new double[config.getSpecimensNum()][config.getRepeatNum() * config.getDays()];
+        int ii = 0;
         for (String sName : config.getSpecimensName()) {
             final xValue[] total = new xValue[config.getRepeatNum() * config.getDays()];
+            final double[] total2 = new double[config.getRepeatNum() * config.getDays()];
             for (int j = 0; j < list.size(); j++) {
                 final xValue[] xValues = list.get(j).getConvertedData().get(sName);
                 for (int k = 0; k < xValues.length; k++) {
                     total[j * xValues.length + k] = xValues[k];
+                    total2[j * xValues.length + k] = xValues[k].getDoub();
                 }
             }
             record.put(sName, new SpecimensCalcVO(total, config.isConvert()));
+            dataArrays[ii] = total2;
+            ii++;
         }
-//        buildItemCalcVO();
-
-
-        if(config.getName().toLowerCase().contains("精密度")){
-            for (String sName : config.getSpecimensName()) {
-                SpecimensCalcVO[] data = new SpecimensCalcVO[config.getDays()];
-                for (int j = 0; j < list.size(); j++) {
-                    final xValue[] xValues = list.get(j).getConvertedData().get(sName);
-                    data[j] = new SpecimensCalcVO(xValues, config.isConvert());
-                }
-                record2.put(sName, new EP15PrecisionVO(data,config.getRepeatNum(),config.getBatchCVSValue(),config.getDailyCVSValue(),config.getDecimal()));
-            }
-        }else if(config.getName().equals("定值参考物质验证")){
-            for (String sName : config.getSpecimensName()) {
-                final xValue[] total = new xValue[config.getRepeatNum() * config.getDays()];
-                for (int j = 0; j < list.size(); j++) {
-                    final xValue[] xValues = list.get(j).getConvertedData().get(sName);
-                    for (int k = 0; k < xValues.length; k++) {
-                        total[j * xValues.length + k] = xValues[k];
-                    }
-                }
-                record2.put(sName, new EP15TruenessReferneceVO(total, config.getTargetValue()[0],config.getClaimValue(),0));
-            }
-        }else if(config.getName().equals("EP15-A方法学比对")){
-
-            record2.put("EP15-A方法学比对",
-                    new EP15TruenessPatientVO(record.get(config.getSpecimensName()[0]),record.get(config.getSpecimensName()[1]), config.getClaimValue(),0));
+        buildItemCalcVO();
 
-        }
 
 
 
@@ -310,4 +292,12 @@ public class InspectionItemVO {
     public void setRecord2(Map<String, CalcVO> record2) {
         this.record2 = record2;
     }
+
+    public CalcVO getCalcVO() {
+        return calcVO;
+    }
+
+    public void setCalcVO(CalcVO calcVO) {
+        this.calcVO = calcVO;
+    }
 }

+ 2 - 1
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/ItemCalcVO.java

@@ -2,9 +2,10 @@ package com.lc.ibps.components.verification.model;
 
 import com.lc.ibps.components.verification.funcs.xFuncArray2Args;
 import com.lc.ibps.components.verification.funcs.xValue;
+import com.lc.ibps.components.verification.model2.CalcVO;
 
 //多个标本之间的对比计算
-public class ItemCalcVO extends CalcVO{
+public class ItemCalcVO {
     //多个样本均值 y
     private xValue[] specimensValue;
     //样本的标示值/理论值 x

+ 2 - 1
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/SpecimensCalcVO.java

@@ -4,11 +4,12 @@ import com.lc.ibps.components.verification.funcs.xAverage;
 import com.lc.ibps.components.verification.funcs.xFuncStdevVar;
 import com.lc.ibps.components.verification.funcs.xLog10;
 import com.lc.ibps.components.verification.funcs.xValue;
+import com.lc.ibps.components.verification.model2.CalcVO;
 
 /**
  * 单列数据计算
  */
-public class SpecimensCalcVO extends CalcVO{
+public class SpecimensCalcVO {
 
     private xValue[] data;
 

+ 64 - 0
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/CalcVO.java

@@ -0,0 +1,64 @@
+package com.lc.ibps.components.verification.model2;
+
+import com.lc.ibps.components.verification.funcs.xValue;
+import com.lc.ibps.components.verification.report.TableDTO;
+import org.apache.commons.math3.distribution.TDistribution;
+
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.util.Map;
+
+public class CalcVO {
+
+    private int scale;
+    public String format(double d){
+        return String.format("%."+scale+"f", format(d,scale));
+    }
+    public static double format(double d,int s){
+        return Double.parseDouble(String.format("%."+s+"f", d));
+//        return new BigDecimal(d).setScale(scale,BigDecimal.ROUND_HALF_UP).doubleValue();
+    }
+
+
+    public static double getT(double degreesOfFreedom,double p){
+        TDistribution t = new TDistribution(degreesOfFreedom);
+        double value = t.inverseCumulativeProbability(1 - p/2);
+//        double value = t.inverseCumulativeProbability(1 - 0.01/2);
+        return format(value,2);
+    }
+
+
+    public  double[][] transposeMatrix(double[][] before) {
+        double[][] after = new double[before[0].length][before.length];
+        for (int i = 0; i < after.length; i++) {
+            for (int j = 0; j < after[i].length; j++) {
+                after[i][j] = before[j][i];
+            }
+        }
+        return after;
+    }
+
+    public TableDTO buildDataTableDTO(){
+        return null;
+    }
+    public Map<String, TableDTO> buildReportTableDTO(){
+
+        return null;
+    }
+
+    public int getScale() {
+        return scale;
+    }
+
+    public void setScale(int scale) {
+        this.scale = scale;
+    }
+
+    public static double[] transposeXValue(xValue[] xValues){
+        double[] doubles = new double[xValues.length];
+        for (int i = 0; i < doubles.length; i++) {
+            doubles[i] = xValues[i].getDoub();
+        }
+        return doubles;
+    }
+}

+ 195 - 0
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/EP15PrecisionVO.java

@@ -0,0 +1,195 @@
+package com.lc.ibps.components.verification.model2;
+
+import com.lc.ibps.components.verification.funcs.xAverage;
+import com.lc.ibps.components.verification.funcs.xFuncStdevVar;
+import com.lc.ibps.components.verification.funcs.xValue;
+import com.lc.ibps.components.verification.model.SpecimensCalcVO;
+import com.lc.ibps.components.verification.model2.CalcVO;
+import org.apache.commons.math3.stat.StatUtils;
+import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
+
+import java.util.Arrays;
+
+public class EP15PrecisionVO extends CalcVO {
+
+    private double[][] data;
+
+    /*
+
+        Number of replicates 	3
+        Number of days				5
+        A       B       C       D       E           F       G
+                Rep 1	Rep 2	Rep 3	Run mean	Run SD	Variance
+    5   Day 1	3.3	    3.23	3.43	3.320	    0.101	0.010
+    6   Day 2	3.21	3.45	3.42	3.360	    0.131	0.017
+    7   Day 3	3.21	3.24	3.45	3.300	    0.131	0.017
+    8   Day 4	3.5	    3.45	3.51	3.487	    0.032	0.001
+    9   Day 5	3.33	3.45	3.32	3.367	    0.072	0.005
+
+    11  Over all mean [ Average E5:E9]	        3.367       总均值
+    12  Within run variance Vr [ average G5:G9]	0.010
+    13 Within run SD [SQRT(B12)]	            0.101       批内标准差(Sr)
+    14  Between run SD [SD(E5:E9)]	            0.073
+    15  Between run variance Vb [B14*B14]	    0.005       批间方差
+    16  Ratio Vr/Vb  [+B12/B15]	                1.928
+    17  Total variance [((B2-1)/B2)*B12+B15]	0.012
+    18  Laboratory SD [SQRT B17]	            0.110       室内标准差
+    19  Laboratory CV[ (B18/B11)*100]	        3.259
+    */
+    private double mean;
+    private double sr;
+    private double vb;
+    private double s1;
+
+    private double cvr;
+    private double cv1;
+    private double n;
+    private int decimal;
+
+    private double allowableCvr;
+    private double allowableCv1;
+    private double allowableSr;
+    private double allowableS1;
+
+    public EP15PrecisionVO(double[][] data, double allowableCvr, double allowableCv1, int decimal) {
+        this.data = data;
+        this.n = data[0].length;
+        this.allowableCvr = allowableCvr;
+        this.allowableCv1 = allowableCv1;
+        this.decimal = decimal;
+        calculate();
+    }
+
+    public double getSr() {
+        return sr;
+    }
+
+    public double getVb() {
+        return vb;
+    }
+
+    public double getMean() {
+        return mean;
+    }
+
+    public void setMean(double mean) {
+        this.mean = mean;
+    }
+
+    public void setSr(double sr) {
+        this.sr = sr;
+    }
+
+    public void setVb(double vb) {
+        this.vb = vb;
+    }
+
+    public double getS1() {
+        return s1;
+    }
+
+    public void setS1(double s1) {
+        this.s1 = s1;
+    }
+
+    public double getCvr() {
+        return cvr;
+    }
+
+    public void setCvr(double cvr) {
+        this.cvr = cvr;
+    }
+
+    public double getCv1() {
+        return cv1;
+    }
+
+    public void setCv1(double cv1) {
+        this.cv1 = cv1;
+    }
+
+
+    public double getAllowableCvr() {
+        return allowableCvr;
+    }
+
+    public void setAllowableCvr(double allowableCvr) {
+        this.allowableCvr = allowableCvr;
+    }
+
+    public double getAllowableCv1() {
+        return allowableCv1;
+    }
+
+    public void setAllowableCv1(double allowableCv1) {
+        this.allowableCv1 = allowableCv1;
+    }
+
+    public double getAllowableSr() {
+        return allowableSr;
+    }
+
+    public void setAllowableSr(double allowableSr) {
+        this.allowableSr = allowableSr;
+    }
+
+    public double getAllowableS1() {
+        return allowableS1;
+    }
+
+    public void setAllowableS1(double allowableS1) {
+        this.allowableS1 = allowableS1;
+    }
+
+    public void calculate() {
+        //批内标准差
+//        xValue[] vrs = Arrays.stream(data).map(SpecimensCalcVO::getVariance).toArray(xValue[]::new);
+//        double withinVr = xAverage.eval(vrs).getDoub();
+//        sr = Math.sqrt(withinVr);
+        double[] vrs = new double[data.length];
+        for (int i = 0; i < data.length; i++) {
+            vrs[i] = StatUtils.variance(data[i]);
+        }
+        double withinVr = StatUtils.mean(vrs);
+        sr = Math.sqrt(withinVr);
+        //总均值
+//        xValue[] means = Arrays.stream(data).map(SpecimensCalcVO::getMean).toArray(xValue[]::new);
+        double[] means = new double[data.length];
+        for (int i = 0; i < data.length; i++) {
+            means[i] = StatUtils.mean(data[i]);
+        }
+        DescriptiveStatistics stat = new DescriptiveStatistics(means);
+        mean = stat.getMean();
+        //批间方差
+        double x = stat.getStandardDeviation();
+        vb = Math.pow(x, 2);
+
+        //室内标准差
+        double v = (n - 1) / n;
+        s1 = Math.sqrt(v * withinVr + vb);
+
+        cvr = (sr / mean) * 100;
+        cv1 = (s1 / mean) * 100;
+
+        //实验室允许不精密度
+        allowableSr = allowableCvr * mean / 100;
+        allowableS1 = allowableCv1 * mean / 100;
+
+        //format
+        allowableSr = format(allowableSr, decimal);
+        allowableS1 = format(allowableS1, decimal);
+        cv1 = format(cv1, decimal);
+        cvr = format(cvr, decimal);
+        vb = format(vb, decimal);
+        mean = format(mean, decimal);
+        sr = format(sr, decimal);
+        s1 = format(s1, decimal);
+    }
+
+    public static void main(String[] args) {
+        double[][] data = {{3.3, 3.23, 3.43}, {3.21, 3.45, 3.42}, {3.21, 3.24, 3.45}, {3.5, 3.45, 3.51}, {3.33, 3.45, 3.32}};
+        EP15PrecisionVO ep15PrecisionVO = new EP15PrecisionVO(data, 0, 0, 3);
+
+        System.out.println(ep15PrecisionVO);
+    }
+}

+ 8 - 21
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/EP15TruenessPatientVO.java → ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/EP15TruenessPatientVO.java

@@ -1,14 +1,11 @@
-package com.lc.ibps.components.verification.model;
+package com.lc.ibps.components.verification.model2;
 
 import com.lc.ibps.components.verification.funcs.xAverage;
-import com.lc.ibps.components.verification.funcs.xFuncArray2Args;
 import com.lc.ibps.components.verification.funcs.xFuncStdevVar;
 import com.lc.ibps.components.verification.funcs.xValue;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.math3.distribution.ChiSquaredDistribution;
-import org.apache.commons.math3.distribution.TDistribution;
+import org.apache.commons.math3.stat.StatUtils;
 
-public class EP15TruenessPatientVO extends CalcVO{
+public class EP15TruenessPatientVO extends CalcVO {
     //多个样本均值 y
     private double[] y;
     //样本的标示值/理论值 x
@@ -20,12 +17,6 @@ public class EP15TruenessPatientVO extends CalcVO{
     private double meanY;
     private double bias;
     private double sdDiff;
-//    //截距(a)
-//    private double a;
-//    //斜率(b)
-//    private double b;
-//    //相关系数r
-//    private double r;
     private int n;
     private double t;//t critical
 
@@ -35,11 +26,11 @@ public class EP15TruenessPatientVO extends CalcVO{
     private double lvl;//Lower verification limit
     private double sdClaim;//SD assigned value
 
-    public EP15TruenessPatientVO(SpecimensCalcVO y, SpecimensCalcVO x,double sdClaim,double t) {
-        meanX = x.getMean().getDoub();
-        meanY = y.getMean().getDoub();
-        this.y = y.getStoreData();
-        this.x = x.getStoreData();
+    public EP15TruenessPatientVO(double[][] data, double sdClaim, double t) {
+        this.y = data[0];
+        this.x = data[1];
+        meanX = StatUtils.mean(x);
+        meanY = StatUtils.mean(y);
         if(t == 0){
             this.t = getT(this.y.length-1,0.01);
         }else {
@@ -69,10 +60,6 @@ public class EP15TruenessPatientVO extends CalcVO{
         uvl = sdClaim + t * sdDiff / sqrtN;
         lvl = sdClaim - t * sdDiff / sqrtN;
 
-//        b = xFuncArray2Args.evalArgs(y, x, xFuncArray2Args.iSLOPE).getDoub();
-//        a = xFuncArray2Args.evalArgs(y, x, xFuncArray2Args.iINTERCEPT).getDoub();
-//        r = xFuncArray2Args.evalArgs(y, x, xFuncArray2Args.iCORREL).getDoub();
-
     }
 
     public double getMeanX() {

+ 10 - 7
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/EP15TruenessReferneceVO.java → ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/EP15TruenessReferneceVO.java

@@ -1,12 +1,15 @@
-package com.lc.ibps.components.verification.model;
+package com.lc.ibps.components.verification.model2;
 
 import com.lc.ibps.components.verification.funcs.xAverage;
 import com.lc.ibps.components.verification.funcs.xFuncStdevVar;
 import com.lc.ibps.components.verification.funcs.xValue;
+import com.lc.ibps.components.verification.model2.CalcVO;
+import org.apache.commons.math3.stat.StatUtils;
+import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
 
-public class EP15TruenessReferneceVO extends CalcVO{
+public class EP15TruenessReferneceVO extends CalcVO {
 
-    private xValue[] data;
+    private double[] data;
 
     private double target;
     private double mean;
@@ -20,7 +23,7 @@ public class EP15TruenessReferneceVO extends CalcVO{
     private double t;//t critical
     private double sdClaim;//SD assigned value
 
-    public EP15TruenessReferneceVO(xValue[] data, double target, double sdClaim, double t){
+    public EP15TruenessReferneceVO(double[] data, double target, double sdClaim, double t){
         this.data = data;
         this.target = target;
         this.sdClaim = sdClaim;
@@ -61,9 +64,9 @@ public class EP15TruenessReferneceVO extends CalcVO{
     Lower verification limit		                                45.87655097
 */
     public void calculate() {
-
-        mean = xAverage.eval(data).getDoub();
-        sd = xFuncStdevVar.evalArgs(data, xFuncStdevVar.iSTDEV).getDoub();
+        DescriptiveStatistics stat = new DescriptiveStatistics(data);
+        mean = stat.getMean();
+        sd = stat.getStandardDeviation();
         se = sd / Math.sqrt(data.length);
         ucl = mean + t * se;
         lcl = mean - t * se;

+ 253 - 0
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/EP6ALinearRangeVO.java

@@ -0,0 +1,253 @@
+package com.lc.ibps.components.verification.model2;
+
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.lc.ibps.components.verification.regression.PolynomialRegression;
+import com.lc.ibps.components.verification.report.ReportDataDTO;
+import com.lc.ibps.components.verification.report.TableDTO;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.math3.stat.StatUtils;
+import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
+
+import java.util.*;
+
+public class EP6ALinearRangeVO extends CalcVO {
+
+    private double[][] data;
+
+    private double[] means;
+    private double[][] diffs;
+    private double[][] dli;
+    private double maxDli;
+    private double mean;
+    private double[] standardDeviations;
+
+    private double[] targetValues;
+    private boolean isTarget = true;
+
+    private int specimensNum;
+    private int repeatNum;
+    private PolynomialRegression pr1 = new PolynomialRegression();
+    private PolynomialRegression pr2 = new PolynomialRegression();
+    private PolynomialRegression pr3 = new PolynomialRegression();
+    private PolynomialRegression prBest;
+
+    private double claimValue;
+
+
+    private double sdr;
+    private double cvr;
+
+    public EP6ALinearRangeVO(double[][] data, double[] targetValues, double claimValue,int scale){
+        this.data = data;
+        this.setScale(scale);
+        this.specimensNum = data.length;
+        this.repeatNum = data[0].length;
+        this.means = new double[this.specimensNum];
+        this.diffs = new double[5][this.specimensNum];
+        this.dli = new double[5][this.specimensNum];
+        this.standardDeviations = new double[this.specimensNum];
+        this.targetValues = new double[this.specimensNum];
+        this.claimValue = claimValue;
+        calcTarget(targetValues);
+        calculate();
+    }
+
+    public void calculate() {
+
+        for (int i = 0; i < specimensNum; i++) {
+            DescriptiveStatistics stat = new DescriptiveStatistics(data[i]);
+            means[i] = format(stat.getMean(),2);
+            standardDeviations[i] = stat.getStandardDeviation();
+            if(repeatNum == 2){
+                diffs[1][i] = data[i][0] - data[i][1];  //diff
+                diffs[2][i] = Math.pow(diffs[1][i],2) /2; //diff * diff / 2
+                diffs[3][i] = diffs[1][i] / means[i] ;  //%diff
+                diffs[4][i] = Math.pow(diffs[3][i],2) /2; //%diff * %diff /2
+            }
+
+        }
+        diffs[0] = means;
+        mean = StatUtils.mean(means);
+        sdr = Math.sqrt(StatUtils.mean(diffs[2]))*100;
+        cvr = Math.sqrt(StatUtils.mean(diffs[4]))*100;
+        //TODO: check cvr
+
+        pr1.addData(targetValues, means, repeatNum,1);
+        pr2.addData(targetValues, means, repeatNum,2);
+        pr3.addData(targetValues, means, repeatNum,3);
+
+        if(pr2.isNonlinear() && pr3.isNonlinear()){
+            if(pr2.getStdError() > pr3.getStdError()) prBest = pr3;
+            else prBest = pr2;
+        } else if(pr2.isNonlinear()) {
+            prBest = pr2;
+        }
+        else if (pr3.isNonlinear()) {
+            prBest = pr3;
+        }
+        //calc dli
+        if(prBest != null) {
+            if(isTarget)  dli[0] = targetValues;
+            else dli[0] = means;
+
+            for (int i = 0; i < specimensNum; i++) {
+                dli[1][i] = prBest.calcFunc(dli[0][i]);
+                dli[2][i] = pr1.calcFunc(dli[0][i]);
+                dli[3][i] = dli[1][i] - dli[2][i];
+                dli[4][i] = 100 * dli[3][i] / dli[0][i];
+            }
+
+            maxDli = Arrays.stream(dli[4]).max().getAsDouble();
+        }
+//
+//        double s1 = pr1.getStdError() / mean;
+//        double s2 = pr2.getStdError() /mean;
+//        double s3 = pr3.getStdError() /mean;
+//        pr1.getParameters();
+    }
+
+    private void calcTarget(double[] targets){
+        if(ArrayUtils.isEmpty(targets)){
+            for (int i = 0; i < specimensNum; i++) {
+                targetValues[i] = i+1;
+            }
+            isTarget = false;
+        }else if(targets.length ==2) {
+            targetValues[0] = targets[0];
+            targetValues[specimensNum - 1] = targets[1];
+            int range = specimensNum - 1;
+            for (int i = 1; i < range; i++) {
+                targetValues[i] = format(targets[0] * (range - i) / range + targets[1] * i / range, 2);
+            }
+        }else if(targets.length ==specimensNum) {
+            targetValues = targets;
+        }
+    }
+
+    public TableDTO buildDataTableDTO(){
+        List<String> header = new ArrayList<String>();
+
+        header.add("标本号");
+        if(isTarget) header.add("目标值");
+        for (int i = 1; i <= repeatNum; i++) {
+            header.add(String.format("测量结果#%d",i));
+        }
+        TableDTO table = new TableDTO();
+        table.buildHeader( header.toArray(new String[header.size()]));
+
+        String[][] r = new String[specimensNum][];
+        for (int i = 0; i < data.length; i++) {
+            List<String> rl = new ArrayList();
+            rl.add(String.valueOf(i+1));
+            if(isTarget) rl.add(String.valueOf(targetValues[i]));
+
+            for (int j = 0; j < data[i].length; j++) {
+                rl.add(format(data[i][j]));
+            }
+            r[i] = rl.toArray(new String[rl.size()]);
+        }
+        table.buildData(r);
+        return table;
+    }
+
+    public Map<String, TableDTO> buildReportTableDTO(){
+        Map<String, TableDTO> reports = new HashMap<>();
+        reports.put("表1: 重复性差异检测结果",buildTable1DTO());
+        reports.put("表2: 多项式回归分析结果",buildTable2DTO());
+        reports.put("表3: 线性偏离计算结果",buildTable3DTO());
+        return reports;
+    }
+
+    private TableDTO buildTable1DTO(){
+
+        TableDTO table = new TableDTO();
+        String[] header = {"标本号", "均值", "差值Diff", "Diff<sup>2</sup>/2", "%Diff", "%Diff<sup>2</sup>/2"};
+        table.buildHeader(header);
+
+
+        double[][] r = new double[specimensNum][6];
+        double[][] doubles = transposeMatrix(diffs);
+
+        for (int i = 0; i < doubles.length; i++) {
+            r[i] = ArrayUtils.add(doubles[i], 0, i+1);
+        }
+        table.buildData(r,getScale());
+        return table;
+    }
+    private TableDTO buildTable2DTO(){
+
+        TableDTO table = new TableDTO();
+        String[] header = {"阶别", "系数", "系数值", "SE<sub>i</sub>", "t 检验", "S<sub>y.x</sub>","自由度"};
+        table.buildHeader(header);
+        table.getHeader()[0].put("merge","true");
+        table.getHeader()[5].put("merge","true");
+        table.getHeader()[6].put("merge","true");
+        String[][] r = new String[9][7];
+        int i = 0;
+        for (int j = 0; j < pr1.getParameters().length; j++) {
+            r[i][0] = "1";
+            r[i][1] = String.format("b%d",j);
+            r[i][2] = format(pr1.getParameters()[j]);
+            r[i][3] = format(pr1.getStdErrors()[j]);
+            r[i][4] = format(pr1.gettValue()[j]);
+            r[i][5] = format((pr1.getStdError()));
+            r[i][6] = pr1.getDfDependent().toString();
+            i++;
+        }
+        for (int j = 0; j < pr2.getParameters().length; j++) {
+            r[i][0] = "2";
+            r[i][1] = String.format("b%d",j);
+            r[i][2] = format(pr2.getParameters()[j]);
+            r[i][3] = format(pr2.getStdErrors()[j]);
+            r[i][4] = format(pr2.gettValue()[j]);
+            r[i][5] = format((pr2.getStdError()));
+            r[i][6] = pr2.getDfDependent().toString();
+            i++;
+        }
+        for (int j = 0; j < pr3.getParameters().length; j++) {
+            r[i][0] = "3";
+            r[i][1] = String.format("b%d",j);
+            r[i][2] = format(pr3.getParameters()[j]);
+            r[i][3] = format(pr3.getStdErrors()[j]);
+            r[i][4] = format(pr3.gettValue()[j]);
+            r[i][5] = format((pr3.getStdError()));
+            r[i][6] = pr3.getDfDependent().toString();
+            i++;
+        }
+        table.buildData(r);
+        return table;
+    }
+    private TableDTO buildTable3DTO(){
+
+        TableDTO table = new TableDTO();
+        String[] header = {"标本号", "x<sub>i</sub>", "p(x<sub>i</sub>)", "b<sub>0</sub>+b<sub>1</sub>x<sub>i</sub>", "DL<sub>i</sub>", "%DL<sub>i</sub>"};
+        table.buildHeader(header);
+
+        double[][] r = new double[specimensNum][6];
+        double[][] doubles = transposeMatrix(dli);
+
+        for (int i = 0; i < doubles.length; i++) {
+            r[i] = ArrayUtils.add(doubles[i], 0, i+1);
+        }
+        table.buildData(r,getScale());
+        return table;
+    }
+
+    public static void main(String[] args){
+        double[][] data = {{-0.01,-0.01},{5.00,4.99},{10.18,10.05},{14.65,14.65},{19.57,19.65},{24.02,24.09}};
+        EP6ALinearRangeVO ep6 = new EP6ALinearRangeVO(data, new double[]{0,24.09},1,3);
+        TableDTO tableDTO = ep6.buildDataTableDTO();
+        Map<String, TableDTO> stringTableDTOMap = ep6.buildReportTableDTO();
+        ReportDataDTO report = new ReportDataDTO();
+
+
+        report.setDataDTO(tableDTO);
+        report.setReportDataDTO(stringTableDTOMap);
+        String s = JSONObject.toJSONString(report, SerializerFeature.DisableCircularReferenceDetect);
+
+        System.out.println(s);
+//        ep6.getT()
+
+    }
+}

+ 57 - 18
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/PVItemBuilder.java

@@ -1,7 +1,6 @@
 package com.lc.ibps.components.verification.model2;
 
 import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.annotation.JSONField;
 import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.lc.ibps.components.poi.excel.entity.ExportParams;
 import com.lc.ibps.components.poi.excel.entity.ImportParams;
@@ -28,17 +27,52 @@ public class PVItemBuilder {
     public static String DISPLAY_LOG = "对数值";
 
     public static String DISPLAY_DATE = "实验日期";
-    private Map<String, SpecimensCalcVO> record = new HashMap<>();
-    private Map<String, CalcVO> record2 = new HashMap<>();
+    private InspectionConfigVO config;
+    private CalcVO calcVO;
+    private Map<String, CalcVO> calcMap = new HashMap<>();
 
-    public void importExcelRecord(InspectionConfigVO config,InputStream inputstream) throws IOException {
+    private PVItemBuilder(){
+
+    }
+
+    public static PVItemBuilder getInstance(InspectionConfigVO config){
+        PVItemBuilder builder = new PVItemBuilder();
+        builder.setConfig(config);
+        return builder;
+    }
+
+    public InspectionConfigVO getConfig() {
+        return config;
+    }
+
+    public void setConfig(InspectionConfigVO config) {
+        this.config = config;
+    }
+
+    public CalcVO getCalcVO() {
+        return calcVO;
+    }
+
+    public void setCalcVO(CalcVO calcVO) {
+        this.calcVO = calcVO;
+    }
+
+    public Map<String, CalcVO> getCalcMap() {
+        return calcMap;
+    }
+
+    public void setCalcMap(Map<String, CalcVO> calcMap) {
+        this.calcMap = calcMap;
+    }
+
+    public void importExcelRecord(InputStream inputstream) throws IOException {
         ImportParams params = new ImportParams();
         params.setTitleRows(1);
         params.setHeadRows(1);
         params.setSheetNum(config.getDays());
-        Map<String, List<String>> errorMessage = new HashMap<>();
         List<ExcelSheetRecord> list = PVExcelUtil.importExcel(inputstream, Map.class, params);
         int i = 1;
+        Map<String, List<String>>  errorMessage = new HashMap<>();
         for (ExcelSheetRecord record : list) {
             String sheetName = String.format("第 %d 天",i);
             if(config.getDays() == 1){
@@ -54,27 +88,28 @@ public class PVItemBuilder {
             throw new IOException(JSONObject.toJSONString(errorMessage, SerializerFeature.DisableCircularReferenceDetect));
         }
 
+        double[][] dataArrays = new double[config.getSpecimensNum()][config.getRepeatNum() * config.getDays()];
+        int ii = 0;
         for (String sName : config.getSpecimensName()) {
-            final xValue[] total = new xValue[config.getRepeatNum() * config.getDays()];
+            final double[] total2 = new double[config.getRepeatNum() * config.getDays()];
             for (int j = 0; j < list.size(); j++) {
                 final xValue[] xValues = list.get(j).getConvertedData().get(sName);
                 for (int k = 0; k < xValues.length; k++) {
-                    total[j * xValues.length + k] = xValues[k];
+                    total2[j * xValues.length + k] = xValues[k].getDoub();
                 }
             }
-            record.put(sName, new SpecimensCalcVO(total, config.isConvert()));
+            dataArrays[ii] = total2;
+            ii++;
         }
-//        buildItemCalcVO();
-
 
         if(config.getName().toLowerCase().contains("精密度")){
             for (String sName : config.getSpecimensName()) {
-                SpecimensCalcVO[] data = new SpecimensCalcVO[config.getDays()];
+                //day - spec
+                double[][] data = new double[config.getDays()][config.getRepeatNum()];
                 for (int j = 0; j < list.size(); j++) {
-                    final xValue[] xValues = list.get(j).getConvertedData().get(sName);
-                    data[j] = new SpecimensCalcVO(xValues, config.isConvert());
+                    data[j] = CalcVO.transposeXValue(list.get(j).getConvertedData().get(sName));
                 }
-                record2.put(sName, new EP15PrecisionVO(data,config.getRepeatNum(),config.getBatchCVSValue(),config.getDailyCVSValue(),config.getDecimal()));
+                calcMap.put(sName, new EP15PrecisionVO(data,config.getBatchCVSValue(),config.getDailyCVSValue(),config.getDecimal()));
             }
         }else if(config.getName().equals("定值参考物质验证")){
             for (String sName : config.getSpecimensName()) {
@@ -85,12 +120,16 @@ public class PVItemBuilder {
                         total[j * xValues.length + k] = xValues[k];
                     }
                 }
-                record2.put(sName, new EP15TruenessReferneceVO(total, config.getTargetValue()[0],config.getClaimValue(),0));
+                calcMap.put(sName, new EP15TruenessReferneceVO(CalcVO.transposeXValue(total), config.getTargetValue()[0],config.getClaimValue(),0));
             }
         }else if(config.getName().equals("EP15-A方法学比对")){
 
-            record2.put("EP15-A方法学比对",
-                    new EP15TruenessPatientVO(record.get(config.getSpecimensName()[0]),record.get(config.getSpecimensName()[1]), config.getClaimValue(),0));
+            calcVO = new EP15TruenessPatientVO(dataArrays, config.getClaimValue(),0);
+
+        }
+        else if(config.getName().equals("EP6-A线性评价")){
+
+            calcVO = new EP6ALinearRangeVO(dataArrays, config.getTargetValue(),config.getClaimValue(),config.getDecimal());
 
         }
 
@@ -98,7 +137,7 @@ public class PVItemBuilder {
 
     }
 
-    public Workbook exportExcelTemplate(InspectionConfigVO config) {
+    public Workbook exportExcelTemplate() {
         List<ExcelExportEntity> entity = new ArrayList<ExcelExportEntity>();
 
         List<ExcelExportEntity> temp = new ArrayList<ExcelExportEntity>();

+ 8 - 1
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/regression/PolynomialRegression.java

@@ -1,6 +1,6 @@
 package com.lc.ibps.components.verification.regression;
 
-import com.lc.ibps.components.verification.model.CalcVO;
+import com.lc.ibps.components.verification.model2.CalcVO;
 import org.apache.commons.math3.stat.regression.OLSMultipleLinearRegression;
 
 import java.util.ArrayList;
@@ -121,4 +121,11 @@ public class PolynomialRegression extends Regression{
         isNonlinear = nonlinear;
     }
 
+    public double[] gettValue() {
+        return tValue;
+    }
+
+    public void settValue(double[] tValue) {
+        this.tValue = tValue;
+    }
 }

+ 18 - 2
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/report/ReportDataDTO.java

@@ -1,10 +1,9 @@
 package com.lc.ibps.components.verification.report;
 
-import com.lc.ibps.components.verification.model.CalcVO;
+import com.lc.ibps.components.verification.model2.CalcVO;
 import com.lc.ibps.components.verification.model.InspectionConfigVO;
 
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 public class ReportDataDTO {
@@ -15,6 +14,8 @@ public class ReportDataDTO {
 
     private Map<String, double[]> data = new HashMap<>();
 
+    private TableDTO   dataDTO;
+    private Map<String, TableDTO> reportDataDTO;
 
     public InspectionConfigVO getConfig() {
         return config;
@@ -40,4 +41,19 @@ public class ReportDataDTO {
         this.reportData = reportData;
     }
 
+    public TableDTO getDataDTO() {
+        return dataDTO;
+    }
+
+    public void setDataDTO(TableDTO dataDTO) {
+        this.dataDTO = dataDTO;
+    }
+
+    public Map<String, TableDTO> getReportDataDTO() {
+        return reportDataDTO;
+    }
+
+    public void setReportDataDTO(Map<String, TableDTO> reportDataDTO) {
+        this.reportDataDTO = reportDataDTO;
+    }
 }

+ 10 - 8
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/report/ReportFactory.java

@@ -1,19 +1,21 @@
 package com.lc.ibps.components.verification.report;
 
 import com.lc.ibps.components.verification.model.InspectionItemVO;
+import com.lc.ibps.components.verification.model2.PVItemBuilder;
 
 public class ReportFactory {
 
-    public static ReportDataDTO build(InspectionItemVO item){
+    public static ReportDataDTO build(PVItemBuilder builder){
         ReportDataDTO data = new ReportDataDTO();
 
-        data.setConfig(item.getConfig());
-        data.setData(item.getData());
-        data.setReportData(item.getRecord2());
-        if(item.getConfig().getName().toLowerCase().contains("ep15")){
-        } else{
-//            data.setData(item.getRecord());
-        }
+        data.setConfig(builder.getConfig());
+
+        data.setDataDTO(builder.getCalcVO().buildDataTableDTO());
+        data.setReportDataDTO(builder.getCalcVO().buildReportTableDTO());
+//        if(item.getConfig().getName().toLowerCase().contains("ep15")){
+//        } else{
+////            data.setData(item.getRecord());
+//        }
         return  data;
     }
 }

+ 61 - 0
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/report/TableDTO.java

@@ -0,0 +1,61 @@
+package com.lc.ibps.components.verification.report;
+
+import com.lc.ibps.components.verification.model2.CalcVO;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class TableDTO {
+
+    private Map<String, String>[] header;
+
+    private Map<String, String>[] list;
+
+    public void buildHeader(String[] h){
+        header = new Map[h.length];
+        for (int i = 0; i < h.length; i++) {
+            HashMap<String, String> m = new HashMap<>();
+            m.put("label",h[i]);
+            m.put("prop",String.valueOf((char)(65+i)));
+            header[i] = m;
+        }
+    }
+
+    public void buildData(String[][] data){
+        list = new Map[data.length];
+        for (int i = 0; i < data.length; i++) {
+            HashMap<String, String> m = new HashMap<>();
+            for (int j = 0; j < data[0].length; j++) {
+                m.put(String.valueOf((char)(65+j)), data[i][j]);
+            }
+            list[i] = m;
+        }
+    }
+
+    public void buildData(double[][] data,int scale){
+        list = new Map[data.length];
+        for (int i = 0; i < data.length; i++) {
+            HashMap<String, String> m = new HashMap<>();
+            for (int j = 0; j < data[0].length; j++) {
+                m.put(String.valueOf((char)(65+j)), String.valueOf(CalcVO.format( data[i][j],scale)));
+            }
+            list[i] = m;
+        }
+    }
+
+    public Map<String, String>[] getHeader() {
+        return header;
+    }
+
+    public void setHeader(Map<String, String>[] header) {
+        this.header = header;
+    }
+
+    public Map<String, String>[] getList() {
+        return list;
+    }
+
+    public void setList(Map<String, String>[] list) {
+        this.list = list;
+    }
+}

+ 13 - 9
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/service/impl/PerformanceVerificationServiceImpl.java

@@ -8,6 +8,7 @@ import com.lc.ibps.components.pv.persistence.entity.ExperimentalPo;
 import com.lc.ibps.components.pv.repository.ExperimentalRepository;
 import com.lc.ibps.components.verification.model.InspectionConfigVO;
 import com.lc.ibps.components.verification.model.InspectionItemVO;
+import com.lc.ibps.components.verification.model2.PVItemBuilder;
 import com.lc.ibps.components.verification.report.ReportDataDTO;
 import com.lc.ibps.components.verification.report.ReportFactory;
 import com.lc.ibps.components.verification.service.PerformanceVerificationService;
@@ -27,13 +28,15 @@ public class PerformanceVerificationServiceImpl implements PerformanceVerificati
     public ReportDataDTO importExcelRecord(String id, MultipartFile applyFiles) throws IOException {
 
         InspectionConfigVO config = getInspectionConfig(id);
-        InspectionItemVO item = new InspectionItemVO(config);
-        item.importExcelRecord(applyFiles.getInputStream());
+//        InspectionItemVO item = new InspectionItemVO(config);
+//        item.importExcelRecord(applyFiles.getInputStream());
+        PVItemBuilder builder = PVItemBuilder.getInstance(config);
+        builder.importExcelRecord(applyFiles.getInputStream());
         Experimental experimental = experimentalRepository.load(id);
-        if(!item.isDataPass()){
-            throw new IOException(JSONObject.toJSONString(item.getErrorMessage(), SerializerFeature.DisableCircularReferenceDetect));
-        }
-        ReportDataDTO dataDTO = ReportFactory.build(item);
+//        if(!item.isDataPass()){
+//            throw new IOException(JSONObject.toJSONString(item.getErrorMessage(), SerializerFeature.DisableCircularReferenceDetect));
+//        }
+        ReportDataDTO dataDTO = ReportFactory.build(builder);
         experimental.getData().setShiYanShuJu(JSONObject.toJSONString(dataDTO,SerializerFeature.DisableCircularReferenceDetect));
         experimental.save();
         return dataDTO;
@@ -42,9 +45,10 @@ public class PerformanceVerificationServiceImpl implements PerformanceVerificati
     @Override
     public Workbook exportExcelTemplateExport(String id) {
         InspectionConfigVO config = getInspectionConfig(id);
-        InspectionItemVO item = new InspectionItemVO(config);
-        Workbook workbook = item.exportExcelTemplate();
-        return workbook;
+//        InspectionItemVO item = new InspectionItemVO(config);
+//        Workbook workbook = item.exportExcelTemplate();
+        return PVItemBuilder.getInstance(config).exportExcelTemplate();
+//        return workbook;
     }
 
     @Override