Просмотр исходного кода

[task-1766] 性能验证模块 开发 (二期) / 添加新的表参数

Li Yuan 1 год назад
Родитель
Сommit
1b40c2c65e
13 измененных файлов с 130 добавлено и 18 удалено
  1. 10 0
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/controller/PerformanceVerificationController.java
  2. 4 5
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/LinearRangeEP6A.java
  3. 3 2
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/PVItemBuilder.java
  4. 1 0
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/PVModel.java
  5. 4 0
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/PrecisionEP15.java
  6. 0 1
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/PrecisionEP15Item.java
  7. 48 0
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/PrecisionRepeatability.java
  8. 33 0
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/TruenessBiasAssessment.java
  9. 1 2
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/TruenessEP15Patient.java
  10. 5 0
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/TruenessRefernece.java
  11. 0 1
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/TruenessReferneceItem.java
  12. 2 0
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/service/PerformanceVerificationService.java
  13. 19 7
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/service/impl/PerformanceVerificationServiceImpl.java

+ 10 - 0
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/controller/PerformanceVerificationController.java

@@ -56,6 +56,16 @@ public class PerformanceVerificationController extends GenericProvider {
         return apiResult;
     }
 
+    @PostMapping(value = "/recalculate")
+    @ApiOperation("重新计算数据")
+    public APIResult<ReportDataDTO> recalculate(
+            @RequestParam(value = "id") String id) {
+        APIResult<ReportDataDTO> apiResult = new APIResult<>();
+        ReportDataDTO reportRecord = performanceVerificationService.recalculate(id);
+        apiResult.setData(reportRecord);
+        return apiResult;
+    }
+
     @PostMapping(value = "/getReportRecord")
     @ApiOperation("导出检测报告数据")
     public APIResult<ReportDataDTO> importExcelRecord(

+ 4 - 5
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/LinearRangeEP6A.java

@@ -42,21 +42,20 @@ public class LinearRangeEP6A extends PVModel {
         this.specimensNum = configVO.getSpecimensNum();
         this.repeatNum = configVO.getRepeatNum();
         this.means = new double[this.specimensNum];
+        this.standardDeviations = new double[this.specimensNum];
+        this.claimValue = configVO.getClaimValue();
         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 = configVO.getClaimValue();
         calcTarget(configVO.getTargetValue());
-        calculate();
     }
 
-
+    @Override
     public void calculate() {
 
         for (int i = 0; i < specimensNum; i++) {
             DescriptiveStatistics stat = new DescriptiveStatistics(data[i]);
-            means[i] = format(stat.getMean(), 2);
+            means[i] = stat.getMean();
             standardDeviations[i] = stat.getStandardDeviation();
             if (repeatNum == 2) {
                 diffs[1][i] = data[i][0] - data[i][1];  //diff

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

@@ -86,12 +86,12 @@ public class PVItemBuilder {
 
         final double[][] dataArrays = list.get(0).getConvertedData();
 
-        pvModel = buildPVModel(dataArrays);
+        buildPVModel(dataArrays);
 
     }
 
     public PVModel buildPVModel(double[][] dataArrays) {
-        PVModel pvModel;
+//        PVModel pvModel;
         if (config.getKey().equals("精密度验证")) {
             pvModel = new PrecisionEP15(dataArrays, config);
         } else if (config.getKey().equals("使用定值参考物质验证")) {
@@ -103,6 +103,7 @@ public class PVItemBuilder {
         } else {
             return null;
         }
+        pvModel.calculate();
         return pvModel;
     }
 }

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

@@ -59,6 +59,7 @@ public abstract class PVModel {
         return after;
     }
 
+    public abstract void calculate();
     public abstract TableDTO buildDataTableDTO();
 
     public abstract SheetDTO[] buildSheetDTO();

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

@@ -27,6 +27,10 @@ public class PrecisionEP15 extends PVModel {
             items.add(new PrecisionEP15Item(specimensName[i], sub, configVO));
         }
     }
+    @Override
+    public void calculate() {
+        items.stream().forEach(i->i.calculate());
+    }
 
     public static void main(String[] args) {
         InspectionConfigVO config = new InspectionConfigVO("精密度", 5, 2,

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

@@ -75,7 +75,6 @@ public class PrecisionEP15Item {
             this.p = 0.01;
         }
         this.df = configVO.getDays() * (configVO.getRepeatNum()-1);
-        calculate();
     }
 
     public double getN() {

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

@@ -0,0 +1,48 @@
+package com.lc.ibps.components.verification.model2;
+
+import com.lc.ibps.components.verification.model.InspectionConfigVO;
+import com.lc.ibps.components.verification.report.SheetDTO;
+import com.lc.ibps.components.verification.report.TableDTO;
+import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
+
+public class PrecisionRepeatability extends PVModel{
+    private double[] cvs;
+    private  int specimensNum;
+    private  int repeatNum;
+    private  double[] means;
+    private  double[] standardDeviations;
+
+    public PrecisionRepeatability(double[][] data, InspectionConfigVO configVO) {
+        super(data, configVO);
+        this.specimensNum = configVO.getSpecimensNum();
+        this.repeatNum = configVO.getRepeatNum();
+        this.means = new double[this.specimensNum];
+        this.standardDeviations = new double[this.specimensNum];
+        this.cvs = new double[this.specimensNum];
+    }
+
+    @Override
+    public void calculate() {
+        for (int i = 0; i < specimensNum; i++) {
+            DescriptiveStatistics stat = new DescriptiveStatistics(data[i]);
+            means[i] = stat.getMean();
+            standardDeviations[i] = stat.getStandardDeviation();
+            cvs[i] = 100 * standardDeviations[i]/means[i];
+        }
+    }
+
+    @Override
+    public TableDTO buildDataTableDTO() {
+        return null;
+    }
+
+    @Override
+    public SheetDTO[] buildSheetDTO() {
+        return new SheetDTO[0];
+    }
+
+    @Override
+    public String generateResult() {
+        return null;
+    }
+}

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

@@ -0,0 +1,33 @@
+package com.lc.ibps.components.verification.model2;
+
+import com.lc.ibps.components.verification.model.InspectionConfigVO;
+import com.lc.ibps.components.verification.report.SheetDTO;
+import com.lc.ibps.components.verification.report.TableDTO;
+
+public class TruenessBiasAssessment extends PVModel{
+    private double[] targetValues;
+    private double tea;
+    public TruenessBiasAssessment(double[][] data, InspectionConfigVO configVO) {
+        super(data, configVO);
+    }
+
+    @Override
+    public void calculate() {
+
+    }
+
+    @Override
+    public TableDTO buildDataTableDTO() {
+        return null;
+    }
+
+    @Override
+    public SheetDTO[] buildSheetDTO() {
+        return new SheetDTO[0];
+    }
+
+    @Override
+    public String generateResult() {
+        return null;
+    }
+}

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

@@ -48,9 +48,8 @@ public class TruenessEP15Patient extends PVModel {
 //        }
         this.n = this.y.length;
         this.sdClaim = configVO.getClaimValue();
-        calculate();
     }
-
+    @Override
     public void calculate() {
 
         yx = new double[y.length];

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

@@ -28,6 +28,11 @@ public class TruenessRefernece extends PVModel {
         }
     }
 
+    @Override
+    public void calculate() {
+        items.stream().forEach(i->i.calculate());
+    }
+
 
     @Override
     public TableDTO buildDataTableDTO() {

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

@@ -38,7 +38,6 @@ public class TruenessReferneceItem {
         } else {
             this.t = t;
         }
-        calculate();
     }
 
     /*

+ 2 - 0
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/service/PerformanceVerificationService.java

@@ -17,4 +17,6 @@ public interface PerformanceVerificationService {
     Workbook exportExcelReport(String id);
 
     ReportDataDTO getReportRecord(String id);
+
+    ReportDataDTO recalculate(String id);
 }

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

@@ -30,17 +30,14 @@ 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());
         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(builder);
-        experimental.getData().setShiYanShuJu(JSONObject.toJSONString(dataDTO, SerializerFeature.DisableCircularReferenceDetect));
+        experimental.getData().setShiYanShuJu(JSONObject.toJSONString(builder.getPvModel().getData(), SerializerFeature.DisableCircularReferenceDetect));
+        experimental.getData().setJiSuanJieGuo(JSONObject.toJSONString(dataDTO, SerializerFeature.DisableCircularReferenceDetect));
         experimental.getData().setShiYanJieLun(builder.getPvModel().generateResult());
         experimental.save();
         return dataDTO;
@@ -69,10 +66,25 @@ public class PerformanceVerificationServiceImpl implements PerformanceVerificati
     @Override
     public ReportDataDTO getReportRecord(String id) {
         ExperimentalPo experimentalPo = experimentalRepository.get(id);
-        InspectionItemVO item = JSON.parseObject(experimentalPo.getShiYanShuJu(), InspectionItemVO.class);
+        InspectionItemVO item = JSON.parseObject(experimentalPo.getJiSuanJieGuo(), InspectionItemVO.class);
         return null;
     }
 
+    @Override
+    public ReportDataDTO recalculate(String id) {
+        InspectionConfigVO config = getInspectionConfig(id);
+        PVItemBuilder builder = PVItemBuilder.getInstance(config);
+        Experimental experimental = experimentalRepository.load(id);
+        double[][] object = JSON.parseObject(experimental.getData().getShiYanShuJu(), double[][].class);
+        builder.buildPVModel(object);
+
+        ReportDataDTO dataDTO = ReportFactory.build(builder);
+        experimental.getData().setJiSuanJieGuo(JSONObject.toJSONString(dataDTO, SerializerFeature.DisableCircularReferenceDetect));
+        experimental.getData().setShiYanJieLun(builder.getPvModel().generateResult());
+        experimental.save();
+        return dataDTO;
+    }
+
     private InspectionConfigVO getInspectionConfig(String id) {
 
         ExperimentalPo experimentalPo = experimentalRepository.get(id);