|
@@ -1,8 +1,13 @@
|
|
|
package com.lc.ibps.components.verification.model2;
|
|
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.model.InspectionConfigVO;
|
|
|
|
|
+import com.lc.ibps.components.verification.report.ReportDataDTO;
|
|
|
|
|
+import com.lc.ibps.components.verification.report.ReportFactory;
|
|
|
import com.lc.ibps.components.verification.report.SheetDTO;
|
|
import com.lc.ibps.components.verification.report.SheetDTO;
|
|
|
import com.lc.ibps.components.verification.report.TableDTO;
|
|
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.MatrixUtils;
|
|
|
import org.apache.commons.math3.linear.RealMatrix;
|
|
import org.apache.commons.math3.linear.RealMatrix;
|
|
|
import org.apache.commons.math3.linear.RealMatrixFormat;
|
|
import org.apache.commons.math3.linear.RealMatrixFormat;
|
|
@@ -25,23 +30,27 @@ public class TruenessReferneceTest {
|
|
|
InspectionConfigVO config = new InspectionConfigVO("EP15-A2定值参考物质验证", 5, 2,
|
|
InspectionConfigVO config = new InspectionConfigVO("EP15-A2定值参考物质验证", 5, 2,
|
|
|
null, 2, LocalDate.now(), true);
|
|
null, 2, LocalDate.now(), true);
|
|
|
config.setUnits("mmol/L");
|
|
config.setUnits("mmol/L");
|
|
|
- config.setTargetValue(new double[]{2.1, 2.2});
|
|
|
|
|
|
|
+ config.setTargetValue(new double[]{3.1, 3.2});
|
|
|
|
|
+ config.setClaimValue(0.02);
|
|
|
|
|
+ config.setRejectionRate(5);
|
|
|
|
|
+ config.setDecimal(3);
|
|
|
config.setKey(ModelEnum.TruenessRefernece.getKey());
|
|
config.setKey(ModelEnum.TruenessRefernece.getKey());
|
|
|
- double[][] data = {
|
|
|
|
|
- {2.04, 2.09, 2.04, 2.09},
|
|
|
|
|
- {2.15, 2.04, 2.04, 2.09},
|
|
|
|
|
- {2.09, 1.98, 2.04, 2.09},
|
|
|
|
|
- {2.15, 2.09, 2.04, 2.09},
|
|
|
|
|
- {2.09, 2.04, 2.04, 2.09}};
|
|
|
|
|
|
|
+ double[][] data = new double[config.getDays()][config.getRepeatNum() * config.getSpecimensNum()];
|
|
|
|
|
+ for (int i = 0; i < config.getDays(); i++) {
|
|
|
|
|
+ for (int j = 0; j < config.getRepeatNum() * config.getSpecimensNum(); j++) {
|
|
|
|
|
+ data[i][j] = RandomUtils.nextDouble(3.12, 3.45);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
RealMatrix matrix = MatrixUtils.createRealMatrix(data);
|
|
RealMatrix matrix = MatrixUtils.createRealMatrix(data);
|
|
|
RealMatrixFormat matrixFormat = new RealMatrixFormat("", "", "", "\n",
|
|
RealMatrixFormat matrixFormat = new RealMatrixFormat("", "", "", "\n",
|
|
|
"", ",", new DecimalFormat("0.00"));
|
|
"", ",", new DecimalFormat("0.00"));
|
|
|
System.out.println(matrixFormat.format(matrix));
|
|
System.out.println(matrixFormat.format(matrix));
|
|
|
- TruenessRefernece tr = new TruenessRefernece(data, config);
|
|
|
|
|
- TableDTO tableDTO = tr.buildDataTableDTO();
|
|
|
|
|
- SheetDTO[] sheetDTOS = tr.buildSheetDTO();
|
|
|
|
|
- String s = tr.generateResult();
|
|
|
|
|
-
|
|
|
|
|
|
|
+ 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(s);
|
|
|
|
|
+ System.out.println(s1);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|