|
|
@@ -1,20 +1,11 @@
|
|
|
package com.lc.ibps.components.verification.model2;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
import com.lc.ibps.components.verification.model.InspectionConfigVO;
|
|
|
-import com.lc.ibps.components.verification.report.EchartsFreemarkerUtils;
|
|
|
-import com.lc.ibps.components.verification.report.ReportDataDTO;
|
|
|
-import com.lc.ibps.components.verification.report.ReportFactory;
|
|
|
import com.lc.ibps.components.verification.report.TableDTO;
|
|
|
-import org.apache.commons.lang3.RandomUtils;
|
|
|
import org.apache.commons.math3.linear.MatrixUtils;
|
|
|
import org.apache.commons.math3.linear.RealMatrix;
|
|
|
-import org.apache.commons.math3.linear.RealMatrixFormat;
|
|
|
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
|
|
|
|
|
|
-import java.text.DecimalFormat;
|
|
|
-import java.time.LocalDate;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -30,7 +21,7 @@ public class PrecisionRepeatability extends PVModel {
|
|
|
super(data, configVO);
|
|
|
this.batchCVSValue = configVO.getBatchCVSValue();
|
|
|
this.teaFormat = getTEaFormat(configVO.getBatchCVS());
|
|
|
- if(configVO.getDays() >1){
|
|
|
+ if (configVO.getDays() > 1) {
|
|
|
RealMatrix realMatrix = MatrixUtils.createRealMatrix(data);
|
|
|
this.data = realMatrix.transpose().getData();
|
|
|
this.batchCVSValue = configVO.getDailyCVSValue();
|
|
|
@@ -57,7 +48,7 @@ public class PrecisionRepeatability extends PVModel {
|
|
|
|
|
|
header.add("样本名");
|
|
|
for (int i = 1; i <= data[0].length; i++) {
|
|
|
- header.add(String.format("%s#%d",repeatNum>1?"重复":"天数", i));
|
|
|
+ header.add(String.format("%s#%d", repeatNum > 1 ? "重复" : "天数", i));
|
|
|
}
|
|
|
TableDTO table = new TableDTO();
|
|
|
table.buildHeader(header.toArray(new String[header.size()]));
|
|
|
@@ -99,7 +90,7 @@ public class PrecisionRepeatability extends PVModel {
|
|
|
|
|
|
@Override
|
|
|
public String generateResult() {
|
|
|
- return renderReportTemplate(this,"/report/precisionRepeatability.ftl");
|
|
|
+ return renderReportTemplate(this, "/report/precisionRepeatability.ftl");
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -153,31 +144,4 @@ public class PrecisionRepeatability extends PVModel {
|
|
|
this.teaFormat = teaFormat;
|
|
|
}
|
|
|
|
|
|
- public static void main(String[] args) {
|
|
|
- InspectionConfigVO config = new InspectionConfigVO("test", 1, 2,
|
|
|
- null, 10, LocalDate.now(), true);
|
|
|
- config.setBatchCVS(0.25);
|
|
|
- config.setBatchCVSValue(2.5);
|
|
|
- config.setDecimal(3);
|
|
|
- config.setUnits("mmg/L");
|
|
|
- config.setKey(ModelEnum.PrecisionRepeatability.getKey());
|
|
|
- RandomUtils.nextDouble();
|
|
|
- double[][] data = new double[config.getSpecimensNum()][config.getRepeatNum()];
|
|
|
- for (int i = 0; i < config.getSpecimensNum(); i++) {
|
|
|
- for (int j = 0; j < config.getRepeatNum(); j++) {
|
|
|
- data[i][j] = RandomUtils.nextDouble(3.12, 3.45);
|
|
|
- }
|
|
|
- }
|
|
|
- RealMatrix matrix = MatrixUtils.createRealMatrix(data);
|
|
|
- RealMatrixFormat matrixFormat = new RealMatrixFormat("", "", "", "\n",
|
|
|
- "", ",", new DecimalFormat("0.00"));
|
|
|
- System.out.println(matrixFormat.format(matrix));
|
|
|
- PVItemBuilder pvItemBuilder = PVItemBuilder.getInstance(config);
|
|
|
- pvItemBuilder.buildPVModel(data);
|
|
|
- ReportDataDTO dataDTO = ReportFactory.build(pvItemBuilder);
|
|
|
- String s = JSONObject.toJSONString(dataDTO, SerializerFeature.DisableCircularReferenceDetect);
|
|
|
- String s1 = pvItemBuilder.getPvModel().generateResult();
|
|
|
- System.out.println(s);
|
|
|
- System.out.println(s1);
|
|
|
- }
|
|
|
}
|