Browse Source

性能验证模块 开发 (二期) / 重构相关模块

liyuan 1 year ago
parent
commit
ce0b5044b5
48 changed files with 1145 additions and 632 deletions
  1. 12 11
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/controller/PerformanceVerificationController.java
  2. 6 6
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/excel/CreateExcelScatterChart.java
  3. 13 12
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/excel/PVExcelExportStyler.java
  4. 1 2
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/excel/PVExcelExportTemplateServer.java
  5. 12 10
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/excel/PVExcelImportServer.java
  6. 1 2
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/excel/PVExcelUtil.java
  7. 50 7
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/excel/PVTest.java
  8. 96 0
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/excel/strategy/AbstractTemplateStrategy.java
  9. 61 0
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/excel/strategy/LinearRangeStrategy.java
  10. 60 0
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/excel/strategy/MethodStrategy.java
  11. 83 0
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/excel/strategy/MultiDayStrategy.java
  12. 25 0
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/excel/strategy/TemplateStrategy.java
  13. 13 13
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/funcs/TestFuncs.java
  14. 4 2
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/funcs/xAverage.java
  15. 4 3
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/funcs/xFuncArray2Args.java
  16. 4 3
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/funcs/xFuncStdevVar.java
  17. 5 3
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/funcs/xLog10.java
  18. 68 47
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/funcs/xValue.java
  19. 2 2
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/ExcelParserErrorEnum.java
  20. 9 9
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/ExcelSheetRecord.java
  21. 1 1
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/FunctionEnum.java
  22. 33 2
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/InspectionConfigVO.java
  23. 21 20
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/InspectionItemVO.java
  24. 9 9
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/ItemCalcVO.java
  25. 12 12
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/SpecimensCalcVO.java
  26. 93 0
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/ExcelSheetRecord2.java
  27. 84 81
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/LinearRangeEP6A.java
  28. 46 127
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/PVItemBuilder.java
  29. 32 11
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/PVModel.java
  30. 57 46
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/PrecisionEP15.java
  31. 49 47
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/PrecisionEP15Item.java
  32. 59 51
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/TruenessEP15Patient.java
  33. 31 17
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/TruenessRefernece.java
  34. 4 3
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model2/TruenessReferneceItem.java
  35. 2 2
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/regression/MultipleLinearRegression.java
  36. 12 10
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/regression/PolynomialRegression.java
  37. 3 2
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/regression/SimpleLinearRegression.java
  38. 20 20
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/regression/StatisticsTest.java
  39. 13 5
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/regression/StatisticsUtil.java
  40. 2 1
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/report/ChartDTO.java
  41. 3 2
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/report/EchartsFreemarkerUtils.java
  42. 1 3
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/report/ReportDataDTO.java
  43. 2 2
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/report/ReportFactory.java
  44. 2 2
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/report/SheetDTO.java
  45. 15 15
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/report/TableDTO.java
  46. 3 3
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/service/PerformanceVerificationService.java
  47. 6 5
      ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/service/impl/PerformanceVerificationServiceImpl.java
  48. 1 1
      ibps-provider-root/modules/provider-business/src/main/resources/pv/report/precisionEP15A2.ftl

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

@@ -24,23 +24,23 @@ import java.io.IOException;
 @Api(tags = "性能验证接口")
 @RequestMapping(value = "/pv")
 @RestController
-public class PerformanceVerificationController extends GenericProvider{
+public class PerformanceVerificationController extends GenericProvider {
 
     protected static final Logger logger = LoggerFactory.getLogger(PerformanceVerificationController.class);
     @Autowired
     private PerformanceVerificationService performanceVerificationService;
 
 
-    @PostMapping(value = "/importExcelRecord",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    @PostMapping(value = "/importExcelRecord", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
     @ApiOperation("导入检测数据")
     public APIResult<ReportDataDTO> importExcelRecord(
-                                             @RequestParam(value = "id") String id,
-                                             @RequestPart(value = "applyFiles") MultipartFile applyFiles
+            @RequestParam(value = "id") String id,
+            @RequestPart(value = "applyFiles") MultipartFile applyFiles
     ) {
         APIResult<ReportDataDTO> apiResult = new APIResult<>();
         ReportDataDTO itemVO = null;
         try {
-            itemVO = performanceVerificationService.importExcelRecord( id, applyFiles);
+            itemVO = performanceVerificationService.importExcelRecord(id, applyFiles);
             apiResult.setData(itemVO);
 
             apiResult.setMessage("导入成功");
@@ -59,7 +59,7 @@ public class PerformanceVerificationController extends GenericProvider{
     @PostMapping(value = "/getReportRecord")
     @ApiOperation("导出检测报告数据")
     public APIResult<ReportDataDTO> importExcelRecord(
-            @RequestParam(value = "id") String id){
+            @RequestParam(value = "id") String id) {
         APIResult<ReportDataDTO> apiResult = new APIResult<>();
         ReportDataDTO reportRecord = performanceVerificationService.getReportRecord(id);
         apiResult.setData(reportRecord);
@@ -68,14 +68,14 @@ public class PerformanceVerificationController extends GenericProvider{
 
     @PostMapping("/exportExcelTemplate")
     @ApiOperation(value = "导出数据模板", notes = "导出数据模板")
-    public  APIResult<Void> exportExcelTemplate( @RequestParam(value = "id") String id) {
+    public APIResult<Void> exportExcelTemplate(@RequestParam(value = "id") String id) {
         ByteArrayOutputStream bos = null;
         APIResult<Void> apiResult = new APIResult<>();
         try {
 
-            Workbook workbook = performanceVerificationService.exportExcelTemplateExport( id);
+            Workbook workbook = performanceVerificationService.exportExcelTemplateExport(id);
 //			String rootRealPath = AppFileUtil.getRealPath("/" + AppFileUtil.TEMP_PATH); // 操作的根目录
-            String fileName = "dataTemplate_"  + (workbook instanceof HSSFWorkbook ? ".xls" : ".xlsx");
+            String fileName = "dataTemplate_" + (workbook instanceof HSSFWorkbook ? ".xls" : ".xlsx");
 //			FileUtil.writeFile(rootRealPath + File.separator + fileName + (workbook instanceof HSSFWorkbook ? ".xls" : ".xlsx"), workbook);
             bos = new ByteArrayOutputStream();
             workbook.write(bos);
@@ -98,14 +98,15 @@ public class PerformanceVerificationController extends GenericProvider{
         }
         return apiResult;
     }
+
     @PostMapping("/exportExcelReport")
     @ApiOperation(value = "导出数据报告", notes = "导出数据报告")
-    public  APIResult<Void> exportExcelReport(@RequestParam(value = "id") String id) {
+    public APIResult<Void> exportExcelReport(@RequestParam(value = "id") String id) {
         ByteArrayOutputStream bos = null;
         APIResult<Void> apiResult = new APIResult<>();
         try {
 
-            Workbook workbook = performanceVerificationService.exportExcelReport( id);
+            Workbook workbook = performanceVerificationService.exportExcelReport(id);
 //			String rootRealPath = AppFileUtil.getRealPath("/" + AppFileUtil.TEMP_PATH); // 操作的根目录
             String fileName = "dataReport_" + null + (workbook instanceof HSSFWorkbook ? ".xls" : ".xlsx");
 //			FileUtil.writeFile(rootRealPath + File.separator + fileName + (workbook instanceof HSSFWorkbook ? ".xls" : ".xlsx"), workbook);

+ 6 - 6
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/excel/CreateExcelScatterChart.java

@@ -56,8 +56,8 @@ public class CreateExcelScatterChart {
 
         leftAxis.setCrosses(AxisCrosses.AUTO_ZERO);
         bottomAxis.setCrosses(AxisCrosses.AUTO_ZERO);
-        ChartDataSource<Number> xs = DataSources.fromNumericCellRange(sheet, new CellRangeAddress(rowNum, rowNum, 0, item.getConfig().getSpecimensNum()-1));
-        ChartDataSource<Number> ys = DataSources.fromNumericCellRange(sheet, new CellRangeAddress(rowNum+1, rowNum+1, 0, item.getConfig().getSpecimensNum()-1));
+        ChartDataSource<Number> xs = DataSources.fromNumericCellRange(sheet, new CellRangeAddress(rowNum, rowNum, 0, item.getConfig().getSpecimensNum() - 1));
+        ChartDataSource<Number> ys = DataSources.fromNumericCellRange(sheet, new CellRangeAddress(rowNum + 1, rowNum + 1, 0, item.getConfig().getSpecimensNum() - 1));
 
         ScatterChartSeries chartSeries = data.addSerie(xs, ys);
         chartSeries.setTitle("线性回归");
@@ -74,7 +74,7 @@ public class CreateExcelScatterChart {
         }
 //        ((XSSFChart) chart).getCTChart().getPlotArea().getScatterChartArray(0).getSerArray(0).getDPtList().
 
-        for(CTValAx ax: ctChart.getPlotArea().getValAxList()){
+        for (CTValAx ax : ctChart.getPlotArea().getValAxList()) {
             ax.addNewMajorGridlines();
         }
         final CTTrendline trendline = ctChart.getPlotArea().getScatterChartArray(0).getSerArray(0)
@@ -135,8 +135,8 @@ public class CreateExcelScatterChart {
 
         leftAxis.setCrosses(AxisCrosses.AUTO_ZERO);
         bottomAxis.setCrosses(AxisCrosses.AUTO_ZERO);
-        ChartDataSource<Number> xs = DataSources.fromNumericCellRange(sheet, new CellRangeAddress(rowNum, rowNum, 0, item.getConfig().getSpecimensNum()-1));
-        ChartDataSource<Number> ys = DataSources.fromNumericCellRange(sheet, new CellRangeAddress(rowNum+1, rowNum+1, 0, item.getConfig().getSpecimensNum()-1));
+        ChartDataSource<Number> xs = DataSources.fromNumericCellRange(sheet, new CellRangeAddress(rowNum, rowNum, 0, item.getConfig().getSpecimensNum() - 1));
+        ChartDataSource<Number> ys = DataSources.fromNumericCellRange(sheet, new CellRangeAddress(rowNum + 1, rowNum + 1, 0, item.getConfig().getSpecimensNum() - 1));
 
         ScatterChartSeries chartSeries = data.addSerie(xs, ys);
         chartSeries.setTitle("差异图");
@@ -151,7 +151,7 @@ public class CreateExcelScatterChart {
             scatterChartSeries[i].addNewSpPr().addNewLn().addNewNoFill();
         }
 
-        for(CTValAx ax: ctChart.getPlotArea().getValAxList()){
+        for (CTValAx ax : ctChart.getPlotArea().getValAxList()) {
             ax.addNewMajorGridlines();
         }
 

+ 13 - 12
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/excel/PVExcelExportStyler.java

@@ -13,8 +13,8 @@ public class PVExcelExportStyler extends ExcelExportStylerBorderImpl {
 
     protected CellStyle statisticDoubleNumberStyle;
 
-    protected  CellStyle statisticPercentNumberStyle;
-    protected  CellStyle statisticDouble4NumberStyle;
+    protected CellStyle statisticPercentNumberStyle;
+    protected CellStyle statisticDouble4NumberStyle;
 
     public PVExcelExportStyler(Workbook workbook) {
         super(workbook);
@@ -28,16 +28,17 @@ public class PVExcelExportStyler extends ExcelExportStylerBorderImpl {
     }
 
 
-
     public CellStyle getStyles(boolean noneStyler, ExcelExportEntity entity) {
-        if(entity != null  ) {
-            if("input".equals(entity.getKey()))   return inputNumberStyle;
-            if("value".equals(entity.getKey())) return scientificNotationNumberStyle;
-            if("log".equals(entity.getKey())) return doubleNumberStyle;
-            if("statistic".equals(entity.getKey())) return statisticNumberStyle;
-            if("statistic-double".equals(entity.getKey())) return statisticDoubleNumberStyle;
-            if("statistic-double4".equals(entity.getKey())) {return statisticDouble4NumberStyle;}
-            if("statistic-percent".equals(entity.getKey())) return statisticPercentNumberStyle;
+        if (entity != null) {
+            if ("input".equals(entity.getKey())) return inputNumberStyle;
+            if ("value".equals(entity.getKey())) return scientificNotationNumberStyle;
+            if ("log".equals(entity.getKey())) return doubleNumberStyle;
+            if ("statistic".equals(entity.getKey())) return statisticNumberStyle;
+            if ("statistic-double".equals(entity.getKey())) return statisticDoubleNumberStyle;
+            if ("statistic-double4".equals(entity.getKey())) {
+                return statisticDouble4NumberStyle;
+            }
+            if ("statistic-percent".equals(entity.getKey())) return statisticPercentNumberStyle;
         }
         return super.getStyles(noneStyler, entity);
     }
@@ -87,7 +88,7 @@ public class PVExcelExportStyler extends ExcelExportStylerBorderImpl {
         return style;
     }
 
-    private  CellStyle createCellStyle(Workbook workbook){
+    private CellStyle createCellStyle(Workbook workbook) {
         CellStyle style = workbook.createCellStyle();
         style.setBorderLeft(BorderStyle.THIN); // 左边框
         style.setBorderRight(BorderStyle.THIN); // 右边框

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

@@ -24,7 +24,7 @@ public class PVExcelExportTemplateServer extends ExcelExportServer {
         return rows;
     }
 
-    private int createInspectionDateRow(ExportParams title, Sheet sheet,int index, Workbook workbook,int feildWidth) {
+    private int createInspectionDateRow(ExportParams title, Sheet sheet, int index, Workbook workbook, int feildWidth) {
 
         Row row = sheet.createRow(index);
         row.setHeight((short) 450);
@@ -40,5 +40,4 @@ public class PVExcelExportTemplateServer extends ExcelExportServer {
     }
 
 
-
 }

+ 12 - 10
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/excel/PVExcelImportServer.java

@@ -4,7 +4,7 @@ import com.lc.ibps.components.poi.excel.entity.ImportParams;
 import com.lc.ibps.components.poi.excel.entity.params.ExcelCollectionParams;
 import com.lc.ibps.components.poi.excel.entity.result.ExcelImportResult;
 import com.lc.ibps.components.poi.excel.imports.ExcelImportServer;
-import com.lc.ibps.components.verification.model.ExcelSheetRecord;
+import com.lc.ibps.components.verification.model2.ExcelSheetRecord2;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.openxml4j.opc.OPCPackage;
@@ -23,32 +23,33 @@ import java.util.*;
 
 public class PVExcelImportServer extends ExcelImportServer {
     private static final Logger LOGGER = LoggerFactory.getLogger(PVExcelImportServer.class);
+
     public ExcelImportResult importExcelByIs(InputStream inputstream, Class<?> pojoClass, ImportParams params)
             throws Exception {
         if (LOGGER.isInfoEnabled()) {
             LOGGER.info("Excel import start ,class is {}", pojoClass);
         }
-        List<ExcelSheetRecord> result = new ArrayList<ExcelSheetRecord>();
+        List<ExcelSheetRecord2> result = new ArrayList<ExcelSheetRecord2>();
         Workbook book = null;
         boolean isXSSFWorkbook = true;
         if (!(inputstream.markSupported())) {
             inputstream = new PushbackInputStream(inputstream, 8);
         }
-        try{
+        try {
             if (POIFSFileSystem.hasPOIFSHeader(inputstream)) {
                 book = new HSSFWorkbook(inputstream);
                 isXSSFWorkbook = false;
             } else if (DocumentFactoryHelper.hasOOXMLHeader(inputstream)) {
                 book = new XSSFWorkbook(OPCPackage.open(inputstream));
             }
-        }catch (Exception e){
-            book=null;
+        } catch (Exception e) {
+            book = null;
         }
-        if(book==null){
-            try{
+        if (book == null) {
+            try {
                 book = new HSSFWorkbook(inputstream);
                 isXSSFWorkbook = false;
-            }catch (Exception e){
+            } catch (Exception e) {
                 e.printStackTrace();
                 book = new XSSFWorkbook(OPCPackage.open(inputstream));
                 isXSSFWorkbook = true;
@@ -64,7 +65,7 @@ public class PVExcelImportServer extends ExcelImportServer {
                 LOGGER.info(" end to read excel by is ,endTime is {}", new Date().getTime());
             }
             List list = importExcel(result, book.getSheetAt(i), pojoClass, params, null);
-            result.add(new ExcelSheetRecord(book.getSheetAt(i).getSheetName(),list));
+            result.add(new ExcelSheetRecord2(book.getSheetAt(i).getSheetName(), list));
             if (LOGGER.isInfoEnabled()) {
                 LOGGER.info(" end to read excel list by pos ,endTime is {}", new Date().getTime());
             }
@@ -74,6 +75,7 @@ public class PVExcelImportServer extends ExcelImportServer {
         }
         return new ExcelImportResult(result, verfiyFail, book);
     }
+
     protected Map<Integer, String> getTitleMap(Iterator<Row> rows, ImportParams params,
                                                List<ExcelCollectionParams> excelCollection) {
         Map<Integer, String> titlemap = new HashMap<Integer, String>();
@@ -97,7 +99,7 @@ public class PVExcelImportServer extends ExcelImportServer {
                     if (titlemap.containsKey(i)) {
                         collectionName = titlemap.get(i);
                         titlemap.put(i, collectionName + "_" + value);
-                    } else if (StringUtils.isNotEmpty(collectionName) ) {
+                    } else if (StringUtils.isNotEmpty(collectionName)) {
                         titlemap.put(i, collectionName + "_" + value);
                     } else {
                         collectionName = null;

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

@@ -154,7 +154,7 @@ public class PVExcelUtil {
                         sdf = null;
                     }
                 } else {
-                    BigDecimal bd = new BigDecimal(cell.getNumericCellValue());
+                    BigDecimal bd = BigDecimal.valueOf(cell.getNumericCellValue());
                     cellValue = bd.toPlainString();// 数值 这种用BigDecimal包装再获取plainString,可以防止获取到科学计数值
                 }
                 break;
@@ -163,7 +163,6 @@ public class PVExcelUtil {
                 break;
             case Cell.CELL_TYPE_BOOLEAN: // Boolean
                 cellValue = cell.getBooleanCellValue() + "";
-                ;
                 break;
             case Cell.CELL_TYPE_FORMULA: // 公式
                 cellValue = cell.getCellFormula();

+ 50 - 7
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/excel/PVTest.java

@@ -7,6 +7,7 @@ import com.lc.ibps.components.verification.model.FunctionEnum;
 import com.lc.ibps.components.verification.model.InspectionConfigVO;
 import com.lc.ibps.components.verification.model.InspectionItemVO;
 import com.lc.ibps.components.verification.model.InspectionVO;
+import com.lc.ibps.components.verification.model2.PVItemBuilder;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.xssf.usermodel.XSSFChart;
 import org.apache.poi.xssf.usermodel.XSSFDrawing;
@@ -39,6 +40,48 @@ public class PVTest {
 
     }
 
+    @Test
+    public void testExcelTemplateExport2() throws IOException {
+//        InspectionConfigVO config = new InspectionConfigVO("Test2",1,2,
+//                null,20, LocalDate.now(),true);
+//        InspectionConfigVO config = new InspectionConfigVO("线性",1,6,
+//                null,3, LocalDate.now(),true);
+//        InspectionConfigVO config = new InspectionConfigVO("方法比较",1,20,
+//                null,1, LocalDate.now(),true);
+//        config.setMethodNum(2);
+
+//        InspectionConfigVO config = new InspectionConfigVO("EP15-2Aq",5,2,
+//                null,3, LocalDate.now(),true);
+        InspectionConfigVO config = new InspectionConfigVO("EP15-A2定值参考物质验证", 5, 2,
+                null, 2, LocalDate.now(), true);
+        InspectionItemVO item = new InspectionItemVO(config);
+        final Workbook workbook = PVItemBuilder.getInstance(config).exportExcelTemplate();
+        FileOutputStream fos = new FileOutputStream(String.format("C:/tmp/%s.xlsx", config.getName()));
+        workbook.write(fos);
+        fos.close();
+
+    }
+
+    @Test
+    public void testExcelImport2() throws IOException {
+
+//        InspectionConfigVO config = new InspectionConfigVO("EP15-2A",5,2,
+//                null,3, LocalDate.now(),true);
+//        config.setMethodNum(2);
+        InspectionConfigVO config = new InspectionConfigVO("EP15-A2定值参考物质验证", 5, 2,
+                null, 2, LocalDate.now(), true);
+        File file = new File(String.format("C:/tmp/%s.xlsx", config.getName()));
+        FileInputStream in = new FileInputStream(file);
+
+        PVItemBuilder.getInstance(config).importExcelRecord(in);
+
+
+        System.out.println(config);
+//        for(Map<String, Object> d : list)
+//            System.out.println(d);
+
+    }
+
     @Test
     public void testExcelTemplateExport() throws IOException {
 //        InspectionConfigVO config = new InspectionConfigVO("批间精密度",5,2,
@@ -49,8 +92,8 @@ public class PVTest {
 
 //        InspectionConfigVO config = new InspectionConfigVO("线性范围", 1, 7,
 //                new String[]{"E8", "E7", "E6", "E5", "E4", "E3", "E2"}, 3, LocalDate.now(), true);
-        InspectionConfigVO config = new InspectionConfigVO("EP15-2A",5,2,
-                new String[]{"L2","L4"},3, LocalDate.now(),true);
+        InspectionConfigVO config = new InspectionConfigVO("EP15-2A", 5, 2,
+                new String[]{"L2", "L4"}, 3, LocalDate.now(), true);
         InspectionItemVO item = new InspectionItemVO(config);
         Workbook workbook = item.exportExcelTemplate();
         FileOutputStream fos = new FileOutputStream(String.format("C:/tmp/%s.xlsx", config.getName()));
@@ -69,11 +112,11 @@ public class PVTest {
 //        File file = new File(String.format("C:/tmp/%sdata.xlsx",config.getName()));
 //        FileInputStream in = new FileInputStream(file);
 //        item.importExcelRecord(in);
-        InspectionConfigVO config = new InspectionConfigVO("EP15-2A",5,2,
-                new String[]{"L2","L4"},3, LocalDate.now(),false);
-                config.setFunc(new FunctionEnum[]{FunctionEnum.AVERAGE,FunctionEnum.SD,FunctionEnum.CV});
+        InspectionConfigVO config = new InspectionConfigVO("EP15-2A", 5, 2,
+                new String[]{"L2", "L4"}, 3, LocalDate.now(), false);
+        config.setFunc(new FunctionEnum[]{FunctionEnum.AVERAGE, FunctionEnum.SD, FunctionEnum.CV});
         InspectionItemVO item = new InspectionItemVO(config);
-        File file = new File(String.format("C:/tmp/%sdata.xlsx",config.getName()));
+        File file = new File(String.format("C:/tmp/%sdata.xlsx", config.getName()));
         FileInputStream in = new FileInputStream(file);
         item.importExcelRecord(in);
         //批内精密度
@@ -113,7 +156,7 @@ public class PVTest {
 //        vo.getItem().add(item2);
 //        vo.getItem().add(item3);
 //        vo.getItem().add(item4);
-        final String s = JSONObject.toJSONString(item,SerializerFeature.PrettyFormat,SerializerFeature.DisableCircularReferenceDetect);
+        final String s = JSONObject.toJSONString(item, SerializerFeature.PrettyFormat, SerializerFeature.DisableCircularReferenceDetect);
         InspectionVO voJson = JSON.parseObject(s, InspectionVO.class);
 
         System.out.println(s);

+ 96 - 0
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/excel/strategy/AbstractTemplateStrategy.java

@@ -0,0 +1,96 @@
+package com.lc.ibps.components.verification.excel.strategy;
+
+import com.lc.ibps.components.poi.excel.entity.ExportParams;
+import com.lc.ibps.components.poi.excel.entity.enmus.ExcelType;
+import com.lc.ibps.components.poi.excel.entity.params.ExcelExportEntity;
+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.model.ExcelParserErrorEnum;
+import com.lc.ibps.components.verification.model.InspectionConfigVO;
+import com.lc.ibps.components.verification.model2.ExcelSheetRecord2;
+import org.apache.poi.ss.usermodel.Workbook;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public abstract class AbstractTemplateStrategy implements TemplateStrategy {
+
+    protected InspectionConfigVO config;
+
+
+    public AbstractTemplateStrategy(InspectionConfigVO config) {
+        this.config = config;
+    }
+
+    public abstract void buildTemplateHeader(List<ExcelExportEntity> entity);
+
+    public abstract void buildTemplateData(List<Map<String, Object>> list);
+
+    @Override
+    public Workbook buildTemplate() {
+        List<ExcelExportEntity> entity = new ArrayList<ExcelExportEntity>();
+        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
+
+        buildTemplateHeader(entity);
+        buildTemplateData(list);
+
+        ExportParams exportParams = new ExportParams(config.getName() + " 数据导入模板", config.getName());
+        exportParams.setStyle(PVExcelExportStyler.class);
+        exportParams.setType(ExcelType.XSSF);
+
+        Workbook workbook = PVExcelUtil.exportExcel(exportParams, entity, list);
+
+        return workbook;
+    }
+
+    @Override
+    public double[][] parseData(ExcelSheetRecord2 record) {
+        final List<Map> data = record.getData();
+        if (!config.getName().equals(record.getSheetName())) {
+            record.getErrors().add(ExcelParserErrorEnum.IncorrectSheetName.getText());
+            return null;
+        }
+
+        int row = getRowNum();
+        int col = getColumnNum();
+
+        if (data.size() < row) {
+            record.getErrors().add(ExcelParserErrorEnum.RowLess.getText());
+            return null;
+        }
+        double[][] convertedData = new double[row][col];
+        record.setConvertedData(convertedData);
+        for (int i = 0; i < row; i++) {
+            Map<String, Object> map = data.get(i);
+            int num = 0;
+            for (String colName : getColumnNames()) {
+                convertObject(record, map.get(colName), i, num++);
+            }
+        }
+        return record.getConvertedData();
+    }
+
+    private void convertObject(ExcelSheetRecord2 record, Object val, int row, int col) {
+        xValue value = new xValue(val);
+        if (value.isBlank()) {
+            record.getErrors().add(String.format(ExcelParserErrorEnum.ValueBlank.getText(), record.getSheetName(), row + 1, col + 1));
+        } else if (!value.isDoub()) {
+            record.getErrors().add(String.format(ExcelParserErrorEnum.ValueNotDouble.getText(), record.getSheetName(), row + 1, col + 1));
+        } else {
+            record.getConvertedData()[row][col] = value.getDoub();
+        }
+    }
+
+    public String[] buildColumnNames(String[] r1, int repeatNum) {
+        String[] n = new String[r1.length * repeatNum];
+        int num = 0;
+        for (String name : r1) {
+            for (int i = 1; i <= repeatNum; i++) {
+                n[num++] = String.format("%s_重复 %d", name, i);
+            }
+        }
+        return n;
+    }
+}

+ 61 - 0
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/excel/strategy/LinearRangeStrategy.java

@@ -0,0 +1,61 @@
+package com.lc.ibps.components.verification.excel.strategy;
+
+import com.lc.ibps.components.poi.excel.entity.params.ExcelExportEntity;
+import com.lc.ibps.components.verification.model.InspectionConfigVO;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class LinearRangeStrategy extends AbstractTemplateStrategy implements TemplateStrategy {
+    public LinearRangeStrategy(InspectionConfigVO config) {
+        super(config);
+    }
+
+    @Override
+    public void buildTemplateHeader(List<ExcelExportEntity> entity) {
+        //just using Specimens num and repeat num
+        ExcelExportEntity e1 = new ExcelExportEntity(DISPLAY_ITEMNUM, "number");
+        entity.add(e1);
+        for (int j = 1; j <= config.getRepeatNum(); j++) {
+            ExcelExportEntity cEntity = new ExcelExportEntity(String.format("重复 %d", j), "input");
+            entity.add(cEntity);
+        }
+
+    }
+
+    @Override
+    public void buildTemplateData(List<Map<String, Object>> list) {
+        Map<String, Object> map;
+        for (int j = 0; j < config.getSpecimensNum(); j++) {
+            map = new HashMap();
+            map.put("number", config.getSpecimensName()[j]);
+            list.add(map);
+        }
+    }
+
+    @Override
+    public int getRowNum() {
+        return config.getSpecimensNum();
+    }
+
+    @Override
+    public int getColumnNum() {
+        return config.getRepeatNum();
+    }
+
+    @Override
+    public String[] getColumnNames() {
+        String[] n = new String[config.getRepeatNum()];
+        int num = 0;
+        for (int i = 1; i <= config.getRepeatNum(); i++) {
+            n[num++] = String.format("重复 %d", i);
+        }
+        return n;
+    }
+
+    @Override
+    public int getHeadRows() {
+        return 1;
+    }
+}

+ 60 - 0
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/excel/strategy/MethodStrategy.java

@@ -0,0 +1,60 @@
+package com.lc.ibps.components.verification.excel.strategy;
+
+import com.lc.ibps.components.poi.excel.entity.params.ExcelExportEntity;
+import com.lc.ibps.components.verification.model.InspectionConfigVO;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class MethodStrategy extends AbstractTemplateStrategy implements TemplateStrategy {
+    public MethodStrategy(InspectionConfigVO config) {
+        super(config);
+    }
+
+    @Override
+    public void buildTemplateHeader(List<ExcelExportEntity> entity) {
+        //TODO: only support repeat num =1
+        ExcelExportEntity e1 = new ExcelExportEntity(DISPLAY_ITEMNUM, "number");
+        entity.add(e1);
+        for (int j = 0; j < config.getMethodNum(); j++) {
+            ExcelExportEntity cEntity = new ExcelExportEntity(config.getMethodName()[j], "input");
+            entity.add(cEntity);
+        }
+
+    }
+
+    @Override
+    public void buildTemplateData(List<Map<String, Object>> list) {
+        Map<String, Object> map;
+        for (int j = 1; j <= config.getSpecimensNum(); j++) {
+            map = new HashMap();
+            map.put("number", j);
+            list.add(map);
+        }
+    }
+
+
+    @Override
+    public int getRowNum() {
+        return config.getSpecimensNum();
+    }
+
+    @Override
+    public int getColumnNum() {
+        return config.getMethodNum() * config.getRepeatNum();
+    }
+
+    @Override
+    public String[] getColumnNames() {
+        if (config.getRepeatNum() == 1) {
+            return config.getMethodName();
+        }
+        return buildColumnNames(config.getSpecimensName(), config.getRepeatNum());
+    }
+
+    @Override
+    public int getHeadRows() {
+        return config.getRepeatNum() == 1 ? 1 : 2;
+    }
+}

+ 83 - 0
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/excel/strategy/MultiDayStrategy.java

@@ -0,0 +1,83 @@
+package com.lc.ibps.components.verification.excel.strategy;
+
+import com.lc.ibps.components.poi.excel.entity.params.ExcelExportEntity;
+import com.lc.ibps.components.verification.model.InspectionConfigVO;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class MultiDayStrategy extends AbstractTemplateStrategy implements TemplateStrategy {
+
+    public MultiDayStrategy(InspectionConfigVO config) {
+        super(config);
+    }
+
+
+    @Override
+    public void buildTemplateHeader(List<ExcelExportEntity> entity) {
+        //EP 15
+        ExcelExportEntity e1 = new ExcelExportEntity(DISPLAY_DATE, "t_date");
+        entity.add(e1);
+        for (int i = 0; i < config.getSpecimensNum(); i++) {
+            ExcelExportEntity e2;
+            if (config.getRepeatNum() > 1) {
+                e2 = new ExcelExportEntity(config.getSpecimensName()[i], String.format("inspection%d", i));
+                List<ExcelExportEntity> child = new ArrayList<ExcelExportEntity>();
+                for (int j = 1; j <= config.getRepeatNum(); j++) {
+                    ExcelExportEntity cEntity = new ExcelExportEntity(String.format("重复 %d", j), "input");
+                    child.add(cEntity);
+                }
+                e2.setList(child);
+            } else {
+                e2 = new ExcelExportEntity(config.getSpecimensName()[i], "input");
+
+            }
+            entity.add(e2);
+        }
+    }
+
+    @Override
+    public void buildTemplateData(List<Map<String, Object>> list) {
+        Map<String, Object> map;
+        for (int i = 1; i <= config.getDays(); i++) {
+            map = new HashMap();
+            map.put("t_date", String.format("第 %d 天", i));
+            if (config.getRepeatNum() > 1) {
+                for (int ii = 0; ii < config.getSpecimensNum(); ii++) {
+                    List<Map<String, Object>> tempList = new ArrayList();
+                    tempList.add(map);
+                    for (int j = 1; j <= config.getRepeatNum(); j++) {
+                        map.put(String.format("inspection%d", ii), tempList);
+                    }
+                }
+            }
+            list.add(map);
+        }
+    }
+
+    @Override
+    public int getRowNum() {
+        return config.getDays();
+    }
+
+    @Override
+    public int getColumnNum() {
+        return config.getSpecimensNum() * config.getRepeatNum();
+    }
+
+    @Override
+    public String[] getColumnNames() {
+        if (config.getRepeatNum() == 1) {
+            return config.getSpecimensName();
+        }
+        return buildColumnNames(config.getSpecimensName(), config.getRepeatNum());
+    }
+
+    @Override
+    public int getHeadRows() {
+        return config.getRepeatNum() == 1 ? 1 : 2;
+    }
+
+}

+ 25 - 0
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/excel/strategy/TemplateStrategy.java

@@ -0,0 +1,25 @@
+package com.lc.ibps.components.verification.excel.strategy;
+
+import com.lc.ibps.components.verification.model2.ExcelSheetRecord2;
+import org.apache.poi.ss.usermodel.Workbook;
+
+public interface TemplateStrategy {
+    String DISPLAY_NUMBER = "次数";
+    String DISPLAY_VALUE = "检测值";
+
+    String DISPLAY_ITEMNUM = "样本编号";
+
+    String DISPLAY_DATE = "实验日期";
+
+    Workbook buildTemplate();
+
+    double[][] parseData(ExcelSheetRecord2 record);
+
+    int getRowNum();
+
+    int getColumnNum();
+
+    String[] getColumnNames();
+
+    int getHeadRows();
+}

+ 13 - 13
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/funcs/TestFuncs.java

@@ -9,9 +9,9 @@ import java.util.Arrays;
 
 public class TestFuncs {
     @Test
-    public  void test(){
-        double[] cNode11 = {25.30 ,28.40 ,32.50 ,36.90 ,42.70 ,49.80 ,55.10 ,62.30 ,65.40 ,69.70 ,85.40 ,89.60 ,91.30 ,99.40 ,105.60 ,135.40 ,162.40 ,173.40 ,184.50 ,192.60 ,203.60 ,219.80 ,235.60 ,233.70 ,216.90 ,265.80 ,272.60 ,288.80 ,294.60 ,309.40 ,335.60 ,356.40 ,342.90 ,365.70 ,385.40 ,376.30 ,402.00 ,415.00 ,426.90 ,468.0};
-        double[] cNode21 = {26.40 ,29.30 ,33.50 ,35.90 ,43.10 ,50.90 ,56.80 ,63.40 ,62.70 ,72.40 ,88.10 ,90.30 ,90.60 ,98.40 ,102.70 ,130.60 ,165.90 ,170.60 ,186.50 ,199.40 ,203.50 ,220.70 ,234.90 ,236.70 ,210.90 ,270.10 ,276.40 ,290.00 ,298.00 ,310.00 ,339.00 ,354.00 ,343.00 ,369.00 ,387.00 ,372.00 ,404.00 ,416.00 ,429.00 ,470.00};
+    public void test() {
+        double[] cNode11 = {25.30, 28.40, 32.50, 36.90, 42.70, 49.80, 55.10, 62.30, 65.40, 69.70, 85.40, 89.60, 91.30, 99.40, 105.60, 135.40, 162.40, 173.40, 184.50, 192.60, 203.60, 219.80, 235.60, 233.70, 216.90, 265.80, 272.60, 288.80, 294.60, 309.40, 335.60, 356.40, 342.90, 365.70, 385.40, 376.30, 402.00, 415.00, 426.90, 468.0};
+        double[] cNode21 = {26.40, 29.30, 33.50, 35.90, 43.10, 50.90, 56.80, 63.40, 62.70, 72.40, 88.10, 90.30, 90.60, 98.40, 102.70, 130.60, 165.90, 170.60, 186.50, 199.40, 203.50, 220.70, 234.90, 236.70, 210.90, 270.10, 276.40, 290.00, 298.00, 310.00, 339.00, 354.00, 343.00, 369.00, 387.00, 372.00, 404.00, 416.00, 429.00, 470.00};
         xValue[] cNode1 = convert(cNode11);
         xValue[] cNode2 = convert(cNode21);
         xValue xValue = xAverage.eval(cNode1);
@@ -24,29 +24,29 @@ public class TestFuncs {
         System.out.println(xValue1.getDoub());
         System.out.println(xValue2.getDoub());
         DescriptiveStatistics stats = new DescriptiveStatistics(cNode11);
-        System.out.println("dfe:"+stats.getStandardDeviation());
-        xValue b = xFuncArray2Args.evalArgs(cNode2,cNode1,  xFuncArray2Args.iSLOPE);
+        System.out.println("dfe:" + stats.getStandardDeviation());
+        xValue b = xFuncArray2Args.evalArgs(cNode2, cNode1, xFuncArray2Args.iSLOPE);
         System.out.println(b.getDoub());
 
-        xValue a = xFuncArray2Args.evalArgs(cNode2,cNode1,  xFuncArray2Args.iINTERCEPT);
+        xValue a = xFuncArray2Args.evalArgs(cNode2, cNode1, xFuncArray2Args.iINTERCEPT);
         System.out.println(a.getDoub());
 
-        xValue r = xFuncArray2Args.evalArgs(cNode2,cNode1,  xFuncArray2Args.iCORREL);
-        System.out.println(r.getDoub()*r.getDoub());
-         PolynomialRegression po = new PolynomialRegression();
+        xValue r = xFuncArray2Args.evalArgs(cNode2, cNode1, xFuncArray2Args.iCORREL);
+        System.out.println(r.getDoub() * r.getDoub());
+        PolynomialRegression po = new PolynomialRegression();
         po.addData(cNode11, cNode21, 1, 1);
 
-        System.out.println("R方为"+ po.getRSquared());
-        System.out.println("调整R方为"+ po.getAdjRSquared());
+        System.out.println("R方为" + po.getRSquared());
+        System.out.println("调整R方为" + po.getAdjRSquared());
         System.out.println(po.getFunction());
         System.out.println("标准误为:" + Arrays.toString(po.getStdErrors()));
 
-        System.out.println("f值:" + po.getFValue() );
+        System.out.println("f值:" + po.getFValue());
 //        System.out.println("f检验P值:" + StatisticsUtil.getPValue(po.getFValue(), 3, yArray.length - 4));
 
     }
 
-    public static xValue[] convert(double[] data){
+    public static xValue[] convert(double[] data) {
         xValue[] c = new xValue[data.length];
         for (int i = 0; i < data.length; i++) {
             c[i] = new xValue(data[i]);

+ 4 - 2
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/funcs/xAverage.java

@@ -3,13 +3,15 @@ package com.lc.ibps.components.verification.funcs;
 public class xAverage {
 
 
-    /** AVERAGEs n ranges. */
+    /**
+     * AVERAGEs n ranges.
+     */
     public static xValue eval(xValue[] cNod) {
         xValue valRes = new xValue();
         try {
             int iCnt = 0;
             double dSum = 0;
-            xValue val ;
+            xValue val;
             for (int ii = cNod.length; --ii >= 0; ) {
                 val = cNod[ii];
                 dSum += val.getDoub();

+ 4 - 3
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/funcs/xFuncArray2Args.java

@@ -14,9 +14,10 @@ public class xFuncArray2Args implements Serializable {
     /**
      * Generic function that helps calculate a function with 2 array arguments,
      * like COVAR, CORREL, etc.
-     * @param cNod    the result node
-     * @param iFunc   the calling function (0=COVAR, etc)
-     * @return        true if the node has been evaluated successfully
+     *
+     * @param cNod  the result node
+     * @param iFunc the calling function (0=COVAR, etc)
+     * @return true if the node has been evaluated successfully
      */
     //We may want redo this method in the future in order to make it clearer.
     public static xValue evalArgs(xValue[] cNod1, xValue[] cNod2, int iFunc) {

+ 4 - 3
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/funcs/xFuncStdevVar.java

@@ -15,9 +15,10 @@ public class xFuncStdevVar implements Serializable {
     /**
      * Generic function that helps calculate a function with 1+ arguments,
      * The arguments could be 1 or more.
-     * @param cNod    the result node
-     * @param iFunc   the calling function (0=STDEV, etc)
-     * @return        true if the node has been evaluated successfully
+     *
+     * @param cNod  the result node
+     * @param iFunc the calling function (0=STDEV, etc)
+     * @return true if the node has been evaluated successfully
      */
     //We may want redo this method in the future in order to make it clearer.
     public static xValue evalArgs(xValue[] cNod, int iFunc) {

+ 5 - 3
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/funcs/xLog10.java

@@ -1,11 +1,13 @@
 package com.lc.ibps.components.verification.funcs;
 
 public class xLog10 {
-    /** Does the actual operation. */
+    /**
+     * Does the actual operation.
+     */
     public static xValue[] eval(xValue[] data) {
         xValue[] convert = new xValue[data.length];
-        for(int i = 0 ; i< data.length; i++) {
-            if(!data[i].isDoub()){
+        for (int i = 0; i < data.length; i++) {
+            if (!data[i].isDoub()) {
                 convert[i] = new xValue();
                 convert[i].setErrVal();
             }

+ 68 - 47
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/funcs/xValue.java

@@ -28,7 +28,9 @@ public class xValue implements Serializable {
     private static final String sERRREF = "#REF!";
     private static final String sERRVALUE = "#VALUE!";
 
-    /** @deprecated - this attribute is OBFUSCATED for clients. Replace the start of this line for developer javadocs. */
+    /**
+     * @deprecated - this attribute is OBFUSCATED for clients. Replace the start of this line for developer javadocs.
+     */
     public static final String sERRGEN = "#ERROR!";
 
     //Attributes
@@ -37,23 +39,27 @@ public class xValue implements Serializable {
     private Object valObj = null;  //Originally this was a String declaration
 
     //============SET METHOD SECTION============
-    public xValue(){}
+    public xValue() {
+    }
+
     public xValue(Object valObj) {
-        if(valObj != null) {
+        if (valObj != null) {
             if (valObj instanceof Number) {
                 this.iType = iDOUBLE;
                 this.valDoub = ((Number) valObj).doubleValue();
             }
-            setValFormat(valObj.toString(),true);
+            setValFormat(valObj.toString(), true);
         }
     }
+
     public xValue(double valDoub) {
         setVal(valDoub);
     }
 
     /**
      * Stores the attributes of valX
-     * @param valX  the value to store
+     *
+     * @param valX the value to store
      */
     public void setVal(xValue valX) {
         iType = valX.iType;
@@ -68,7 +74,8 @@ public class xValue implements Serializable {
 
     /**
      * Stores the double, valD
-     * @param valD  the double to store
+     *
+     * @param valD the double to store
      */
     public void setVal(double valD) {
         if (Double.isNaN(valD)) {
@@ -81,7 +88,8 @@ public class xValue implements Serializable {
 
     /**
      * Stores the boolean, valB
-     * @param valB  the boolean to store
+     *
+     * @param valB the boolean to store
      */
     public void setVal(boolean valB) {
         iType = iBOOLEAN;
@@ -90,7 +98,8 @@ public class xValue implements Serializable {
 
     /**
      * Stores the String, valS
-     * @param valS  the String to store
+     *
+     * @param valS the String to store
      */
     public void setVal(String valS) {
         iType = iSTRING;
@@ -98,10 +107,10 @@ public class xValue implements Serializable {
     }
 
 
-
     /**
      * Stores the Object, valO
-     * @param valO  the Object to store
+     *
+     * @param valO the Object to store
      */
     public void setVal(Object valO) {
         iType = iOBJECT;
@@ -112,7 +121,8 @@ public class xValue implements Serializable {
      * Formats and stores a String in the xValue.
      * If valS can be converted into a double, date or boolean,
      * it is stored as such, with all non-numeric symbols removed.
-     * @param valS  the String to format and store
+     *
+     * @param valS the String to format and store
      */
     public void setValFormat(String valS) {
         setValFormat(valS, false);
@@ -122,8 +132,9 @@ public class xValue implements Serializable {
      * Formats and stores a String in the xValue.
      * If valS can be converted into a double, date or boolean,
      * it is stored as such, with all non-numeric symbols removed.
-     * @param valS    the String to format and store
-     * @param bNull   if TRUE, empty strings are set to null
+     *
+     * @param valS  the String to format and store
+     * @param bNull if TRUE, empty strings are set to null
      */
     public void setValFormat(String valS, boolean bNull) {
         //****Needs Work****
@@ -190,7 +201,8 @@ public class xValue implements Serializable {
      * Returns the double equivalent of current object.
      * If object can be converted into a double, it is returned as such,
      * with all non-numeric symbols removed.
-     * @return  the double equivalent
+     *
+     * @return the double equivalent
      */
     public double getDoub() {
         //****Needs Work****
@@ -203,7 +215,7 @@ public class xValue implements Serializable {
             } else {
                 return getDoubFromStr(sBuff);
             }
-        }  else {
+        } else {
             return 0;
         }
     }
@@ -211,7 +223,8 @@ public class xValue implements Serializable {
     /**
      * Returns the boolean equivalent of current object.
      * If object can be converted into a boolean, it is returned as such.
-     * @return  the boolean equivalent
+     *
+     * @return the boolean equivalent
      */
     public boolean getBool() {
         if ((iType == iDOUBLE) || (iType == iBOOLEAN)) {
@@ -227,14 +240,15 @@ public class xValue implements Serializable {
             } else {
                 throw new NumberFormatException();
             }
-        }  else {
+        } else {
             return false;
         }
     }
 
     /**
      * Returns the String representation of current object.
-     * @return  the String equivalent
+     *
+     * @return the String equivalent
      */
     public String getStr() {
         if (iType == iDOUBLE) {
@@ -262,7 +276,7 @@ public class xValue implements Serializable {
             }
         } else if (iType == iNULL) {
             return "";
-        }  else if (iType == iOBJECT) {
+        } else if (iType == iOBJECT) {
             return valObj.toString();
         } else {
             return getStrErr();
@@ -272,7 +286,8 @@ public class xValue implements Serializable {
 
     /**
      * Returns the current object.
-     * @return  the object
+     *
+     * @return the object
      */
     public Object getObj() {
         if (iType == iOBJECT) {
@@ -294,7 +309,8 @@ public class xValue implements Serializable {
 
     /**
      * Returns TRUE if the object is of type double.
-     * @return  TRUE if double
+     *
+     * @return TRUE if double
      */
     public boolean isDoub() {
         return iType == iDOUBLE;
@@ -302,7 +318,8 @@ public class xValue implements Serializable {
 
     /**
      * Returns TRUE if the object is of type String.
-     * @return  TRUE if String
+     *
+     * @return TRUE if String
      */
     public boolean isStr() {
         return (iType == iSTRING) || (iType == iNULL);
@@ -310,7 +327,8 @@ public class xValue implements Serializable {
 
     /**
      * Returns TRUE if the object is of really String (ie not NULL) - used for ISTEXT function.
-     * @return  TRUE if String
+     *
+     * @return TRUE if String
      */
     public boolean isStrReally() {
         return (iType == iSTRING);
@@ -318,7 +336,8 @@ public class xValue implements Serializable {
 
     /**
      * Returns TRUE if the object is of type boolean.
-     * @return  TRUE if boolean
+     *
+     * @return TRUE if boolean
      */
     public boolean isBool() {
         return iType == iBOOLEAN;
@@ -326,7 +345,8 @@ public class xValue implements Serializable {
 
     /**
      * Returns TRUE if the object is of type reference.
-     * @return  TRUE if reference
+     *
+     * @return TRUE if reference
      */
     public boolean isRef() {
         return iType == iREF;
@@ -334,7 +354,8 @@ public class xValue implements Serializable {
 
     /**
      * Returns TRUE if the object is of type Object.
-     * @return  TRUE if Object
+     *
+     * @return TRUE if Object
      */
     public boolean isObj() {
         return iType == iOBJECT;
@@ -346,7 +367,8 @@ public class xValue implements Serializable {
      * Stores the Error related attributes of valX in current object.
      * This is similar to setVal(xValue valX), only valX is known to
      * contain an error.  It is provided for optimization purposes.
-     * @param valX  the error
+     *
+     * @param valX the error
      */
     public void setValErr(xValue valX) {
         iType = valX.iType;
@@ -413,7 +435,8 @@ public class xValue implements Serializable {
 
     /**
      * Returns TRUE if the current value is an error.
-     * @return  TRUE if error
+     *
+     * @return TRUE if error
      */
     public boolean isErr() {
         return iType > iNOERR;
@@ -421,7 +444,8 @@ public class xValue implements Serializable {
 
     /**
      * Returns TRUE if the current value is an error, but not a #N/A error.
-     * @return  TRUE if non-#N/A error
+     *
+     * @return TRUE if non-#N/A error
      */
     public boolean isErrButNA() {
         return (iType > iNOERR && iType != iERRNA);
@@ -429,7 +453,8 @@ public class xValue implements Serializable {
 
     /**
      * Returns the String representation of the Error.
-     * @return  the string error
+     *
+     * @return the string error
      */
     public String getStrErr() {
         if (iType == iERRDIV) {
@@ -453,26 +478,20 @@ public class xValue implements Serializable {
 
     /**
      * Returns TRUE if the current value is a blank or null value.
-     * @return  TRUE if blank
+     *
+     * @return TRUE if blank
      */
     public boolean isBlank() {
-        if ((iType == iNULL) || (iType == iSTRING && (((String) valObj).length() == 0))) {
-            return true;
-        } else {
-            return false;
-        }
+        return (iType == iNULL) || (iType == iSTRING && (((String) valObj).length() == 0));
     }
 
     /**
      * Returns TRUE if the current value is a null value.
-     * @return  TRUE if null
+     *
+     * @return TRUE if null
      */
     public boolean isEmptyString() {
-        if ((iType == iSTRING) && (((String) valObj).length() == 0)) {
-            return true;
-        } else {
-            return false;
-        }
+        return (iType == iSTRING) && (((String) valObj).length() == 0);
     }
 
     //============GET TYPE METHOD SECTION============
@@ -480,7 +499,8 @@ public class xValue implements Serializable {
     /**
      * Returns an int value representing the type of value stored
      * in the current object.
-     * @return  the type
+     *
+     * @return the type
      */
     public byte getTyp() {
         return iType;
@@ -490,8 +510,9 @@ public class xValue implements Serializable {
 
     /**
      * Returns a double from a string - if possible
-     * @param sTemp   the string
-     * @return        the double
+     *
+     * @param sTemp the string
+     * @return the double
      */
     private double getDoubFromStr(String sOrig) {
         sOrig = sOrig.trim();
@@ -555,7 +576,7 @@ public class xValue implements Serializable {
                 sb.append(chr);
             } else if (chr == ',') {
                 //Look ahead
-                if (!Character.isDigit(sOrig.charAt(ii + 1)) ||!Character.isDigit(sOrig.charAt(ii + 2)) ||!Character.isDigit(sOrig.charAt(ii + 3))) {
+                if (!Character.isDigit(sOrig.charAt(ii + 1)) || !Character.isDigit(sOrig.charAt(ii + 2)) || !Character.isDigit(sOrig.charAt(ii + 3))) {
                     bNum = false;
                 }
             } else {
@@ -571,7 +592,7 @@ public class xValue implements Serializable {
                 if (bNeg) {
                     sOrig = "000" + sb.toString().substring(1);
                 } else {
-                    sOrig = "000" + sb.toString();
+                    sOrig = "000" + sb;
                 }
 
                 int iDec = sOrig.indexOf(".");

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

@@ -3,8 +3,8 @@ package com.lc.ibps.components.verification.model;
 public enum ExcelParserErrorEnum {
     IncorrectSheetName("未找到此工作表。"),
     RowLess("工作表中数据条数不够。"),
-    ValueNotDouble("%s: 第%s次检测数据不是数字类型。"),
-    ValueBlank("%s: 第%s次检测数据为空。");
+    ValueNotDouble("%s: 黄色填写区域第%d行,第%d列的检测数据不是数字类型。"),
+    ValueBlank("%s: 黄色填写区域第%d行,第%d列的检测数据为空。");
     private String text;
 
     ExcelParserErrorEnum(String text) {

+ 9 - 9
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/ExcelSheetRecord.java

@@ -9,12 +9,12 @@ import java.util.Map;
 
 public class ExcelSheetRecord {
 
-    private String sheetName;
-    private List<Map> data;
+    private final String sheetName;
+    private final List<Map> data;
     //标本名称:检测值
     private Map<String, xValue[]> convertedData;
 
-    private List<String> errors = new ArrayList<>();
+    private final List<String> errors = new ArrayList<>();
 
     public ExcelSheetRecord(String sheetName, List<Map> data) {
         this.sheetName = sheetName;
@@ -28,7 +28,7 @@ public class ExcelSheetRecord {
     public void convert(InspectionConfigVO config, String configSheetName) {
         convertedData = new HashMap<>();
 
-        if(!configSheetName.equals(sheetName)){
+        if (!configSheetName.equals(sheetName)) {
             errors.add(ExcelParserErrorEnum.IncorrectSheetName.getText());
             return;
         }
@@ -45,11 +45,11 @@ public class ExcelSheetRecord {
 //                Object val = map.get(sName + "_" + InspectionItemVO.DISPLAY_VALUE);
                 Object val = map.get(sName);
                 xValue value = new xValue(val);
-                if(value.isBlank()){
-                    errors.add(String.format(ExcelParserErrorEnum.ValueBlank.getText(),sName,i+1));
-                }else if(!value.isDoub()){
-                    errors.add(String.format(ExcelParserErrorEnum.ValueNotDouble.getText(),sName,i+1));
-                }else {
+                if (value.isBlank()) {
+                    errors.add(String.format(ExcelParserErrorEnum.ValueBlank.getText(), sName, i + 1));
+                } else if (!value.isDoub()) {
+                    errors.add(String.format(ExcelParserErrorEnum.ValueNotDouble.getText(), sName, i + 1));
+                } else {
                     convertedData.get(sName)[i] = value;
                 }
             }

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

@@ -12,7 +12,7 @@ public enum FunctionEnum {
     R("相关系数(r)"),
     RVALUE("R值"),//检测均值/预期值×100%
     LRE("线性回归方程");
-    private String text;
+    private final String text;
 
     FunctionEnum(String text) {
         this.text = text;

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

@@ -1,5 +1,7 @@
 package com.lc.ibps.components.verification.model;
 
+import org.apache.commons.lang3.ArrayUtils;
+
 import java.time.LocalDate;
 
 public class InspectionConfigVO extends ConfigVO {
@@ -22,11 +24,17 @@ public class InspectionConfigVO extends ConfigVO {
     private FunctionEnum[] func;
 
     private double[] targetValue;
-    public InspectionConfigVO(){
+
+    private int methodNum = 1;
+
+    private String[] methodName = {"Y", "X"};
+
+    public InspectionConfigVO() {
 
     }
+
     public InspectionConfigVO(String name, int days, int specimensNum, String[] specimensName,
-                              int repeatNum, LocalDate startDate,boolean isConvert) {
+                              int repeatNum, LocalDate startDate, boolean isConvert) {
         this.name = name;
         this.days = days;
         this.specimensNum = specimensNum;
@@ -34,6 +42,13 @@ public class InspectionConfigVO extends ConfigVO {
         this.repeatNum = repeatNum;
         this.startDate = startDate;
         this.isConvert = isConvert;
+        if (ArrayUtils.isEmpty(this.specimensName)) {
+            String[] names = new String[this.specimensNum];
+            for (int i = 0; i < this.specimensNum; i++) {
+                names[i] = String.format("水平 %d", i + 1);
+            }
+            this.specimensName = names;
+        }
     }
 
     public InspectionConfigVO(String name, int days, int specimensNum, String[] specimensName, int repeatNum,
@@ -131,4 +146,20 @@ public class InspectionConfigVO extends ConfigVO {
     public void setUnits(String units) {
         this.units = units;
     }
+
+    public int getMethodNum() {
+        return methodNum;
+    }
+
+    public void setMethodNum(int methodNum) {
+        this.methodNum = methodNum;
+    }
+
+    public String[] getMethodName() {
+        return methodName;
+    }
+
+    public void setMethodName(String[] methodName) {
+        this.methodName = methodName;
+    }
 }

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

@@ -50,13 +50,15 @@ public class InspectionItemVO {
     @JSONField(serialize = false)
     private boolean dataPass = false;
     @JSONField(serialize = false)
-    private Map<String, List<String>> errorMessage = new HashMap<>();
-    public InspectionItemVO(InspectionConfigVO config,Map<String, double[]> data){
+    private final Map<String, List<String>> errorMessage = new HashMap<>();
+
+    public InspectionItemVO(InspectionConfigVO config, Map<String, double[]> data) {
         this.config = config;
         this.dataPass = true;
         setData(data);
         buildItemCalcVO();
     }
+
     public InspectionItemVO(InspectionConfigVO config) {
         this.config = config;
     }
@@ -92,9 +94,9 @@ public class InspectionItemVO {
             list.add(map);
         }
         List<ExportParams> exportParamsList = new ArrayList<ExportParams>();
-        for (int i = 1; i < config.getDays()+1; i++) {
-            String sheetName = String.format("第 %d 天",i);
-            if(config.getDays() == 1){
+        for (int i = 1; i < config.getDays() + 1; i++) {
+            String sheetName = String.format("第 %d 天", i);
+            if (config.getDays() == 1) {
                 sheetName = config.getName();
             }
             ExportParams exportParams = new ExportParams(config.getName() + " 数据导入模板", sheetName);
@@ -184,8 +186,8 @@ public class InspectionItemVO {
         List<ExcelSheetRecord> list = PVExcelUtil.importExcel(inputstream, Map.class, params);
         int i = 1;
         for (ExcelSheetRecord record : list) {
-            String sheetName = String.format("第 %d 天",i);
-            if(config.getDays() == 1){
+            String sheetName = String.format("第 %d 天", i);
+            if (config.getDays() == 1) {
                 sheetName = config.getName();
             }
             record.convert(config, sheetName);
@@ -219,8 +221,6 @@ public class InspectionItemVO {
         buildItemCalcVO();
 
 
-
-
     }
 
     private void buildItemCalcVO() {
@@ -264,27 +264,28 @@ public class InspectionItemVO {
     public ItemCalcVO getItemCalcVO() {
         return itemCalcVO;
     }
-    public Map<String, double[]> getData(){
+
+    public Map<String, double[]> getData() {
         Map<String, double[]> data = new HashMap<>();
 
         for (String name : record.keySet()) {
-            data.put(name,record.get(name).getStoreData());
+            data.put(name, record.get(name).getStoreData());
         }
         return data;
     }
 
-    private void setData(Map<String, double[]> map){
-            for (String name : map.keySet()){
-                final double[] data = map.get(name);
-                xValue[] d = new xValue[data.length];
-                for (int i = 0; i<data.length;i++){
-                    d[i] = new xValue(data[i]);
-                }
-                record.put(name,new SpecimensCalcVO(d,config.isConvert()));
+    private void setData(Map<String, double[]> map) {
+        for (String name : map.keySet()) {
+            final double[] data = map.get(name);
+            xValue[] d = new xValue[data.length];
+            for (int i = 0; i < data.length; i++) {
+                d[i] = new xValue(data[i]);
             }
+            record.put(name, new SpecimensCalcVO(d, config.isConvert()));
+        }
     }
 
-    public ReportDataDTO getReportData(){
+    public ReportDataDTO getReportData() {
         return null;
     }
 

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

@@ -6,15 +6,15 @@ import com.lc.ibps.components.verification.funcs.xValue;
 //多个标本之间的对比计算
 public class ItemCalcVO {
     //多个样本均值 y
-    private xValue[] specimensValue;
+    private final xValue[] specimensValue;
     //样本的标示值/理论值 x
-    private xValue[] targetValue;
+    private final xValue[] targetValue;
     //截距(a)
-    private xValue a;
+    private final xValue a;
     //斜率(b)
-    private xValue b;
+    private final xValue b;
     //相关系数r
-    private xValue r;
+    private final xValue r;
 
     public ItemCalcVO(xValue[] specimensValue, xValue[] targetValue) {
         this.specimensValue = specimensValue;
@@ -46,16 +46,16 @@ public class ItemCalcVO {
 
     public String getLRE() {
         //y = bx + a
-        if(a.getDoub() > 0){
+        if (a.getDoub() > 0) {
             return String.format("y = %.4fx + %.4f", b.getDoub(), a.getDoub());
-        }else if(a.getDoub() <0){
+        } else if (a.getDoub() < 0) {
             return String.format("y = %.4fx - %.4f", b.getDoub(), -a.getDoub());
-        }else {
+        } else {
             return String.format("y = %.4fx", b.getDoub());
         }
     }
 
     public static void main(String[] args) {
-        System.out.println(String.format("y = %.4fx + %.4f", 1.3454523, 0.234556));
+        System.out.printf("y = %.4fx + %.4f%n", 1.3454523, 0.234556);
     }
 }

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

@@ -10,8 +10,7 @@ import com.lc.ibps.components.verification.funcs.xValue;
  */
 public class SpecimensCalcVO {
 
-    private xValue[] data;
-
+    private final xValue[] data;
 
 
     private xValue[] convertedData;
@@ -52,7 +51,7 @@ public class SpecimensCalcVO {
     }
 
     public xValue getVariance() {
-        if (variance == null) variance = new xValue(Math.pow(getSd().getDoub(),2));
+        if (variance == null) variance = new xValue(Math.pow(getSd().getDoub(), 2));
         return variance;
     }
 
@@ -65,33 +64,34 @@ public class SpecimensCalcVO {
     }
 
     private void convert() {
-            convertedData = xLog10.eval(data);
+        convertedData = xLog10.eval(data);
     }
 
     public xValue getAbsDev() {
-        if(absDev != null) return absDev;
+        if (absDev != null) return absDev;
         if (targetValue == null) {
             return new xValue();
         }
-        absDev = new xValue( getMean().getDoub() - targetValue );
+        absDev = new xValue(getMean().getDoub() - targetValue);
         return absDev;
     }
 
     public xValue getRelDev() {
-        if(relDev != null) return relDev;
+        if (relDev != null) return relDev;
         if (targetValue == null) {
             return new xValue();
         }
-        relDev = new xValue( getAbsDev().getDoub()/targetValue );
+        relDev = new xValue(getAbsDev().getDoub() / targetValue);
         return relDev;
     }
+
     //检测均值/预期值×100%
     public xValue getRvalue() {
-        if(rvalue != null) return rvalue;
+        if (rvalue != null) return rvalue;
         if (targetValue == null) {
             return new xValue();
         }
-        rvalue = new xValue( getMean().getDoub()/targetValue );
+        rvalue = new xValue(getMean().getDoub() / targetValue);
         return rvalue;
     }
 
@@ -112,9 +112,9 @@ public class SpecimensCalcVO {
         this.targetValue = targetValue;
     }
 
-    public double[] getStoreData(){
+    public double[] getStoreData() {
         double[] d = new double[data.length];
-        for (int i = 0; i<data.length;i++){
+        for (int i = 0; i < data.length; i++) {
             d[i] = data[i].getDoub();
         }
         return d;

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

@@ -0,0 +1,93 @@
+package com.lc.ibps.components.verification.model2;
+
+import com.lc.ibps.components.verification.funcs.xValue;
+import com.lc.ibps.components.verification.model.ExcelParserErrorEnum;
+import com.lc.ibps.components.verification.model.InspectionConfigVO;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class ExcelSheetRecord2 {
+
+    private final String sheetName;
+    private final List<Map> data;
+    //标本名称:检测值
+    private double[][] convertedData;
+
+    private final List<String> errors = new ArrayList<>();
+
+    public ExcelSheetRecord2(String sheetName, List<Map> data) {
+        this.sheetName = sheetName;
+        this.data = data;
+    }
+
+    public double[][] getConvertedData() {
+        return convertedData;
+    }
+
+    public void setConvertedData(double[][] convertedData) {
+        this.convertedData = convertedData;
+    }
+
+    public void convert(InspectionConfigVO config, String configSheetName) {
+
+        if (!configSheetName.equals(sheetName)) {
+            errors.add(ExcelParserErrorEnum.IncorrectSheetName.getText());
+            return;
+        }
+        int row = config.getDays();
+        int col = config.getSpecimensNum() * config.getRepeatNum();
+        String[] colNames = config.getSpecimensName();
+        if (config.getDays() == 1) {
+            row = config.getSpecimensNum();
+        }
+        if (config.getMethodNum() > 1) {
+            col = config.getMethodNum() * config.getRepeatNum();
+            colNames = config.getMethodName();
+        }
+
+        if (data.size() < row) {
+            errors.add(ExcelParserErrorEnum.RowLess.getText());
+            return;
+        }
+        convertedData = new double[row][col];
+        for (int i = 0; i < row; i++) {
+            Map<String, Object> map = data.get(i);
+            int num = 0;
+            for (String colName : colNames) {
+                if (config.getRepeatNum() == 1) {
+                    convertObject(map, colName, i, num++);
+                } else {
+                    for (int j = 1; j <= config.getRepeatNum(); j++) {
+                        convertObject(map, String.format("%s_重复 %d", colName, j), i, num++);
+                    }
+                }
+            }
+        }
+    }
+
+    private void convertObject(Map<String, Object> map, String sName, int row, int col) {
+        Object val = map.get(sName);
+        xValue value = new xValue(val);
+        if (value.isBlank()) {
+            errors.add(String.format(ExcelParserErrorEnum.ValueBlank.getText(), sName, row + 1));
+        } else if (!value.isDoub()) {
+            errors.add(String.format(ExcelParserErrorEnum.ValueNotDouble.getText(), sName, row + 1));
+        } else {
+            convertedData[row][col] = value.getDoub();
+        }
+    }
+
+    public List<String> getErrors() {
+        return errors;
+    }
+
+    public String getSheetName() {
+        return sheetName;
+    }
+
+    public List<Map> getData() {
+        return data;
+    }
+}

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

@@ -2,92 +2,91 @@ 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.regression.PolynomialRegression;
 import com.lc.ibps.components.verification.report.*;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.math3.stat.StatUtils;
 import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
 
+import java.time.LocalDate;
 import java.util.*;
 
 public class LinearRangeEP6A extends PVModel {
 
-    private double[][] data;
-
-    private double[] means;
-    private double[][] diffs;
-    private double[][] dli;
+    private final double[] means;
+    private final double[][] diffs;
+    private final double[][] dli;
     private double maxDli;
     private double mean;
-    private double[] standardDeviations;
+    private final 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 final int specimensNum;
+    private final int repeatNum;
+    private final PolynomialRegression pr1 = new PolynomialRegression();
+    private final PolynomialRegression pr2 = new PolynomialRegression();
+    private final PolynomialRegression pr3 = new PolynomialRegression();
     private PolynomialRegression prBest;
 
-    private double claimValue;
+    private final double claimValue;
 
 
     private double sdr;
     private double cvr;
 
-    public LinearRangeEP6A(double[][] data, double[] targetValues, double claimValue, int scale){
-        this.data = data;
-        this.setScale(scale);
-        this.specimensNum = data.length;
-        this.repeatNum = data[0].length;
+    public LinearRangeEP6A(double[][] data, InspectionConfigVO configVO) {
+        super(data, configVO);
+        this.specimensNum = configVO.getSpecimensNum();
+        this.repeatNum = configVO.getRepeatNum();
         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);
+        this.claimValue = configVO.getClaimValue();
+        calcTarget(configVO.getTargetValue());
         calculate();
     }
 
+
     public void calculate() {
 
         for (int i = 0; i < specimensNum; i++) {
             DescriptiveStatistics stat = new DescriptiveStatistics(data[i]);
-            means[i] = format(stat.getMean(),2);
+            means[i] = format(stat.getMean(), 2);
             standardDeviations[i] = stat.getStandardDeviation();
-            if(repeatNum == 2){
+            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[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;
+        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);
+        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;
+        if (pr2.isNonlinear() && pr3.isNonlinear()) {
+            if (pr2.getStdError() > pr3.getStdError()) prBest = pr3;
             else prBest = pr2;
-        } else if(pr2.isNonlinear()) {
+        } else if (pr2.isNonlinear()) {
             prBest = pr2;
-        }
-        else if (pr3.isNonlinear()) {
+        } else if (pr3.isNonlinear()) {
             prBest = pr3;
         }
         //calc dli
-        if(prBest != null) {
-            if(isTarget)  dli[0] = targetValues;
+        if (prBest != null) {
+            if (isTarget) dli[0] = targetValues;
             else dli[0] = means;
 
             for (int i = 0; i < specimensNum; i++) {
@@ -106,40 +105,40 @@ public class LinearRangeEP6A extends PVModel {
 //        pr1.getParameters();
     }
 
-    private void calcTarget(double[] targets){
-        if(ArrayUtils.isEmpty(targets)){
+    private void calcTarget(double[] targets) {
+        if (ArrayUtils.isEmpty(targets)) {
             for (int i = 0; i < specimensNum; i++) {
-                targetValues[i] = i+1;
+                targetValues[i] = i + 1;
             }
             isTarget = false;
-        }else if(targets.length ==2) {
+        } 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) {
+        } else if (targets.length == specimensNum) {
             targetValues = targets;
         }
     }
 
-    public TableDTO buildDataTableDTO(){
+    public TableDTO buildDataTableDTO() {
         List<String> header = new ArrayList<String>();
 
         header.add("标本号");
-        if(isTarget) header.add("目标值");
+        if (isTarget) header.add("目标值");
         for (int i = 1; i <= repeatNum; i++) {
-            header.add(String.format("测量结果#%d",i));
+            header.add(String.format("测量结果#%d", i));
         }
         TableDTO table = new TableDTO();
-        table.buildHeader( header.toArray(new String[header.size()]));
+        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]));
+            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]));
@@ -163,18 +162,18 @@ public class LinearRangeEP6A extends PVModel {
         return null;
     }
 
-    public Map<String, TableDTO> buildReportTableDTO(){
+    public Map<String, TableDTO> buildReportTableDTO() {
         Map<String, TableDTO> reports = new HashMap<>();
-        reports.put("表1: 重复性差异检测结果",buildTable1DTO());
-        reports.put("表2: 多项式回归分析结果",buildTable2DTO());
-        reports.put("表3: 线性偏离计算结果",buildTable3DTO());
+        reports.put("表1: 重复性差异检测结果", buildTable1DTO());
+        reports.put("表2: 多项式回归分析结果", buildTable2DTO());
+        reports.put("表3: 线性偏离计算结果", buildTable3DTO());
         return reports;
     }
 
     public Map<String, ChartDTO> buildChartDTO() {
-        Map<String,ChartDTO> charts = new HashMap<>();
-        charts.put("图1: 线性实验",buildChart1DTO());
-        charts.put("图2: 线性评价差值点图",buildChart2DTO());
+        Map<String, ChartDTO> charts = new HashMap<>();
+        charts.put("图1: 线性实验", buildChart1DTO());
+        charts.put("图2: 线性评价差值点图", buildChart2DTO());
         return charts;
     }
 
@@ -182,15 +181,15 @@ public class LinearRangeEP6A extends PVModel {
         ChartDTO chartDTO = new ChartDTO("linesForRange");
         double[][] data = new double[targetValues.length][2];
         for (int i = 0; i < data.length; i++) {
-            data[i] = new double[]{i+1,diffs[1][i]};
+            data[i] = new double[]{i + 1, diffs[1][i]};
         }
 //        chartDTO.setData(data);
         final HashMap<String, Object> config = new HashMap<>();
-        config.put("yAxisUp",0.1);
-        config.put("yAxisLow",-0.1);
-        config.put("data",JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect));
+        config.put("yAxisUp", 0.1);
+        config.put("yAxisLow", -0.1);
+        config.put("data", JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect));
 
-        chartDTO.setOption(EchartsFreemarkerUtils.generateChart("/scatter/linesForRange.ftl",config));
+        chartDTO.setOption(EchartsFreemarkerUtils.generateChart("/scatter/linesForRange.ftl", config));
         return chartDTO;
     }
 
@@ -198,16 +197,16 @@ public class LinearRangeEP6A extends PVModel {
         ChartDTO chartDTO = new ChartDTO("polynomialRegression");
         double[][] data = new double[targetValues.length][2];
         for (int i = 0; i < data.length; i++) {
-            data[i] = new double[]{targetValues[i],means[i]};
+            data[i] = new double[]{targetValues[i], means[i]};
         }
 //        chartDTO.setData(data);
-        Map<String,Object> map = new HashMap<>();
-        map.put("data",JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect));
-        chartDTO.setOption(EchartsFreemarkerUtils.generateChart("/scatter/polynomialRegression.ftl",map));
+        Map<String, Object> map = new HashMap<>();
+        map.put("data", JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect));
+        chartDTO.setOption(EchartsFreemarkerUtils.generateChart("/scatter/polynomialRegression.ftl", map));
         return chartDTO;
     }
 
-    private TableDTO buildTable1DTO(){
+    private TableDTO buildTable1DTO() {
 
         TableDTO table = new TableDTO();
         String[] header = {"标本号", "均值", "差值Diff", "Diff<sup>2</sup>/2", "%Diff", "%Diff<sup>2</sup>/2"};
@@ -218,24 +217,25 @@ public class LinearRangeEP6A extends PVModel {
         double[][] doubles = transposeMatrix(diffs);
 
         for (int i = 0; i < doubles.length; i++) {
-            r[i] = ArrayUtils.add(doubles[i], 0, i+1);
+            r[i] = ArrayUtils.add(doubles[i], 0, i + 1);
         }
-        table.buildData(r,getScale());
+        table.buildData(r, getScale());
         return table;
     }
-    private TableDTO buildTable2DTO(){
+
+    private TableDTO buildTable2DTO() {
 
         TableDTO table = new TableDTO();
-        String[] header = {"阶别", "系数", "系数值", "SE<sub>i</sub>", "t 检验", "S<sub>y.x</sub>","自由度"};
+        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");
+        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][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.gettValues()[j]);
@@ -245,7 +245,7 @@ public class LinearRangeEP6A extends PVModel {
         }
         for (int j = 0; j < pr2.getParameters().length; j++) {
             r[i][0] = "2";
-            r[i][1] = String.format("b%d",j);
+            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.gettValues()[j]);
@@ -255,7 +255,7 @@ public class LinearRangeEP6A extends PVModel {
         }
         for (int j = 0; j < pr3.getParameters().length; j++) {
             r[i][0] = "3";
-            r[i][1] = String.format("b%d",j);
+            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.gettValues()[j]);
@@ -266,7 +266,8 @@ public class LinearRangeEP6A extends PVModel {
         table.buildData(r);
         return table;
     }
-    private TableDTO buildTable3DTO(){
+
+    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>"};
@@ -276,15 +277,18 @@ public class LinearRangeEP6A extends PVModel {
         double[][] doubles = transposeMatrix(dli);
 
         for (int i = 0; i < doubles.length; i++) {
-            r[i] = ArrayUtils.add(doubles[i], 0, i+1);
+            r[i] = ArrayUtils.add(doubles[i], 0, i + 1);
         }
-        table.buildData(r,getScale());
+        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}};
-        LinearRangeEP6A ep6 = new LinearRangeEP6A(data, new double[]{0,24.09},1,3);
+    public static void main(String[] args) {
+        InspectionConfigVO config = new InspectionConfigVO("EP6-A线性评价", 1, 6,
+                null, 2, LocalDate.now(), true);
+        config.setTargetValue(new double[]{0, 24.56});
+        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}};
+        LinearRangeEP6A ep6 = new LinearRangeEP6A(data, config);
         TableDTO tableDTO = ep6.buildDataTableDTO();
         Map<String, TableDTO> stringTableDTOMap = ep6.buildReportTableDTO();
         final Map<String, ChartDTO> stringChartDTOMap = ep6.buildChartDTO();
@@ -296,7 +300,6 @@ public class LinearRangeEP6A extends PVModel {
         String s = JSONObject.toJSONString(report, SerializerFeature.DisableCircularReferenceDetect);
 
         System.out.println(s);
-//        ep6.getT()
 
     }
 }

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

@@ -2,41 +2,31 @@ package com.lc.ibps.components.verification.model2;
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.serializer.SerializerFeature;
-import com.lc.ibps.components.poi.excel.entity.ExportParams;
 import com.lc.ibps.components.poi.excel.entity.ImportParams;
-import com.lc.ibps.components.poi.excel.entity.enmus.ExcelType;
-import com.lc.ibps.components.poi.excel.entity.params.ExcelExportEntity;
-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.model.ExcelSheetRecord;
+import com.lc.ibps.components.verification.excel.strategy.LinearRangeStrategy;
+import com.lc.ibps.components.verification.excel.strategy.MethodStrategy;
+import com.lc.ibps.components.verification.excel.strategy.MultiDayStrategy;
+import com.lc.ibps.components.verification.excel.strategy.TemplateStrategy;
 import com.lc.ibps.components.verification.model.InspectionConfigVO;
 import org.apache.poi.ss.usermodel.Workbook;
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 public class PVItemBuilder {
-    public static String DISPLAY_NUMBER = "次数";
-    public static String DISPLAY_VALUE = "检测值";
 
-    public static String DISPLAY_LOG = "对数值";
-
-    public static String DISPLAY_DATE = "实验日期";
     private InspectionConfigVO config;
     private PVModel pvModel;
-//    private Map<String, PVModel> calcMap = new HashMap<>();
 
-    private PVItemBuilder(){
+    private PVItemBuilder() {
 
     }
 
-    public static PVItemBuilder getInstance(InspectionConfigVO config){
+    public static PVItemBuilder getInstance(InspectionConfigVO config) {
         PVItemBuilder builder = new PVItemBuilder();
         builder.setConfig(config);
         return builder;
@@ -58,132 +48,61 @@ public class PVItemBuilder {
         this.pvModel = pvModel;
     }
 
+    public Workbook exportExcelTemplate() {
+        return buildTemplateStrategy().buildTemplate();
+    }
+
+    public TemplateStrategy buildTemplateStrategy() {
+        TemplateStrategy strategy;
+        if (config.getDays() > 1) {
+            strategy = new MultiDayStrategy(config);
+        } else if (config.getMethodNum() > 1) {
+            strategy = new MethodStrategy(config);
+        } else {
+            strategy = new LinearRangeStrategy(config);
+        }
+        return strategy;
+    }
+
+
     public void importExcelRecord(InputStream inputstream) throws IOException {
+        final TemplateStrategy strategy = buildTemplateStrategy();
         ImportParams params = new ImportParams();
         params.setTitleRows(1);
-        params.setHeadRows(1);
-        params.setSheetNum(config.getDays());
-        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){
-                sheetName = config.getName();
-            }
-            record.convert(config, sheetName);
+        params.setHeadRows(strategy.getHeadRows());
+        List<ExcelSheetRecord2> list = PVExcelUtil.importExcel(inputstream, Map.class, params);
+        Map<String, List<String>> errorMessage = new HashMap<>();
+        for (ExcelSheetRecord2 record : list) {
+            String sheetName = config.getName();
+            strategy.parseData(record);
+
             if (record.getErrors().size() > 0) {
                 errorMessage.put(sheetName, record.getErrors());
             }
-            i++;
         }
         if (errorMessage.size() > 0) {
             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 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++) {
-                    total2[j * xValues.length + k] = xValues[k].getDoub();
-                }
-            }
-            dataArrays[ii] = total2;
-            ii++;
-        }
-
-        if(config.getName().toLowerCase().contains("精密度")){
-            PrecisionEP15 precisionEP15 = new PrecisionEP15(config.getSpecimensName(),config.getDecimal());
-
-            for (String sName : config.getSpecimensName()) {
-                //day - spec
-                double[][] data = new double[config.getDays()][config.getRepeatNum()];
-                for (int j = 0; j < list.size(); j++) {
-                    data[j] = pvModel.transposeXValue(list.get(j).getConvertedData().get(sName));
-                }
-                precisionEP15.buildItem(sName,data,config.getBatchCVSValue(),config.getDailyCVSValue(),config.getSpecimensNum(),config.getRange());
-                pvModel = precisionEP15;
-            }
-
-        }else if(config.getName().equals("EP15-A2定值参考物质验证")){
-            TruenessRefernece truenessRefernece = new TruenessRefernece(config.getSpecimensName(),config.getDecimal());
-            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];
-//                    }
-//                }
-                //day - spec
-                double[][] data = new double[config.getDays()][config.getRepeatNum()];
-                for (int j = 0; j < list.size(); j++) {
-                    data[j] = pvModel.transposeXValue(list.get(j).getConvertedData().get(sName));
-                }
-                truenessRefernece.buildItem(sName,data, config.getTargetValue()[0],config.getClaimValue(),0);
-                pvModel = truenessRefernece;
-            }
-        }else if(config.getName().equals("EP15-A2方法学比对")){
+        final double[][] dataArrays = list.get(0).getConvertedData();
 
-            pvModel = new TruenessEP15Patient(dataArrays, config.getClaimValue(),0,config.getDecimal());
-
-        }
-        else if(config.getName().equals("EP6-A线性评价")){
-
-            pvModel = new LinearRangeEP6A(dataArrays, config.getTargetValue(),config.getClaimValue(),config.getDecimal());
-
-        }
-
-        pvModel.setUnits(config.getUnits());
+        pvModel = buildPVModel(dataArrays);
 
     }
 
-    public Workbook exportExcelTemplate() {
-        List<ExcelExportEntity> entity = new ArrayList<ExcelExportEntity>();
-
-        List<ExcelExportEntity> temp = new ArrayList<ExcelExportEntity>();
-        ExcelExportEntity e1 = new ExcelExportEntity(DISPLAY_NUMBER, "number");
-//        e1.setMergeVertical(true);
-        e1.setType(BaseEntityTypeConstants.DoubleType);
-        entity.add(e1);
-
-
-        for (int i = 0; i < config.getSpecimensNum(); i++) {
-            ExcelExportEntity e2 = new ExcelExportEntity(config.getSpecimensName()[i], "input");
-            entity.add(e2);
+    public PVModel buildPVModel(double[][] dataArrays) {
+        PVModel pvModel;
+        if (config.getName().toLowerCase().contains("精密度")) {
+            pvModel = new PrecisionEP15(dataArrays, config);
+        } else if (config.getName().equals("EP15-A2定值参考物质验证")) {
+            pvModel = new TruenessRefernece(dataArrays, config);
+        } else if (config.getName().equals("EP15-A2方法学比对")) {
+            pvModel = new TruenessEP15Patient(dataArrays, config);
+        } else if (config.getName().equals("EP6-A线性评价")) {
+            pvModel = new LinearRangeEP6A(dataArrays, config);
+        } else {
+            return null;
         }
-//        ExcelExportEntity excelEntity = new ExcelExportEntity("", "inspection");
-//        excelEntity.setList(temp);
-//        entity.add(excelEntity);
-        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
-        Map<String, Object> map;
-        for (int i = 1; i <= config.getRepeatNum(); i++) {
-            map = new HashMap<String, Object>();
-            map.put("number", i);
-//            map.put("value", "");
-
-//            List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
-//            tempList.add(map);
-//            map.put("inspection", tempList);
-
-            list.add(map);
-        }
-        List<ExportParams> exportParamsList = new ArrayList<ExportParams>();
-        for (int i = 1; i < config.getDays()+1; i++) {
-            String sheetName = String.format("第 %d 天",i);
-            if(config.getDays() == 1){
-                sheetName = config.getName();
-            }
-            ExportParams exportParams = new ExportParams(config.getName() + " 数据导入模板", sheetName);
-            exportParams.setStyle(PVExcelExportStyler.class);
-            exportParamsList.add(exportParams);
-            exportParams.setType(ExcelType.XSSF);
-        }
-        Workbook workbook = PVExcelUtil.exportExcelTemplateWithMultiSheet(exportParamsList, entity, list);
-
-        return workbook;
+        return pvModel;
     }
 }

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

@@ -1,6 +1,7 @@
 package com.lc.ibps.components.verification.model2;
 
 import com.lc.ibps.components.verification.funcs.xValue;
+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.distribution.ChiSquaredDistribution;
@@ -10,23 +11,41 @@ public abstract class PVModel {
 
     private int scale;
     private String units;
-    public String format(double d){
-        return String.format("%."+scale+"f", format(d,scale));
+    protected double[][] data;
+
+    public PVModel(double[][] data, InspectionConfigVO configVO) {
+        this.data = data;
+        this.units = configVO.getUnits();
+        this.scale = configVO.getDecimal();
+    }
+
+    public double[][] getData() {
+        return data;
     }
-    public static double format(double d,int s){
-        return Double.parseDouble(String.format("%."+s+"f", d));
+
+    public void setData(double[][] data) {
+        this.data = data;
+    }
+
+    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 getTValue(double degreesOfFreedom, double p){
+
+    public static double getTValue(double degreesOfFreedom, double p) {
         TDistribution t = new TDistribution(degreesOfFreedom);
-        double value = t.inverseCumulativeProbability(1 - p/2);
+        double value = t.inverseCumulativeProbability(1 - p / 2);
 //        double value = t.inverseCumulativeProbability(1 - 0.01/2);
-        return format(value,2);
+        return format(value, 2);
     }
 
-    public static double getCValue(double degreesOfFreedom, int level, double p){
-        ChiSquaredDistribution x2 = new ChiSquaredDistribution( degreesOfFreedom );
-        return x2.inverseCumulativeProbability(1 - p/level);//level
+    public static double getCValue(double degreesOfFreedom, int level, double p) {
+        ChiSquaredDistribution x2 = new ChiSquaredDistribution(degreesOfFreedom);
+        return x2.inverseCumulativeProbability(1 - p / level);//level
     }
 
 
@@ -41,7 +60,9 @@ public abstract class PVModel {
     }
 
     public abstract TableDTO buildDataTableDTO();
+
     public abstract SheetDTO[] buildSheetDTO();
+
     public abstract String generateResult();
 
     public int getScale() {
@@ -60,7 +81,7 @@ public abstract class PVModel {
         this.units = units;
     }
 
-    public static double[] transposeXValue(xValue[] xValues){
+    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();

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

@@ -1,64 +1,88 @@
 package com.lc.ibps.components.verification.model2;
 
+import com.lc.ibps.components.verification.model.InspectionConfigVO;
 import com.lc.ibps.components.verification.report.EchartsFreemarkerUtils;
 import com.lc.ibps.components.verification.report.SheetDTO;
 import com.lc.ibps.components.verification.report.TableDTO;
+import org.apache.commons.math3.linear.MatrixUtils;
+import org.apache.commons.math3.linear.RealMatrix;
 
+import java.time.LocalDate;
 import java.util.*;
 
 public class PrecisionEP15 extends PVModel {
 
-    private List<PrecisionEP15Item> items = new ArrayList<>(); //[day][replicate]
+    private final List<PrecisionEP15Item> items = new ArrayList<>(); //[day][replicate]
 
-    private String[] specimensName;
+    private final String[] specimensName;
 
-    public PrecisionEP15(String[] specimensName, int decimal) {
-        this.specimensName = specimensName;
-        this.setScale(decimal);
+    public PrecisionEP15(double[][] data, InspectionConfigVO configVO) {
+        super(data, configVO);
+        this.specimensName = configVO.getSpecimensName();
+        final RealMatrix realMatrix = MatrixUtils.createRealMatrix(data);
+        for (int i = 0; i < specimensName.length; i++) {
+            double[][] sub = new double[data.length][configVO.getRepeatNum()];
+            realMatrix.copySubMatrix(0, data.length - 1,
+                    i * configVO.getRepeatNum(), (i + 1) * configVO.getRepeatNum() - 1, sub);
+            items.add(new PrecisionEP15Item(specimensName[i], sub, configVO));
+        }
     }
 
-    public void buildItem(String name,double[][] data, double allowableCvr, double allowableCv1 ,int level,int range){
-        items.add(new PrecisionEP15Item(name,data,allowableCvr,allowableCv1,level,range));
+    public static void main(String[] args) {
+        InspectionConfigVO config = new InspectionConfigVO("精密度", 5, 2,
+                null, 3, LocalDate.now(), true);
+        config.setRange(99);
+        config.setBatchCVSValue(3.2);
+        config.setDailyCVSValue(3.1);
+        double[][] data = {
+                {3.3, 3.23, 3.43, 3.3, 3.23, 3.43},
+                {3.21, 3.45, 3.42, 3.3, 3.23, 3.43},
+                {3.21, 3.24, 3.45, 3.3, 3.23, 3.43},
+                {3.5, 3.45, 3.51, 3.3, 3.23, 3.43},
+                {3.33, 3.45, 3.32, 3.3, 3.23, 3.43}};
+        PrecisionEP15 precisionEP15 = new PrecisionEP15(data, config);
+        TableDTO tableDTO = precisionEP15.buildDataTableDTO();
+        SheetDTO[] sheetDTOS = precisionEP15.buildSheetDTO();
+        String s = precisionEP15.generateResult();
+        System.out.println(s);
     }
 
-
     @Override
     public TableDTO buildDataTableDTO() {
-        String[] h = new String[specimensName.length+1];
-        Map<String,String[]> child = new HashMap<>();
-        String[] c = new String[items.get(0).data[0].length ];
-        for (int i = 0; i < c.length ; i++) {
-            c[i] = String.format("重复 %d",(i+1));
+        String[] h = new String[specimensName.length + 1];
+        Map<String, String[]> child = new HashMap<>();
+        String[] c = new String[items.get(0).data[0].length];
+        for (int i = 0; i < c.length; i++) {
+            c[i] = String.format("重复 %d", (i + 1));
         }
         h[0] = "天数";
         for (int i = 0; i < specimensName.length; i++) {
-            h[1+i] = specimensName[i];
-            child.put(h[i+1],c);
+            h[1 + i] = specimensName[i];
+            child.put(h[i + 1], c);
         }
         TableDTO table = new TableDTO();
-        table.buildHeader(h,child);
+        table.buildHeader(h, child);
 
         List<double[]> temp = new ArrayList<>();
         double[] first = new double[items.get(0).data.length];
-        for (int i = 0; i <items.get(0).data.length; i++) {
-            first[i] = i+1;
+        for (int i = 0; i < items.get(0).data.length; i++) {
+            first[i] = i + 1;
         }
         temp.add(first);
         for (int i = 0; i < specimensName.length; i++) {
-            temp.addAll(Arrays.<double[]>asList(transposeMatrix(items.get(i).data)));
+            temp.addAll(Arrays.asList(transposeMatrix(items.get(i).data)));
         }
 
         double[][] toArray = temp.toArray(new double[0][0]);
-        table.buildData(transposeMatrix(toArray),getScale());
+        table.buildData(transposeMatrix(toArray), getScale());
         return table;
 
     }
 
-
     @Override
     public SheetDTO[] buildSheetDTO() {
         SheetDTO[] reports = new SheetDTO[items.size()];
-        for (int i=0; i<items.size();i++) {
+        for (int i = 0; i < items.size(); i++) {
             final SheetDTO sheet = new SheetDTO(items.get(i).name);
             Map<String, TableDTO> table = new HashMap<>();
             table.putAll(buildTable1DTO(items.get(i)));
@@ -71,7 +95,7 @@ public class PrecisionEP15 extends PVModel {
 
     @Override
     public String generateResult() {
-        return EchartsFreemarkerUtils.generate("/report/precisionEP15A2.ftl",this);
+        return EchartsFreemarkerUtils.generate("/report/precisionEP15A2.ftl", this);
 
     }
 
@@ -80,29 +104,16 @@ public class PrecisionEP15 extends PVModel {
         TableDTO table = new TableDTO();
         String[][] data = new String[8][2];
 
-        data[0] =new String[]{"总均值" , format(item.getMean())};
-        data[1] =new String[]{"批内方差 (V<sub>r</sub>)" , format(item.getVr())};
-        data[2] =new String[]{"批内标准差 (SD<sub>r</sub>)" , format(item.getSdr())};
-        data[3] =new String[]{"批内变异系数 (CV<sub>r</sub>)" , format(item.getCvr())};
-        data[4] =new String[]{"批间标准差 (SD<sub>b</sub>)" , format(item.getSdb())};
-        data[5] =new String[]{"批间方差 (V<sub>b</sub>)" , format(item.getVb())};
-        data[6] =new String[]{"实验室内标准差 (SD<sub>1</sub>)" , format(item.getSd1())};
-        data[7] =new String[]{"实验室变异系数 (CV)" , format(item.getCv1())};
+        data[0] = new String[]{"总均值", format(item.getMean())};
+        data[1] = new String[]{"批内方差 (V<sub>r</sub>)", format(item.getVr())};
+        data[2] = new String[]{"批内标准差 (SD<sub>r</sub>)", format(item.getSdr())};
+        data[3] = new String[]{"批内变异系数 (CV<sub>r</sub>)", format(item.getCvr())};
+        data[4] = new String[]{"批间标准差 (SD<sub>b</sub>)", format(item.getSdb())};
+        data[5] = new String[]{"批间方差 (V<sub>b</sub>)", format(item.getVb())};
+        data[6] = new String[]{"实验室内标准差 (SD<sub>1</sub>)", format(item.getSdl())};
+        data[7] = new String[]{"实验室变异系数 (CV)", format(item.getCvl())};
         table.buildData(data);
-        reports.put(item.name,table);
-        return  reports;
-    }
-
-    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}};
-        PrecisionEP15 precisionEP15 = new PrecisionEP15(new String[]{"test 1","test 2"},3);
-        precisionEP15.buildItem("test 1",data, 0, 0 ,2,99);
-        precisionEP15.buildItem("test 2",data, 0, 0 ,2,99);
-        TableDTO tableDTO = precisionEP15.buildDataTableDTO();
-        SheetDTO[] sheetDTOS = precisionEP15.buildSheetDTO();
-        String s = precisionEP15.generateResult();
-//        ChiSquaredDistribution x2 = new ChiSquaredDistribution( 10 );
-//        double result = x2.inverseCumulativeProbability(1 - 0.05/2);//level
-        System.out.println(s);
+        reports.put(item.name, table);
+        return reports;
     }
 }

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

@@ -1,5 +1,6 @@
 package com.lc.ibps.components.verification.model2;
 
+import com.lc.ibps.components.verification.model.InspectionConfigVO;
 import org.apache.commons.math3.stat.StatUtils;
 import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
 
@@ -33,38 +34,39 @@ public class PrecisionEP15Item {
     private double mean;
     private double sdr;
     private double vb;
-    private double sd1;
+    private double sdl;
     private double sdb;
 
     private double cvr;
-    private double cv1;
+    private double cvl;
     private double n; //replicates
 
 
-    private double allowableCvr;
-    private double allowableCv1;
-    private double allowableSr;
-    private double allowableS1;
+    private double allowableCVr;
+    private double allowableCVl;
+    private double allowableSDr;
+    private double allowableSDl;
     private double vr;
 
 
     private double t;
     private double c;
     private double v;
-    private int level;
+    private final int level;
 
-    private double p;//0.01 or 0.05
+    private final double p;//0.01 or 0.05
 
-    public PrecisionEP15Item(String name,double[][] data, double allowableCvr, double allowableCv1,int level,int range) {
+    public PrecisionEP15Item(String name, double[][] data, InspectionConfigVO configVO) {
         this.name = name;
         this.data = data;
-        this.n = data[0].length;
-        this.allowableCvr = allowableCvr;
-        this.allowableCv1 = allowableCv1;
-        this.level = level;
-        if(range > 0 && range < 100){
-            this.p = (double) (100-range)/100;
-        }else{
+        this.n = configVO.getRepeatNum();
+        this.allowableCVr = configVO.getDailyCVSValue();
+        this.allowableCVl = configVO.getBatchCVSValue();
+        this.level = configVO.getSpecimensNum();
+        int range = configVO.getRange();
+        if (range > 0 && range < 100) {
+            this.p = (double) (100 - range) / 100;
+        } else {
             this.p = 0.01;
         }
         calculate();
@@ -118,12 +120,12 @@ public class PrecisionEP15Item {
         this.vb = vb;
     }
 
-    public double getSd1() {
-        return sd1;
+    public double getSdl() {
+        return sdl;
     }
 
-    public void setSd1(double sd1) {
-        this.sd1 = sd1;
+    public void setSdl(double sdl) {
+        this.sdl = sdl;
     }
 
     public double getCvr() {
@@ -134,45 +136,45 @@ public class PrecisionEP15Item {
         this.cvr = cvr;
     }
 
-    public double getCv1() {
-        return cv1;
+    public double getCvl() {
+        return cvl;
     }
 
-    public void setCv1(double cv1) {
-        this.cv1 = cv1;
+    public void setCvl(double cvl) {
+        this.cvl = cvl;
     }
 
 
-    public double getAllowableCvr() {
-        return allowableCvr;
+    public double getAllowableCVr() {
+        return allowableCVr;
     }
 
-    public void setAllowableCvr(double allowableCvr) {
-        this.allowableCvr = allowableCvr;
+    public void setAllowableCVr(double allowableCVr) {
+        this.allowableCVr = allowableCVr;
     }
 
-    public double getAllowableCv1() {
-        return allowableCv1;
+    public double getAllowableCVl() {
+        return allowableCVl;
     }
 
-    public void setAllowableCv1(double allowableCv1) {
-        this.allowableCv1 = allowableCv1;
+    public void setAllowableCVl(double allowableCVl) {
+        this.allowableCVl = allowableCVl;
     }
 
-    public double getAllowableSr() {
-        return allowableSr;
+    public double getAllowableSDr() {
+        return allowableSDr;
     }
 
-    public void setAllowableSr(double allowableSr) {
-        this.allowableSr = allowableSr;
+    public void setAllowableSDr(double allowableSDr) {
+        this.allowableSDr = allowableSDr;
     }
 
-    public double getAllowableS1() {
-        return allowableS1;
+    public double getAllowableSDl() {
+        return allowableSDl;
     }
 
-    public void setAllowableS1(double allowableS1) {
-        this.allowableS1 = allowableS1;
+    public void setAllowableSDl(double allowableSDl) {
+        this.allowableSDl = allowableSDl;
     }
 
     public double getT() {
@@ -225,23 +227,23 @@ public class PrecisionEP15Item {
 
         //室内标准差
         double vv = (n - 1) / n;
-        sd1 = Math.sqrt(vv * vr + vb);//SDl 为实验室标准差
+        sdl = Math.sqrt(vv * vr + vb);//SDl 为实验室标准差
 
         cvr = (sdr / mean) * 100;
-        cv1 = (sd1 / mean) * 100;
+        cvl = (sdl / mean) * 100;
 
         //实验室允许不精密度
-        allowableSr = allowableCvr * mean / 100;
-        allowableS1 = allowableCv1 * mean / 100;
+        allowableSDr = allowableCVr * mean / 100;
+        allowableSDl = allowableCVl * mean / 100;
         double d = data.length;
 
 
         //t=((((C14-1)*(C16^2))+(C14*M11))^2)/(((C14-1)/C13*(C16^4))+(((C14^2)*(M11^2))/(C13-1)))
-        t = (Math.pow((((n-1)*(Math.pow(sdr,2)))+(n*vb)),2))/(((n-1)/d*(Math.pow(sdr,4)))+(((Math.pow(n,2))*(Math.pow(vb,2)))/(d-1)));
-        c= PVModel.getCValue(t,level,0.05);
+        t = (Math.pow((((n - 1) * (Math.pow(sdr, 2))) + (n * vb)), 2)) / (((n - 1) / d * (Math.pow(sdr, 4))) + (((Math.pow(n, 2)) * (Math.pow(vb, 2))) / (d - 1)));
+        c = PVModel.getCValue(t, level, 0.05);
         double sdclarim = 3;
 
-        v = sdclarim *  Math.sqrt(c/t);
+        v = sdclarim * Math.sqrt(c / t);
 
     }
 }

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

@@ -2,6 +2,7 @@ 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.ChartDTO;
 import com.lc.ibps.components.verification.report.EchartsFreemarkerUtils;
 import com.lc.ibps.components.verification.report.SheetDTO;
@@ -9,14 +10,15 @@ import com.lc.ibps.components.verification.report.TableDTO;
 import org.apache.commons.math3.stat.StatUtils;
 import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
 
+import java.time.LocalDate;
 import java.util.HashMap;
 import java.util.Map;
 
 public class TruenessEP15Patient extends PVModel {
     //多个样本均值 y
-    private double[] y;
+    private final double[] y;
     //样本的标示值/理论值 x
-    private double[] x;
+    private final double[] x;
     private double[] yx;
     private double[] yxb;
 
@@ -33,19 +35,19 @@ public class TruenessEP15Patient extends PVModel {
     private double lvl;//Lower verification limit
     private double sdClaim;//SD assigned value
 
-    public TruenessEP15Patient(double[][] data, double sdClaim, double t, int decimal) {
+    public TruenessEP15Patient(double[][] data, InspectionConfigVO configVO) {
+        super(data, configVO);
         this.y = data[0];
         this.x = data[1];
         meanX = StatUtils.mean(x);
         meanY = StatUtils.mean(y);
-        if(t == 0){
-            this.t = getTValue(this.y.length-1,0.01);
-        }else {
-            this.t = t;
-        }
+//        if(t == 0){
+        this.t = getTValue(this.y.length - 1, 0.01);
+//        }else {
+//            this.t = t;
+//        }
         this.n = this.y.length;
-        this.sdClaim = sdClaim;
-        this.setScale(decimal);
+        this.sdClaim = configVO.getClaimValue();
         calculate();
     }
 
@@ -158,11 +160,12 @@ public class TruenessEP15Patient extends PVModel {
     public void setSdClaim(double sdClaim) {
         this.sdClaim = sdClaim;
     }
-    public double[][] getData(){
+
+    public double[][] getData() {
 
         double[][] d = new double[y.length][5];
-        for (int i = 0; i<y.length;i++){
-            d[i][0] = i+1;
+        for (int i = 0; i < y.length; i++) {
+            d[i][0] = i + 1;
             d[i][1] = y[i];
             d[i][2] = x[i];
             d[i][3] = yx[i];
@@ -176,7 +179,7 @@ public class TruenessEP15Patient extends PVModel {
         TableDTO table = new TableDTO();
         String[] header = {"次数", "Y (实验方法)", "X (比较方法)", "Y<sub>i</sub>-X<sub>i</sub>", "(Y<sub>i</sub>-X<sub>i</sub>-B)"};
         table.buildHeader(header);
-        table.buildData(getData(),getScale());
+        table.buildData(getData(), getScale());
         return table;
     }
 
@@ -185,14 +188,14 @@ public class TruenessEP15Patient extends PVModel {
         TableDTO table = new TableDTO();
         String[][] data = new String[8][2];
 
-        data[0] =new String[]{"Y均值" , format(meanY)};
-        data[1] =new String[]{"X均值" , format(meanX)};
-        data[2] =new String[]{"差值(B)" , format(bias)};
-        data[3] =new String[]{"差值标准差(SD<sub>diff</sub>)" , format(sdDiff)};
-        data[4] =new String[]{"置信区间上限" , format(ucl)};
-        data[5] =new String[]{"置信区间下限" , format(lcl)};
-        data[6] =new String[]{"验证区间上限" , format(uvl)};
-        data[7] =new String[]{"验证区间下限" , format(lvl)};
+        data[0] = new String[]{"Y均值", format(meanY)};
+        data[1] = new String[]{"X均值", format(meanX)};
+        data[2] = new String[]{"差值(B)", format(bias)};
+        data[3] = new String[]{"差值标准差(SD<sub>diff</sub>)", format(sdDiff)};
+        data[4] = new String[]{"置信区间上限", format(ucl)};
+        data[5] = new String[]{"置信区间下限", format(lcl)};
+        data[6] = new String[]{"验证区间上限", format(uvl)};
+        data[7] = new String[]{"验证区间下限", format(lvl)};
 //        data[1] =new String[]{"批内方差 (V<sub>r</sub>)" , format(item.vr)};
 //        data[2] =new String[]{"批内标准差 (S<sub>r</sub>)" , format(item.sr)};
 //        data[3] =new String[]{"批内变异系数 (CV<sub>r</sub>)" , format(item.cvr)};
@@ -202,7 +205,7 @@ public class TruenessEP15Patient extends PVModel {
 //        data[6] =new String[]{"实验室内标准差 (S<sub>1</sub>)" , format(item.s1)};
 //        data[7] =new String[]{"实验室变异系数 (CV)" , format(item.cv1)};
         table.buildData(data);
-        reports.put("表1",table);
+        reports.put("表1", table);
         return reports;
     }
 
@@ -211,54 +214,59 @@ public class TruenessEP15Patient extends PVModel {
         SheetDTO sheet = new SheetDTO("EP15-A方法学比对");
         sheet.setReportDataDTO(buildReportTableDTO());
         HashMap<String, ChartDTO> map = new HashMap<>();
-        map.put("图1: 对比数据的差值图",buildChart1DTO());
+        map.put("图1: 对比数据的差值图", buildChart1DTO());
         sheet.setChartDataDTO(map);
         return new SheetDTO[]{sheet};
     }
 
     @Override
     public String generateResult() {
-        return EchartsFreemarkerUtils.generate("/report/truesnessUsingPatient.ftl",this);
+        return EchartsFreemarkerUtils.generate("/report/truesnessUsingPatient.ftl", this);
     }
 
     private ChartDTO buildChart1DTO() {
         ChartDTO chartDTO = new ChartDTO("linesForRange");
         double[][] data = new double[yx.length][2];
         for (int i = 0; i < data.length; i++) {
-            data[i] = new double[]{x[i],yx[i]};
+            data[i] = new double[]{x[i], yx[i]};
         }
 //        chartDTO.setData(data);
         final HashMap<String, Object> config = new HashMap<>();
-        config.put("yAxisUp",sdClaim);
-        config.put("yAxisLow",-sdClaim);
+        config.put("yAxisUp", sdClaim);
+        config.put("yAxisLow", -sdClaim);
         config.put("data", JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect));
-        chartDTO.setOption(EchartsFreemarkerUtils.generateChart("/scatter/linesForRange.ftl",config));
+        chartDTO.setOption(EchartsFreemarkerUtils.generateChart("/scatter/linesForRange.ftl", config));
         return chartDTO;
     }
 
     public static void main(String[] args) {
-        double[][] data = {{125,123},
-                {77,74  },
-                {320,315},
-                {303,296},
-                {29,25  },
-                {221,218},
-                {44,40  },
-                {154,154},
-                {388,378},
-                {95,94  },
-                {238,241},
-                {74,71  },
-                {310,306},
-                {370,370},
-                {100,98 },
-                {168,162},
-                {54,58  },
-                {180,183},
-                {210,202},
-                {435,430}};
-        TruenessEP15Patient tr = new TruenessEP15Patient(transposeMatrix(data), 2,0,3);
-        tr.setUnits("mmol/L");
+        InspectionConfigVO config = new InspectionConfigVO("EP15-A2方法学比对", 1, 20,
+                null, 1, LocalDate.now(), true);
+        config.setMethodNum(2);
+        config.setClaimValue(3);
+        config.setUnits("mmol/L");
+        double[][] data = {{125, 123},
+                {77, 74},
+                {320, 315},
+                {303, 296},
+                {29, 25},
+                {221, 218},
+                {44, 40},
+                {154, 154},
+                {388, 378},
+                {95, 94},
+                {238, 241},
+                {74, 71},
+                {310, 306},
+                {370, 370},
+                {100, 98},
+                {168, 162},
+                {54, 58},
+                {180, 183},
+                {210, 202},
+                {435, 430}};
+        TruenessEP15Patient tr = new TruenessEP15Patient(transposeMatrix(data), config);
+
         TableDTO tableDTO = tr.buildDataTableDTO();
         SheetDTO[] sheetDTOS = tr.buildSheetDTO();
         String s = tr.generateResult();

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

@@ -1,10 +1,13 @@
 package com.lc.ibps.components.verification.model2;
 
+import com.lc.ibps.components.verification.model.InspectionConfigVO;
 import com.lc.ibps.components.verification.report.EchartsFreemarkerUtils;
 import com.lc.ibps.components.verification.report.SheetDTO;
 import com.lc.ibps.components.verification.report.TableDTO;
-import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
+import org.apache.commons.math3.linear.MatrixUtils;
+import org.apache.commons.math3.linear.RealMatrix;
 
+import java.time.LocalDate;
 import java.util.*;
 
 public class TruenessRefernece extends PVModel {
@@ -12,15 +15,20 @@ public class TruenessRefernece extends PVModel {
     private List<TruenessReferneceItem> items = new ArrayList<>();
     private String[] specimensName;
 
-    public TruenessRefernece(String[] specimensName, int decimal) {
-        this.specimensName = specimensName;
-        this.setScale(decimal);
-    }
 
-    public void buildItem(String name, double[][] data, double target, double sdClaim, double t) {
-        items.add(new TruenessReferneceItem(name, data, target, sdClaim, t));
+    public TruenessRefernece(double[][] data, InspectionConfigVO configVO) {
+        super(data, configVO);
+        this.specimensName = configVO.getSpecimensName();
+        final RealMatrix realMatrix = MatrixUtils.createRealMatrix(data);
+        for (int i = 0; i < specimensName.length; i++) {
+            double[][] sub = new double[data.length][configVO.getRepeatNum()];
+            realMatrix.copySubMatrix(0, data.length - 1,
+                    i * configVO.getRepeatNum(), (i + 1) * configVO.getRepeatNum() - 1, sub);
+            items.add(new TruenessReferneceItem(specimensName[i], sub, configVO, configVO.getTargetValue()[i]));
+        }
     }
 
+
     @Override
     public TableDTO buildDataTableDTO() {
         String[] h = new String[specimensName.length + 1];
@@ -44,7 +52,7 @@ public class TruenessRefernece extends PVModel {
         }
         temp.add(first);
         for (int i = 0; i < specimensName.length; i++) {
-            temp.addAll(Arrays.<double[]>asList(transposeMatrix(items.get(i).data)));
+            temp.addAll(Arrays.asList(transposeMatrix(items.get(i).data)));
         }
 
         double[][] toArray = temp.toArray(new double[0][0]);
@@ -81,10 +89,11 @@ public class TruenessRefernece extends PVModel {
         reports.put(item.name, table);
         return reports;
     }
+
     @Override
-    public String generateResult(){
+    public String generateResult() {
 
-        return EchartsFreemarkerUtils.generate("/report/truesnessUsingRefernece.ftl",this);
+        return EchartsFreemarkerUtils.generate("/report/truesnessUsingRefernece.ftl", this);
     }
 
     public List<TruenessReferneceItem> getItems() {
@@ -103,18 +112,23 @@ public class TruenessRefernece extends PVModel {
         this.specimensName = specimensName;
     }
 
+
     public static void main(String[] args) {
-        double[][] data = {{2.04, 2.09}, {2.15, 2.04}, {2.09, 1.98}, {2.15, 2.09}, {2.09, 2.04}};
-        TruenessRefernece tr = new TruenessRefernece(new String[]{"test 1", "test 2"}, 3);
-        tr.setUnits("mmol/L");
-        tr.buildItem("test 1", data, 2.2, 0.008, 0);
-        tr.buildItem("test 2", data, 2, 0, 0);
+        InspectionConfigVO config = new InspectionConfigVO("EP15-A2定值参考物质验证", 5, 2,
+                null, 2, LocalDate.now(), true);
+        config.setUnits("mmol/L");
+        config.setTargetValue(new double[]{2.1, 2.2});
+        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}};
+        TruenessRefernece tr = new TruenessRefernece(data, config);
         TableDTO tableDTO = tr.buildDataTableDTO();
         SheetDTO[] sheetDTOS = tr.buildSheetDTO();
         String s = tr.generateResult();
 
-//        ChiSquaredDistribution x2 = new ChiSquaredDistribution( 10 );
-//        double result = x2.inverseCumulativeProbability(1 - 0.05/2);//level
         System.out.println(s);
     }
 }

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

@@ -1,11 +1,12 @@
 package com.lc.ibps.components.verification.model2;
 
+import com.lc.ibps.components.verification.model.InspectionConfigVO;
 import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
 
 public class TruenessReferneceItem {
     protected String name;
     protected double[][] data;
-    private double[] calcData;
+    private final double[] calcData;
 
     private double target;
     private double mean;
@@ -20,7 +21,7 @@ public class TruenessReferneceItem {
     private double sdClaim;//SD assigned value
     private double cse;
 
-    public TruenessReferneceItem(String name, double[][] data, double target, double sdClaim, double t) {
+    public TruenessReferneceItem(String name, double[][] data, InspectionConfigVO configVO, double target) {
         this.name = name;
         this.data = data;
         int i = 0;
@@ -31,7 +32,7 @@ public class TruenessReferneceItem {
             }
         }
         this.target = target;
-        this.sdClaim = sdClaim;
+        this.sdClaim = configVO.getClaimValue();
         if (t == 0) {
             this.t = PVModel.getTValue(calcData.length - 1, 0.01);
         } else {

+ 2 - 2
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/regression/MultipleLinearRegression.java

@@ -3,7 +3,7 @@ package com.lc.ibps.components.verification.regression;
 import org.apache.commons.math3.stat.regression.OLSMultipleLinearRegression;
 
 //多元线性回归 f(x, y . . .) = b0 + b1 * x + b2 * y + …
-public class MultipleLinearRegression extends Regression{
+public class MultipleLinearRegression extends Regression {
 
     private final OLSMultipleLinearRegression ols;
 
@@ -39,7 +39,7 @@ public class MultipleLinearRegression extends Regression{
         StringBuilder function = new StringBuilder("y =  ");
         for (int i = 0; i < parameters.length; i++) {
             function.append(parameters[i]).append("x").append(i);
-            if (i != (parameters.length -1)) {
+            if (i != (parameters.length - 1)) {
                 function.append(" + ");
             }
 

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

@@ -5,8 +5,9 @@ import org.apache.commons.math3.stat.regression.OLSMultipleLinearRegression;
 
 import java.util.ArrayList;
 import java.util.List;
+
 //多项式回归 y = b0 + b1 * x + b2 * x^2 + …
-public class PolynomialRegression extends Regression{
+public class PolynomialRegression extends Regression {
 
     private final OLSMultipleLinearRegression ols;
 
@@ -42,21 +43,21 @@ public class PolynomialRegression extends Regression{
 
     }
 
-    private void generateTValue(){
+    private void generateTValue() {
         tValues = new double[getParameters().length];
         for (int i = 0; i < getParameters().length; i++) {
             tValues[i] = getParameters()[i] / getStdErrors()[i];
         }
         t = PVModel.getTValue(getDfDependent(), 0.05);
-        if (getParameters().length >2) {
+        if (getParameters().length > 2) {
             for (int i = 2; i < getParameters().length; i++) {
-                if(tValues[i] > 0){
-                    if(tValues[i] > t) {
+                if (tValues[i] > 0) {
+                    if (tValues[i] > t) {
                         isNonlinear = true;
                         break;
                     }
-                } else{
-                    if(tValues[i] < -t){
+                } else {
+                    if (tValues[i] < -t) {
                         isNonlinear = true;
                         break;
                     }
@@ -65,6 +66,7 @@ public class PolynomialRegression extends Regression{
         }
 
     }
+
     /**
      * 生成多项式自变量数据
      */
@@ -97,7 +99,7 @@ public class PolynomialRegression extends Regression{
                     function.append("*");
                 }
             }
-            if (i != (parameters.length -1)) {
+            if (i != (parameters.length - 1)) {
                 function.append(" + ");
             }
 
@@ -105,11 +107,11 @@ public class PolynomialRegression extends Regression{
         return function.toString();
     }
 
-    public double calcFunc(double x){
+    public double calcFunc(double x) {
         double[] parameters = this.getParameters();
         double y = parameters[0];
         for (int i = 1; i < parameters.length; i++) {
-            y = y + Math.pow(x,i) * parameters[i];
+            y = y + Math.pow(x, i) * parameters[i];
         }
         return y;
     }

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

@@ -2,8 +2,9 @@ package com.lc.ibps.components.verification.regression;
 
 import org.apache.commons.math3.stat.regression.RegressionResults;
 import org.apache.commons.math3.stat.regression.SimpleRegression;
+
 //一元线性回归 y = b0 + b1 * x
-public class SimpleLinearRegression extends Regression{
+public class SimpleLinearRegression extends Regression {
 
     private final SimpleRegression regression;
 
@@ -25,7 +26,7 @@ public class SimpleLinearRegression extends Regression{
         this.setAdjRSquared(results.getAdjustedRSquared());
         this.setStdErrors(results.getStdErrorOfEstimates());
 
-        this.setFValue((results.getRegressionSumSquares()) / (results.getErrorSumSquares()  / (data.length -2)) );
+        this.setFValue((results.getRegressionSumSquares()) / (results.getErrorSumSquares() / (data.length - 2)));
 
     }
 

+ 20 - 20
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/regression/StatisticsTest.java

@@ -21,8 +21,8 @@ public class StatisticsTest {
 
         re.addData(data);
 
-        System.out.println("R方为"+ re.getRSquared());
-        System.out.println("调整R方为"+ re.getAdjRSquared());
+        System.out.println("R方为" + re.getRSquared());
+        System.out.println("调整R方为" + re.getAdjRSquared());
         System.out.println(re.getFunction());
         System.out.println("标准误为:" + re.getStdErrors()[0]);
 
@@ -39,7 +39,8 @@ public class StatisticsTest {
         }
         return data.stream().toArray(double[][]::new);
     }
-//多项式回归测试
+
+    //多项式回归测试
     public static void test2() {
         // 自变量数据
 //        double[] xArray = new double[100];
@@ -66,21 +67,21 @@ public class StatisticsTest {
 //        w.add(14.74,14.65);
 //        w.add(19.65,19.61);
 //        w.add(24.56,24.06);
-        double[] xArray = {0,4.91,9.82,14.74,19.65,24.56};
-        double[] yArray = {-0.01,5,10.12,14.65,19.61,24.06};
+        double[] xArray = {0, 4.91, 9.82, 14.74, 19.65, 24.56};
+        double[] yArray = {-0.01, 5, 10.12, 14.65, 19.61, 24.06};
         final PolynomialRegression po = new PolynomialRegression();
         po.addData(xArray, yArray, 1, 3);
 
-        System.out.println("R方为"+ po.getRSquared());
-        System.out.println("调整R方为"+ po.getAdjRSquared());
+        System.out.println("R方为" + po.getRSquared());
+        System.out.println("调整R方为" + po.getAdjRSquared());
         System.out.println(po.getFunction());
         System.out.println("标准误为:" + Arrays.toString(po.getStdErrors()));
 
-        System.out.println("f值:" + po.getFValue() );
+        System.out.println("f值:" + po.getFValue());
 //        System.out.println("f检验P值:" + StatisticsUtil.getPValue(po.getFValue(), 3, yArray.length - 4));
         TDistribution t = new TDistribution(16);
 //        t.inverseCumulativeProbability(1 - p/2);
-        System.out.println((1-t.cumulativeProbability(0.5)));
+        System.out.println((1 - t.cumulativeProbability(0.5)));
 
 //        单样本t检验 (单样本 t 检验是一种用于检验一个样本均值是否与一个已知的总体均值显著不同的统计学方法。在单样本 t 检验中,我们需要计算一个 t 统计量,其基于样本均值、样本标准差和样本大小,然后使用 t 分布表来确定 p 值)
         //////////////////////
@@ -99,9 +100,9 @@ public class StatisticsTest {
         System.out.println("样本数据的标准差为:" + Math.sqrt(StatUtils.variance(sampleData)));
         System.out.println("总体均值为:" + populationMean);
         System.out.println("p值为:" + pValue);
-        System.out.println("t: "+ TestUtils.t(populationMean, sampleData));
-        System.out.println("p: "+TestUtils.tTest(populationMean, sampleData));
-        System.out.println("显著性水平: "+TestUtils.tTest(populationMean, sampleData, 0.05));
+        System.out.println("t: " + TestUtils.t(populationMean, sampleData));
+        System.out.println("p: " + TestUtils.tTest(populationMean, sampleData));
+        System.out.println("显著性水平: " + TestUtils.tTest(populationMean, sampleData, 0.05));
 
 // 判断p值是否小于0.05,如果小于0.05则拒绝零假设
         if (pValue < 0.05) {
@@ -111,8 +112,6 @@ public class StatisticsTest {
         }
 
 
-
-
 //        5) 卡方检验(用于确定观察到的频数与期望的频数之间是否存在显著差异)
 
         long[] observed = {10, 9, 11};
@@ -134,7 +133,7 @@ public class StatisticsTest {
 // 定义三个组的数据
         double[] group1 = {93.0, 103.0, 95.0, 101.0, 91.0, 105.0, 96.0, 94.0, 101.0};
         double[] group2 = {99.0, 92.0, 102.0, 100.0, 102.0, 89.0};
-        double[] group3 = {110.0, 115.0, 111.0, 117.0, 128.0, 117.0 };
+        double[] group3 = {110.0, 115.0, 111.0, 117.0, 128.0, 117.0};
 
 // 将三个组的数据合并到一个二维数组中
         ArrayList<double[]> classes = new ArrayList<>();
@@ -154,9 +153,10 @@ public class StatisticsTest {
 //另外的方法
         double fStatistic = TestUtils.oneWayAnovaFValue(classes); // F-value
         double pValue2 = TestUtils.oneWayAnovaPValue(classes);     // P-value
-        System.out.println("F: "+fStatistic);
-        System.out.println("P: "+pValue2);
+        System.out.println("F: " + fStatistic);
+        System.out.println("P: " + pValue2);
     }
+
     //多元回归分析测试
     public static void test3() {
         double[][] x = randomX3();
@@ -166,10 +166,10 @@ public class StatisticsTest {
         mul.addData(x, y, 2);
 
         System.out.println(mul.getFunction());
-        System.out.println("标准误: "  + mul.getStdErrors()[0]);
+        System.out.println("标准误: " + mul.getStdErrors()[0]);
         System.out.println("R方 : " + mul.getRSquared());
         System.out.println("调整后R方 :" + mul.getAdjRSquared());
-        System.out.println("f值:" + mul.getFValue()) ;
+        System.out.println("f值:" + mul.getFValue());
 
 //        System.out.println("f检验P值:" + StatisticsUtil.getPValue(mul.getFValue(), mul.getDfIndependent(), mul.getDfDependent() ));
     }
@@ -204,7 +204,7 @@ public class StatisticsTest {
         return 20 + 2 * x1 + 3 * x2 + Math.random() * 30;
     }
 
-    public static void main(String[] args){
+    public static void main(String[] args) {
         test2();
     }
 }

+ 13 - 5
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/regression/StatisticsUtil.java

@@ -16,14 +16,15 @@ import static com.lc.ibps.components.verification.regression.AnalysisConstants.S
 /**
  * Statistics
  * 统计工具类,使用统计工具用于做统计学数据分析,将计算方法进行集成调用
+ *
  * @author pyy
  * @since 2022/9/23 17:07
  */
 public class StatisticsUtil {
 
-    private final  StatisticsUtil stat = new StatisticsUtil();
+    private final StatisticsUtil stat = new StatisticsUtil();
 
-    private static final double  NO_VALUE = Double.NaN;
+    private static final double NO_VALUE = Double.NaN;
 
     private StatisticsUtil() {
     }
@@ -36,6 +37,7 @@ public class StatisticsUtil {
 
     /**
      * 计算数据均值
+     *
      * @param values 双精度数组
      * @return 平均值
      */
@@ -49,6 +51,7 @@ public class StatisticsUtil {
 
     /**
      * 计算数据标准差
+     *
      * @param values 双精度数组
      * @return 标准差
      */
@@ -62,6 +65,7 @@ public class StatisticsUtil {
 
     /**
      * 获取数据最大值
+     *
      * @param values 双精度数组
      * @return 最大值
      */
@@ -76,6 +80,7 @@ public class StatisticsUtil {
 
     /**
      * 获取数据最小值
+     *
      * @param values 双精度数组
      * @return 最小值
      */
@@ -89,6 +94,7 @@ public class StatisticsUtil {
 
     /**
      * 获取数据最大值和最小值
+     *
      * @param values - 双精度数组
      * @return map<String, Double>
      */
@@ -108,8 +114,9 @@ public class StatisticsUtil {
 
     /**
      * 计算两个数据之间的相关系数
-     * @param xArray -- 双精度数组
-     * @param yArray -- 双精度数组
+     *
+     * @param xArray   -- 双精度数组
+     * @param yArray   -- 双精度数组
      * @param methodId -- 相关系数方法
      * @return double
      */
@@ -135,6 +142,7 @@ public class StatisticsUtil {
 
     /**
      * 计算两个数据之间的相关系数
+     *
      * @param xArray -- 双精度数组
      * @param yArray -- 双精度数组
      * @return double
@@ -146,6 +154,7 @@ public class StatisticsUtil {
 
     /**
      * 判空
+     *
      * @param values 双精度数组
      * @return boolean
      */
@@ -154,5 +163,4 @@ public class StatisticsUtil {
     }
 
 
-
 }

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

@@ -6,7 +6,8 @@ public class ChartDTO {
     private String option;
 
     private String name;
-    public ChartDTO(String name){
+
+    public ChartDTO(String name) {
         this.name = name;
     }
 

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

@@ -15,12 +15,13 @@ public class EchartsFreemarkerUtils {
 
     /**
      * 加载模板并生成ECharts的option数据字符串
+     *
      * @param templateFileName
      * @param data
      * @return {@link String}
      */
     public static String generateChart(String templateFileName, Map<String, Object> data) {
-        return generate(templateFileName,data).replaceAll( "\\s*|\t|\r|\n", "" );
+        return generate(templateFileName, data).replaceAll("\\s*|\t|\r|\n", "");
     }
 
     public static String generate(String templateFileName, Object data) {
@@ -44,7 +45,7 @@ public class EchartsFreemarkerUtils {
         return null;
     }
 
-    public static void main(String[] args){
+    public static void main(String[] args) {
         final String generate = generateChart("test.ftl", new HashMap<>());
         System.out.println(generate);
     }

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

@@ -1,10 +1,8 @@
 package com.lc.ibps.components.verification.report;
 
-import java.util.Map;
-
 public class ReportDataDTO {
 
-    private TableDTO   dataDTO;
+    private TableDTO dataDTO;
     private SheetDTO[] sheetDTO;
 
 

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

@@ -4,10 +4,10 @@ import com.lc.ibps.components.verification.model2.PVItemBuilder;
 
 public class ReportFactory {
 
-    public static ReportDataDTO build(PVItemBuilder builder){
+    public static ReportDataDTO build(PVItemBuilder builder) {
         ReportDataDTO data = new ReportDataDTO();
         data.setDataDTO(builder.getPvModel().buildDataTableDTO());
         data.setSheetDTO(builder.getPvModel().buildSheetDTO());
-        return  data;
+        return data;
     }
 }

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

@@ -8,14 +8,14 @@ public class SheetDTO {
 
 //    private String[] steps;
 
-    public SheetDTO(String title){
+    public SheetDTO(String title) {
         this.title = title;
     }
 
 
     private Map<String, TableDTO> reportDataDTO;
 
-    private Map<String,ChartDTO> chartDataDTO;
+    private Map<String, ChartDTO> chartDataDTO;
 
     public String getTitle() {
         return title;

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

@@ -13,53 +13,53 @@ public class TableDTO {
 
     private String note;
 
-    public void buildHeader(String[] h, Map<String,String[]> child){
+    public void buildHeader(String[] h, Map<String, String[]> child) {
         header = new Map[h.length];
         int k = 0;
         for (int i = 0; i < h.length; i++) {
             HashMap<String, Object> m = new HashMap<>();
-            m.put("label",h[i]);
+            m.put("label", h[i]);
 
-            if(child != null && child.containsKey(h[i])){
-                m.put("prop","");
+            if (child != null && child.containsKey(h[i])) {
+                m.put("prop", "");
                 String[] c = child.get(h[i]);
 
                 Map<String, Object>[] cm = new Map[c.length];
                 for (int j = 0; j < c.length; j++) {
                     HashMap<String, Object> mm = new HashMap<>();
-                    mm.put("label",c[j]);
-                    mm.put("prop",String.valueOf((char)(65+k++)));
+                    mm.put("label", c[j]);
+                    mm.put("prop", String.valueOf((char) (65 + k++)));
                     cm[j] = mm;
                 }
-                m.put("children",cm);
-            }else{
-                m.put("prop",String.valueOf((char)(65+k++)));
+                m.put("children", cm);
+            } else {
+                m.put("prop", String.valueOf((char) (65 + k++)));
             }
             header[i] = m;
         }
     }
 
-    public void buildHeader(String[] h ){
-        buildHeader(h,null);
+    public void buildHeader(String[] h) {
+        buildHeader(h, null);
     }
 
-    public void buildData(String[][] data){
+    public void buildData(String[][] data) {
         list = new Map[data.length];
         for (int i = 0; i < data.length; i++) {
             HashMap<String, Object> m = new HashMap<>();
             for (int j = 0; j < data[0].length; j++) {
-                m.put(String.valueOf((char)(65+j)), data[i][j]);
+                m.put(String.valueOf((char) (65 + j)), data[i][j]);
             }
             list[i] = m;
         }
     }
 
-    public void buildData(double[][] data,int scale){
+    public void buildData(double[][] data, int scale) {
         list = new Map[data.length];
         for (int i = 0; i < data.length; i++) {
             HashMap<String, Object> m = new HashMap<>();
             for (int j = 0; j < data[0].length; j++) {
-                m.put(String.valueOf((char)(65+j)), PVModel.format( data[i][j],scale));
+                m.put(String.valueOf((char) (65 + j)), PVModel.format(data[i][j], scale));
             }
             list[i] = m;
         }

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

@@ -9,12 +9,12 @@ import java.io.IOException;
 public interface PerformanceVerificationService {
 
     ReportDataDTO importExcelRecord(
-                                       String id,
-                                       MultipartFile applyFiles) throws IOException;
+            String id,
+            MultipartFile applyFiles) throws IOException;
 
     Workbook exportExcelTemplateExport(String id);
 
-    Workbook exportExcelReport( String id);
+    Workbook exportExcelReport(String id);
 
     ReportDataDTO getReportRecord(String id);
 }

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

@@ -25,6 +25,7 @@ public class PerformanceVerificationServiceImpl implements PerformanceVerificati
 
     @Resource
     private ExperimentalRepository experimentalRepository;
+
     @Override
     public ReportDataDTO importExcelRecord(String id, MultipartFile applyFiles) throws IOException {
 
@@ -39,7 +40,7 @@ public class PerformanceVerificationServiceImpl implements PerformanceVerificati
 //            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(dataDTO, SerializerFeature.DisableCircularReferenceDetect));
         experimental.getData().setShiYanJieLun(builder.getPvModel().generateResult());
         experimental.save();
         return dataDTO;
@@ -59,7 +60,7 @@ public class PerformanceVerificationServiceImpl implements PerformanceVerificati
         ExperimentalPo experimentalPo = experimentalRepository.get(id);
         InspectionItemVO item = JSON.parseObject(experimentalPo.getShiYanShuJu(), InspectionItemVO.class);
 
-        if(item == null) throw new RuntimeException("can't find this config");
+        if (item == null) throw new RuntimeException("can't find this config");
 //        inspectionVO.getItem().add(item);
 //        Workbook workbook = inspectionVO.exportExcelReport(StringUtils.isNotBlank(item.get));
         return null;
@@ -72,7 +73,7 @@ public class PerformanceVerificationServiceImpl implements PerformanceVerificati
         return null;
     }
 
-    private InspectionConfigVO getInspectionConfig( String id) {
+    private InspectionConfigVO getInspectionConfig(String id) {
 
         ExperimentalPo experimentalPo = experimentalRepository.get(id);
         String shiYanCanShu = experimentalPo.getShiYanCanShu();
@@ -80,10 +81,10 @@ public class PerformanceVerificationServiceImpl implements PerformanceVerificati
         config.setName(experimentalPo.getFangAnLeiXing());
         config.setDecimal(Integer.valueOf(experimentalPo.getBaoLiuXiaoShu()));
         config.setUnits(experimentalPo.getJieGuoDanWei());
-        if(ArrayUtils.isEmpty(config.getSpecimensName())){
+        if (ArrayUtils.isEmpty(config.getSpecimensName())) {
             String[] names = new String[config.getSpecimensNum()];
             for (int i = 0; i < config.getSpecimensNum(); i++) {
-                names[i] = String.format("水平 %d",i+1);
+                names[i] = String.format("水平 %d", i + 1);
             }
             config.setSpecimensName(names);
         }

+ 1 - 1
ibps-provider-root/modules/provider-business/src/main/resources/pv/report/precisionEP15A2.ftl

@@ -20,4 +20,4 @@ SDl 或 CV 小于厂家声明的实验室标准差则通过验
 
 精密度或标准差应≤TEa 的 1/4。b. 批间精密度或
 
-标准差应≤TEa 的 1/3。
+标准差应≤TEa 的 1/3。±