From 56c8bc18def3992259da50948119259f571d04ee Mon Sep 17 00:00:00 2001
From: zhijie <1003392067@qq.com>
Date: 星期二, 08 六月 2021 23:25:39 +0800
Subject: [PATCH] MAQ简易版泰文支持,SAQ简易版支持

---
 src/main/java/com/ots/project/tool/report/RuilinMAQ/condition/RuilinTestResultValidityDiagnosis.java        |    1 
 src/main/java/com/ots/project/tool/report/MAQNEW/condition/ResponseFidelityDiagnosisTitle_V2.java           |    1 
 src/main/java/com/ots/project/tool/report/MAQ/condition/ResponseFidelityDiagnosis.java                      |    1 
 src/main/java/com/ots/project/tool/report/MAQNEW/condition/PrimaryLeadershipStyleContext_V2.java            |    1 
 src/main/java/com/ots/project/tool/report/MAQ/condition/PrimaryLeadershipStyleContext.java                  |    1 
 src/main/java/com/ots/project/tool/report/SAQ/condition/ResponseFidelityDiagnosisSAQ.java                   |    1 
 src/main/java/com/ots/project/tool/report/MAQNEW/MAQReport_V2.java                                          |    9 
 src/main/java/com/ots/project/tool/report/MAQNEW/condition/KeyPointsCautions_V2.java                        |    1 
 src/main/java/com/ots/project/tool/report/MAQNEW/base/BaseCondition_V2.java                                 |    7 
 src/main/java/com/ots/project/tool/report/SAQ/chart/SAQChart.java                                           |  377 ++++++++++++++++++++++++++
 src/main/java/com/ots/project/tool/exam/ExamUtil.java                                                       |   14 
 src/main/java/com/ots/project/tool/report/SAQ/condition/ResponseFidelityDiagnosisSAQTitle.java              |    1 
 src/main/java/com/ots/project/tool/report/MAQNEW/condition/KeyPointsStrengths_V2.java                       |    1 
 src/main/java/com/ots/project/tool/report/SAQ/chart/RowData.java                                            |   23 +
 src/main/java/com/ots/project/tool/report/SAQ/gs/condition/ResponseFidelityDiagnosisSAQGsTitle.java         |   77 +++++
 src/main/java/com/ots/project/tool/report/SAQ/SAQReport.java                                                |   39 ++
 src/main/java/com/ots/project/tool/report/MAQ/condition/ResponseFidelityDiagnosisTitle.java                 |    1 
 src/main/java/com/ots/project/tool/report/SAQ/gs/condition/ResponseFidelityDiagnosisSAQGs.java              |  136 +++++++++
 src/main/java/com/ots/project/tool/exam/ImageUtil.java                                                      |   18 +
 src/main/java/com/ots/project/tool/report/MAQNEW/condition/ResponseFidelityDiagnosis_V2.java                |    3 
 src/main/java/com/ots/project/tool/report/MAQ/base/BaseCondition.java                                       |   17 +
 src/main/java/com/ots/project/tool/report/MAQ/condition/KeyPointsStrengths.java                             |    1 
 src/main/java/com/ots/common/utils/poi/WordUtil.java                                                        |   23 
 src/main/java/com/ots/project/tool/report/RuilinMAQ/condition/RuilinTestResultValidityDiagnosisContext.java |    1 
 src/main/java/com/ots/project/tool/report/SAQ/chart/SeriesData.java                                         |   26 +
 src/main/java/com/ots/project/tool/report/MAQ/condition/KeyPointsCautions.java                              |    1 
 26 files changed, 757 insertions(+), 25 deletions(-)

diff --git a/src/main/java/com/ots/common/utils/poi/WordUtil.java b/src/main/java/com/ots/common/utils/poi/WordUtil.java
index ff01e4b..2e97d4a 100644
--- a/src/main/java/com/ots/common/utils/poi/WordUtil.java
+++ b/src/main/java/com/ots/common/utils/poi/WordUtil.java
@@ -17,6 +17,7 @@
 import com.ots.project.tool.report.JAQ.condition.Table2;
 import com.ots.project.tool.report.JAQ.condition.Table3;
 import com.ots.project.tool.report.JAQ.condition.Table4;
+import com.ots.project.tool.report.SAQ.chart.SAQChart;
 import org.apache.commons.collections.map.HashedMap;
 import org.apache.poi.ooxml.POIXMLDocument;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
@@ -177,6 +178,9 @@
                 if (run.toString().indexOf("%TTime%") != -1) {
                     run.setText(textMap.get("reportGenerationDate").toString(), 0);
                 }
+                if (run.toString().indexOf("%LIBSAQGS0018%") != -1) {
+                    run.setText(textMap.get("LIBSAQGS0018").toString(), 0);
+                }
             }
         }
     }
@@ -254,7 +258,7 @@
     public static CTAnchor getAnchorWithGraphic(CTGraphicalObject ctGraphicalObject,
                                                 String deskFileName, int width, int height,
                                                 int leftOffset, int topOffset, boolean behind, int topPosition) {
-        long relativeHeight = 251649024l + topPosition;
+        long relativeHeight = 251649024L + topPosition;
         String anchorXML =
                 "<wp:anchor xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" "
                         + "simplePos=\"0\" relativeHeight=\"" + relativeHeight + "\" behindDoc=\"" + ((behind) ? 1 : 0) + "\" locked=\"0\" layoutInCell=\"1\" allowOverlap=\"1\">"
@@ -430,7 +434,7 @@
     }
     
     public static String changeValue(String runValue, Map<String, Object> textMap, XWPFRun run, XWPFParagraph paragraph, XWPFDocument document, int runPosition) throws IOException, org.apache.poi.openxml4j.exceptions.InvalidFormatException {
-        
+        log.debug("changeText:{}",runValue);
         Set<Map.Entry<String, Object>> textSets = textMap.entrySet();
         for (Map.Entry<String, Object> textSet : textSets) {
             
@@ -841,17 +845,13 @@
         //璁剧疆鏂囨湰
         changeText(document, textMap);
 
-        //鏇存敼鏂囨湰妗�
-/*        if (Objects.equals(reportType, ReportTypeEnum.MAQV2.getCode()) || Objects.equals(reportType, ReportTypeEnum.JAQ.getCode()) ) {
-            changeTextBox(document, textMap);
-        }*/
-
+        //璁剧疆鏂囨湰妗�
         changeTextBox(document, textMap);
 
-        //CAQ鏇存敼鏂囨湰妗嗭紝wzp娴嬭瘯.2021.4.27
-/*        if (Objects.equals(reportType, ReportTypeEnum.CAQ.getCode())) {
-            changeTextBox(document, textMap);
-        }*/
+        //璁剧疆鍥捐〃
+        if (Objects.equals(reportType, ReportTypeEnum.SAQ.getCode())) {
+            SAQChart.changeChart(document, textMap);
+        }
 
         //鎻掑叆琛ㄦ牸
         addTableValue(document, autoTableMap);
@@ -888,6 +888,7 @@
         }
     }
     private static String getValByKey(String text, Map<String, Object> textMap) {
+        log.debug("changeTextBox:{}",text);
         if (!checkText(text)) {
             return text;
         }
diff --git a/src/main/java/com/ots/project/tool/exam/ExamUtil.java b/src/main/java/com/ots/project/tool/exam/ExamUtil.java
index ccc5170..51d0b80 100644
--- a/src/main/java/com/ots/project/tool/exam/ExamUtil.java
+++ b/src/main/java/com/ots/project/tool/exam/ExamUtil.java
@@ -26,10 +26,16 @@
         productTypeMap.put("SAQ", "SAQ");
         productTypeMap.put("JAQ", "JAQ");
     }
+
+    /**
+     * 璁剧疆姘存淮鑳屾櫙瀵瑰簲鍥剧墖
+     */
     private static void setWaterDropAndBar() {
-        
+        //姘存淮鍥剧墖
         waterDropPictureMap.put("ResponseFidelityDiagnosis", "waterDropDarkBlue.png");
         waterDropPictureMap.put("ResponseFidelityDiagnosis_V2", "waterDropDarkBlue_V2.png");
+        //SAQ绠�鏄撶増
+        waterDropPictureMap.put("ResponseFidelityDiagnosisSAQGs", "waterDropDarkBlue_V2.png");
         
         waterDropPictureMap.put("ResponseFidelityDiagnosisSAQ", "waterDropDarkBlue.png");
         
@@ -55,7 +61,7 @@
         waterDropPictureMap.put("CooperationTeamwork", "waterDropLightBlue.png");
         waterDropPictureMap.put("Empathetic", "waterDropLightBlue.png");
         waterDropPictureMap.put("PoliteTactful", "waterDropLightBlue.png");
-        
+        //鑳屾櫙瀵艰埅鏉�
         barPictureMap.put("ResponseFidelityDiagnosis_waterDrops1", "Bar1.png");
         barPictureMap.put("ResponseFidelityDiagnosis_V2_waterDrops1", "Bar1_V2.png");
         barPictureMap.put("ResponseFidelityDiagnosis_waterDrops2", "Bar1.png");
@@ -66,6 +72,10 @@
         barPictureMap.put("ResponseFidelityDiagnosisSAQ_waterDrops1", "Bar1.png");
         barPictureMap.put("ResponseFidelityDiagnosisSAQ_waterDrops2", "Bar1.png");
         barPictureMap.put("ResponseFidelityDiagnosisSAQ_waterDrops3", "Bar2.png");
+        //澧炲姞SAQ绠�鏄撶増
+        barPictureMap.put("ResponseFidelityDiagnosisSAQGs_waterDrops1", "Bar1_V2.png");
+        barPictureMap.put("ResponseFidelityDiagnosisSAQGs_waterDrops2", "Bar1_V2.png");
+        barPictureMap.put("ResponseFidelityDiagnosisSAQGs_waterDrops3", "Bar2_V2.png");
         
         barPictureMap.put("RuilinTestResultValidityDiagnosisContext_waterDrops1", "RuiLin1.png");
         barPictureMap.put("RuilinTestResultValidityDiagnosisContext_waterDrops2", "RuiLin1.png");
diff --git a/src/main/java/com/ots/project/tool/exam/ImageUtil.java b/src/main/java/com/ots/project/tool/exam/ImageUtil.java
index b0c1724..dcf2dcd 100644
--- a/src/main/java/com/ots/project/tool/exam/ImageUtil.java
+++ b/src/main/java/com/ots/project/tool/exam/ImageUtil.java
@@ -85,6 +85,15 @@
         }
         return width;
     }
+
+    /**
+     * 鍒涘缓姘存淮鍥剧墖
+     * @param key
+     * @param waterDrop
+     * @param scorceF
+     * @param member_id
+     * @param suffixDate
+     */
     public static void creteWaterDropPic(String key, String waterDrop, float scorceF, String member_id, String suffixDate) {
         int CANVAS_W = 1000; 
         int CANVAS_H = 96; 
@@ -101,6 +110,13 @@
             barImageY = 5;
         }
         if (key.indexOf("ResponseFidelityDiagnosis_V2") != -1) {
+            CANVAS_H = 400;
+            waterDropImageX = -30;
+            scorce100 = 800;
+            barImageY = 5;
+            waterDropImageY = 0;
+        }
+        if (key.indexOf("ResponseFidelityDiagnosisSAQGs") != -1) {
             CANVAS_H = 400;
             waterDropImageX = -30;
             scorce100 = 800;
@@ -163,7 +179,7 @@
         
         int waterDropOffsetX = setWaterDrop(waterDrop, waterDropImageX, waterDropImageY, scorce100, scorce, g2d, waterDropImage);
         
-        if (key.indexOf("ResponseFidelityDiagnosis_V2") != -1) {
+        if (key.indexOf("ResponseFidelityDiagnosis_V2") != -1 || key.indexOf("ResponseFidelityDiagnosisSAQGs") != -1) {
         	setTextV2(String.valueOf(Math.round(scorceF)), g2d, waterDropOffsetX);
         }else{
         	setText(String.valueOf(Math.round(scorceF)), g2d, waterDropOffsetX);
diff --git a/src/main/java/com/ots/project/tool/report/MAQ/base/BaseCondition.java b/src/main/java/com/ots/project/tool/report/MAQ/base/BaseCondition.java
index 5176400..c8e53e8 100644
--- a/src/main/java/com/ots/project/tool/report/MAQ/base/BaseCondition.java
+++ b/src/main/java/com/ots/project/tool/report/MAQ/base/BaseCondition.java
@@ -4,6 +4,7 @@
 import com.ots.project.tool.CacheServiceFactory;
 import lombok.extern.slf4j.Slf4j;
 import java.util.Arrays;
+import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 @Slf4j
@@ -12,8 +13,17 @@
     public abstract String getName();
     
     public abstract TLibraryCode calculate(Map<String, String> map, LangTypeEnum langType);
+    public List<TLibraryCode> calculateList(Map<String, String> map, LangTypeEnum langType){
+        return null;
+    }
     
     public abstract Map<String, String> getMAQwaterDropsImages();
+
+    /**
+     * 鏍规嵁鍙傛暟鑾峰彇鍛戒腑鐨勬寚鏍�
+     * @param calculateMap
+     * @return
+     */
     protected String selectTrueObject(Map<Boolean, String> calculateMap) {
         for (Map.Entry<Boolean, String> entry : calculateMap.entrySet()) {
             Boolean mapKey = entry.getKey();
@@ -56,6 +66,13 @@
         dynamicParameterSubstitution(map, result, langType);
         return result;
     }
+
+    /**
+     * 鎶ュ憡瀛楀吀閲岄潰杩樻湁%%鍙橀噺 杩涜鏇挎崲
+     * @param map
+     * @param maqReportLibrary
+     * @param langType
+     */
     public void dynamicParameterSubstitution(Map<String, String> map, TLibraryCode maqReportLibrary, LangTypeEnum langType) {
         map.forEach((key, value) -> {
             String content = maqReportLibrary.getLangTypeContext(langType);
diff --git a/src/main/java/com/ots/project/tool/report/MAQ/condition/KeyPointsCautions.java b/src/main/java/com/ots/project/tool/report/MAQ/condition/KeyPointsCautions.java
index 439d434..b0598af 100644
--- a/src/main/java/com/ots/project/tool/report/MAQ/condition/KeyPointsCautions.java
+++ b/src/main/java/com/ots/project/tool/report/MAQ/condition/KeyPointsCautions.java
@@ -18,6 +18,7 @@
 @Slf4j
 public class KeyPointsCautions extends BaseCondition {
     private String name = "KeyPointsCautions";
+    @Override
     public TLibraryCode calculate(Map<String, String> map, LangTypeEnum langType) {
         try {
             Map<String, String> paramMap = new HashMap();
diff --git a/src/main/java/com/ots/project/tool/report/MAQ/condition/KeyPointsStrengths.java b/src/main/java/com/ots/project/tool/report/MAQ/condition/KeyPointsStrengths.java
index b3d4561..7a1d978 100644
--- a/src/main/java/com/ots/project/tool/report/MAQ/condition/KeyPointsStrengths.java
+++ b/src/main/java/com/ots/project/tool/report/MAQ/condition/KeyPointsStrengths.java
@@ -17,6 +17,7 @@
 @Slf4j
 public class KeyPointsStrengths extends BaseCondition {
     private String name = "KeyPointsStrengths";
+    @Override
     public TLibraryCode calculate(Map<String, String> map, LangTypeEnum langType) {
         try {
             Map<String, String> paramMap = new HashMap();
diff --git a/src/main/java/com/ots/project/tool/report/MAQ/condition/PrimaryLeadershipStyleContext.java b/src/main/java/com/ots/project/tool/report/MAQ/condition/PrimaryLeadershipStyleContext.java
index f5e02a4..82cf9e9 100644
--- a/src/main/java/com/ots/project/tool/report/MAQ/condition/PrimaryLeadershipStyleContext.java
+++ b/src/main/java/com/ots/project/tool/report/MAQ/condition/PrimaryLeadershipStyleContext.java
@@ -13,6 +13,7 @@
 @Slf4j
 public class PrimaryLeadershipStyleContext extends BaseCondition {
     private String name = "PrimaryLeadershipStyleContext";
+    @Override
     public TLibraryCode calculate(Map<String, String> map, LangTypeEnum langType) {
         try {
             String p_task31 = map.get("P_Task31");
diff --git a/src/main/java/com/ots/project/tool/report/MAQ/condition/ResponseFidelityDiagnosis.java b/src/main/java/com/ots/project/tool/report/MAQ/condition/ResponseFidelityDiagnosis.java
index 3c44521..a68567e 100644
--- a/src/main/java/com/ots/project/tool/report/MAQ/condition/ResponseFidelityDiagnosis.java
+++ b/src/main/java/com/ots/project/tool/report/MAQ/condition/ResponseFidelityDiagnosis.java
@@ -25,6 +25,7 @@
         map.put(name + IMAGE_PREFIX + "3", Objects.isNull(P_INCON25) ? "0" : String.valueOf(P_INCON25));
         return map;
     }
+    @Override
     public TLibraryCode calculate(Map<String, String> map, LangTypeEnum langType) {
         try {
             String p_sde_t1 = map.get("P_SDE_T1");
diff --git a/src/main/java/com/ots/project/tool/report/MAQ/condition/ResponseFidelityDiagnosisTitle.java b/src/main/java/com/ots/project/tool/report/MAQ/condition/ResponseFidelityDiagnosisTitle.java
index 3492fbd..33e9021 100644
--- a/src/main/java/com/ots/project/tool/report/MAQ/condition/ResponseFidelityDiagnosisTitle.java
+++ b/src/main/java/com/ots/project/tool/report/MAQ/condition/ResponseFidelityDiagnosisTitle.java
@@ -21,6 +21,7 @@
     public Map<String, String> getMAQwaterDropsImages() {
         return null;
     }
+    @Override
     public TLibraryCode calculate(Map<String, String> map, LangTypeEnum langType) {
         try {
             String p_sde_t1 = map.get("P_SDE_T1");
diff --git a/src/main/java/com/ots/project/tool/report/MAQNEW/MAQReport_V2.java b/src/main/java/com/ots/project/tool/report/MAQNEW/MAQReport_V2.java
index 3c17d5b..82f8149 100644
--- a/src/main/java/com/ots/project/tool/report/MAQNEW/MAQReport_V2.java
+++ b/src/main/java/com/ots/project/tool/report/MAQNEW/MAQReport_V2.java
@@ -228,12 +228,9 @@
             List<TLibraryCode> tLibraryCodes = p.calculateList(thaiCalculationMap, langType);
             if(tLibraryCodes != null && tLibraryCodes.size() > 0){
                 //琛ㄦ牸澶氫綅 璁$畻鍒嗘暟鍊艰祴鍊� 渚嬪
-                // 琛ㄦ牸鐨勶細%P_Regula19_XX1%
-                // 琛ㄦ牸鐨勶細%P_Regula19_XX2%
-                // 琛ㄦ牸鐨勶細%P_Regula19_XX3%
-                // 琛ㄦ牸鐨勶細%P_Regula19_XX4%
-                // 琛ㄦ牸鐨勶細%P_Regula19_XX5%
-                // 琛ㄦ牸鐨勶細%P_Regula19_XX6%
+                // 琛ㄦ牸鐨勶細%ResponseFidelityDiagnosis_V2_0%
+                // 琛ㄦ牸鐨勶細%ResponseFidelityDiagnosis_V2_1%
+                // 琛ㄦ牸鐨勶細%ResponseFidelityDiagnosis_V2_2%
                 for (int i = 0; i < tLibraryCodes.size(); i++) {
                     TLibraryCode tLibraryCode = tLibraryCodes.get(i);
                     textMap.put(p.getName() + "_" + i, Objects.isNull(tLibraryCode) || StringUtils.isBlank(tLibraryCode.getLangTypeContext(langType)) ? "N/A NONE" : tLibraryCode.getLangTypeContext(langType));
diff --git a/src/main/java/com/ots/project/tool/report/MAQNEW/base/BaseCondition_V2.java b/src/main/java/com/ots/project/tool/report/MAQNEW/base/BaseCondition_V2.java
index 598c0fd..ffe797e 100644
--- a/src/main/java/com/ots/project/tool/report/MAQNEW/base/BaseCondition_V2.java
+++ b/src/main/java/com/ots/project/tool/report/MAQNEW/base/BaseCondition_V2.java
@@ -57,6 +57,13 @@
         dynamicParameterSubstitution(map, result, langType);
         return result;
     }
+
+    /**
+     * 鎶ュ憡瀛楀吀閲岄潰杩樻湁%%鍙橀噺 杩涜鏇挎崲
+     * @param map
+     * @param maqReportLibrary
+     * @param langType
+     */
     public void dynamicParameterSubstitution(Map<String, String> map, TLibraryCode maqReportLibrary, LangTypeEnum langType) {
         map.forEach((key, value) -> {
             String content = maqReportLibrary.getLangTypeContext(langType);
diff --git a/src/main/java/com/ots/project/tool/report/MAQNEW/condition/KeyPointsCautions_V2.java b/src/main/java/com/ots/project/tool/report/MAQNEW/condition/KeyPointsCautions_V2.java
index 24fc593..a91f008 100644
--- a/src/main/java/com/ots/project/tool/report/MAQNEW/condition/KeyPointsCautions_V2.java
+++ b/src/main/java/com/ots/project/tool/report/MAQNEW/condition/KeyPointsCautions_V2.java
@@ -17,6 +17,7 @@
 @Slf4j
 public class KeyPointsCautions_V2 extends BaseCondition_V2 {
     private String name = "KeyPointsCautions_V2";
+    @Override
     public TLibraryCode calculate(Map<String, String> map, LangTypeEnum langType) {
         try {
             Map<String, String> paramMap = new HashMap();
diff --git a/src/main/java/com/ots/project/tool/report/MAQNEW/condition/KeyPointsStrengths_V2.java b/src/main/java/com/ots/project/tool/report/MAQNEW/condition/KeyPointsStrengths_V2.java
index 76d27d3..ab71125 100644
--- a/src/main/java/com/ots/project/tool/report/MAQNEW/condition/KeyPointsStrengths_V2.java
+++ b/src/main/java/com/ots/project/tool/report/MAQNEW/condition/KeyPointsStrengths_V2.java
@@ -17,6 +17,7 @@
 @Slf4j
 public class KeyPointsStrengths_V2 extends BaseCondition_V2 {
     private String name = "KeyPointsStrengths_V2";
+    @Override
     public TLibraryCode calculate(Map<String, String> map, LangTypeEnum langType) {
         try {
             Map<String, String> paramMap = new HashMap();
diff --git a/src/main/java/com/ots/project/tool/report/MAQNEW/condition/PrimaryLeadershipStyleContext_V2.java b/src/main/java/com/ots/project/tool/report/MAQNEW/condition/PrimaryLeadershipStyleContext_V2.java
index 813a4e3..0a5e915 100644
--- a/src/main/java/com/ots/project/tool/report/MAQNEW/condition/PrimaryLeadershipStyleContext_V2.java
+++ b/src/main/java/com/ots/project/tool/report/MAQNEW/condition/PrimaryLeadershipStyleContext_V2.java
@@ -13,6 +13,7 @@
 @Slf4j
 public class PrimaryLeadershipStyleContext_V2 extends BaseCondition_V2 {
     private String name = "PrimaryLeadershipStyleContext_V2";
+    @Override
     public TLibraryCode calculate(Map<String, String> map, LangTypeEnum langType) {
         try {
             String p_task31 = map.get("P_Task31");
diff --git a/src/main/java/com/ots/project/tool/report/MAQNEW/condition/ResponseFidelityDiagnosisTitle_V2.java b/src/main/java/com/ots/project/tool/report/MAQNEW/condition/ResponseFidelityDiagnosisTitle_V2.java
index aefb4df..16d7eb3 100644
--- a/src/main/java/com/ots/project/tool/report/MAQNEW/condition/ResponseFidelityDiagnosisTitle_V2.java
+++ b/src/main/java/com/ots/project/tool/report/MAQNEW/condition/ResponseFidelityDiagnosisTitle_V2.java
@@ -20,6 +20,7 @@
     public Map<String, String> getMAQwaterDropsImages() {
         return null;
     }
+    @Override
     public TLibraryCode calculate(Map<String, String> map, LangTypeEnum langType) {
         try {
             String p_sde_t1 = map.get("P_SDE_T1");
diff --git a/src/main/java/com/ots/project/tool/report/MAQNEW/condition/ResponseFidelityDiagnosis_V2.java b/src/main/java/com/ots/project/tool/report/MAQNEW/condition/ResponseFidelityDiagnosis_V2.java
index aa7a4ce..4dbcb1c 100644
--- a/src/main/java/com/ots/project/tool/report/MAQNEW/condition/ResponseFidelityDiagnosis_V2.java
+++ b/src/main/java/com/ots/project/tool/report/MAQNEW/condition/ResponseFidelityDiagnosis_V2.java
@@ -23,6 +23,7 @@
         map.put(name + IMAGE_PREFIX + "3", Objects.isNull(P_INCON25) ? "0" : String.valueOf(P_INCON25));
         return map;
     }
+    @Override
     public TLibraryCode calculate(Map<String, String> map, LangTypeEnum langType) {
         try {
             String p_sde_t1 = map.get("P_SDE_T1");
@@ -62,6 +63,8 @@
             return null;
         }
     }
+
+    @Override
     public List<TLibraryCode> calculateList(Map<String, String> map, LangTypeEnum langType) {
         try {
             String p_sde_t1 = map.get("P_SDE_T1");
diff --git a/src/main/java/com/ots/project/tool/report/RuilinMAQ/condition/RuilinTestResultValidityDiagnosis.java b/src/main/java/com/ots/project/tool/report/RuilinMAQ/condition/RuilinTestResultValidityDiagnosis.java
index ad4ba2a..3486d4c 100644
--- a/src/main/java/com/ots/project/tool/report/RuilinMAQ/condition/RuilinTestResultValidityDiagnosis.java
+++ b/src/main/java/com/ots/project/tool/report/RuilinMAQ/condition/RuilinTestResultValidityDiagnosis.java
@@ -17,6 +17,7 @@
     private Double P_SDE_T1;
     private Double P_IM_T1;
     private Double P_INCON_T1;
+    @Override
     public TLibraryCode calculate(Map<String, String> map, LangTypeEnum langType) {
         try {
             String p_sde_t1 = map.get("P_SDE_T1");
diff --git a/src/main/java/com/ots/project/tool/report/RuilinMAQ/condition/RuilinTestResultValidityDiagnosisContext.java b/src/main/java/com/ots/project/tool/report/RuilinMAQ/condition/RuilinTestResultValidityDiagnosisContext.java
index e1cebfa..e577bd5 100644
--- a/src/main/java/com/ots/project/tool/report/RuilinMAQ/condition/RuilinTestResultValidityDiagnosisContext.java
+++ b/src/main/java/com/ots/project/tool/report/RuilinMAQ/condition/RuilinTestResultValidityDiagnosisContext.java
@@ -25,6 +25,7 @@
         map.put(name + IMAGE_PREFIX + "3", Objects.isNull(P_INCON25) ? "0" : String.valueOf(P_INCON25));
         return map;
     }
+    @Override
     public TLibraryCode calculate(Map<String, String> map, LangTypeEnum langType) {
         try {
             String p_sde_t1 = map.get("P_SDE_T1");
diff --git a/src/main/java/com/ots/project/tool/report/SAQ/SAQReport.java b/src/main/java/com/ots/project/tool/report/SAQ/SAQReport.java
index 6e09da8..4433ca2 100644
--- a/src/main/java/com/ots/project/tool/report/SAQ/SAQReport.java
+++ b/src/main/java/com/ots/project/tool/report/SAQ/SAQReport.java
@@ -16,6 +16,8 @@
 import com.ots.project.tool.report.SAQ.condition.SAQConditionVO;
 import com.ots.project.tool.report.SAQ.condition.SAQSummary;
 import com.ots.project.tool.report.SAQ.condition.SAQSummaryCondition;
+import com.ots.project.tool.report.SAQ.gs.condition.ResponseFidelityDiagnosisSAQGs;
+import com.ots.project.tool.report.SAQ.gs.condition.ResponseFidelityDiagnosisSAQGsTitle;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.extern.slf4j.Slf4j;
@@ -47,9 +49,21 @@
     private Map otherParams;
     
     private LangTypeEnum langType;
+
+    /**
+     * 鍒濆鍖栨潯浠�
+     * @param reportTypeEnum
+     * @return
+     */
     public List<BaseCondition> getParamList(ReportTypeEnum reportTypeEnum) {
         return init(reportTypeEnum);
     }
+
+    /**
+     * 鍒濆鍖栨墍鏈夋姤鍛婂弬鏁�
+     * @param reportTypeEnum
+     * @return
+     */
     private List<BaseCondition> init(ReportTypeEnum reportTypeEnum) {
         List<BaseCondition> paramList = new ArrayList<>();
         
@@ -57,9 +71,12 @@
             SimpleMessage simpleMessage = new SimpleMessage(p);
             return simpleMessage;
         }).collect(Collectors.toList()));
-        
+        //鎸囨爣鍛戒腑瀵瑰簲瀛楀吀 瀹屾暣鐗�
         paramList.add(new ResponseFidelityDiagnosisSAQTitle());
         paramList.add(new ResponseFidelityDiagnosisSAQ());
+        //鏀寔GS绠�鏄撶増
+        paramList.add(new ResponseFidelityDiagnosisSAQGs());
+        paramList.add(new ResponseFidelityDiagnosisSAQGsTitle());
         
         paramList.addAll(getScoreCharacteristicsList().stream().map(p -> {
             ScoreCharacteristics scoreCharacteristics = new ScoreCharacteristics(p);
@@ -119,7 +136,7 @@
     private List<String> getSimpleMessageCoreIds() {
         //鏀寔SAQ GS绠�鏄撶増
         return Arrays.asList("LIBSAQGS0001","LIBSAQGS0002","LIBSAQGS0005","LIBSAQGS0008","LIBSAQGS0009",
-                "LIBSAQGS0011","LIBSAQGS0017","LIBSAQGS0015","LIBSAQGS8800",
+                "LIBSAQGS0011","LIBSAQGS0017","LIBSAQGS0015","LIBSAQGS8800","LIBSAQGS0018",
                 "LIBSAQ0001", "LIBSAQ0003", "LIBSAQ0005", "LIBSAQ0007", "LIBSAQ0009", "LIBSAQ00011",
                 "LIBSAQ0015", "LIBSAQ0017", "LIBSAQ0162", "LIBSAQ0164", "LIBSAQ0020", "LIBSAQ0022",
                 "LIBSAQ0024", "LIBSAQ0026", "LIBSAQ0030", "LIBSAQ0035", "LIBSAQ0040", "LIBSAQ0041",
@@ -184,7 +201,7 @@
     public ReportResultData getTemplateParameters(Map<String, String> thaiCalculationMap, ReportTypeEnum type, LangTypeEnum langType) {
         this.reportTypeEnum = type;
         this.langType = langType;
-        
+        //鍩烘湰淇℃伅瀛楁
         Map textMap = new HashMap();
         Map waterDropsMap = new HashMap();
         textMap.put("questionnaireTaker", getQuestionnaireTaker());
@@ -192,10 +209,22 @@
         textMap.put("reportGenerationDate", getReportGenerationDate());
         textMap.put("userName", getUserName());
         textMap.put("questionnaireEmail", getQuestionnaireEmail());
-        
+        //鏍规嵁鎶ュ憡绫诲瀷鑾峰彇鎶ュ憡瀛楀吀
         getParamList(type).stream().forEach(p -> {
             TLibraryCode calculate = p.calculate(thaiCalculationMap, langType);
-            textMap.put(p.getName(), Objects.isNull(calculate) || StringUtils.isBlank(calculate.getLangTypeContext(langType)) ? "N/A NONE" : calculate.getLangTypeContext(langType));
+            List<TLibraryCode> tLibraryCodes = p.calculateList(thaiCalculationMap, langType);
+            if(tLibraryCodes != null && tLibraryCodes.size() > 0){//琛ㄦ牸澶氫綅 璁$畻鍒嗘暟鍊艰祴鍊� 渚嬪
+                // 琛ㄦ牸鐨勶細%ResponseFidelityDiagnosis_V2_0%
+                // 琛ㄦ牸鐨勶細%ResponseFidelityDiagnosis_V2_1%
+                // 琛ㄦ牸鐨勶細%ResponseFidelityDiagnosis_V2_2%
+                for (int i = 0; i < tLibraryCodes.size(); i++) {
+                    TLibraryCode tLibraryCode = tLibraryCodes.get(i);
+                    textMap.put(p.getName() + "_" + i, Objects.isNull(tLibraryCode) || StringUtils.isBlank(tLibraryCode.getLangTypeContext(langType)) ? "N/A NONE" : tLibraryCode.getLangTypeContext(langType));
+                }
+            }else{
+                textMap.put(p.getName(), Objects.isNull(calculate) || StringUtils.isBlank(calculate.getLangTypeContext(langType)) ? "N/A NONE" : calculate.getLangTypeContext(langType));
+            }
+            //姘存淮闆嗗悎
             if (Objects.nonNull(p.getMAQwaterDropsImages())) {
                 waterDropsMap.putAll(p.getMAQwaterDropsImages());
             }
diff --git a/src/main/java/com/ots/project/tool/report/SAQ/chart/RowData.java b/src/main/java/com/ots/project/tool/report/SAQ/chart/RowData.java
new file mode 100644
index 0000000..8c84599
--- /dev/null
+++ b/src/main/java/com/ots/project/tool/report/SAQ/chart/RowData.java
@@ -0,0 +1,23 @@
+package com.ots.project.tool.report.SAQ.chart;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @description: 琛屾暟鎹�
+ * @author: zhijie
+ * @create: 2021-06-07 23:30
+ **/
+@Data
+@NoArgsConstructor                 //鏃犲弬鏋勯��
+@AllArgsConstructor                //鏈夊弬鏋勯��
+public class RowData {
+
+    public String name;
+
+    /**
+     */
+    public double value;
+
+}
diff --git a/src/main/java/com/ots/project/tool/report/SAQ/chart/SAQChart.java b/src/main/java/com/ots/project/tool/report/SAQ/chart/SAQChart.java
new file mode 100644
index 0000000..47e6fb5
--- /dev/null
+++ b/src/main/java/com/ots/project/tool/report/SAQ/chart/SAQChart.java
@@ -0,0 +1,377 @@
+package com.ots.project.tool.report.SAQ.chart;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.ooxml.POIXMLDocument;
+import org.apache.poi.ooxml.POIXMLDocumentPart;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
+import org.apache.poi.xssf.usermodel.XSSFCell;
+import org.apache.poi.xssf.usermodel.XSSFRow;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.apache.poi.xwpf.usermodel.XWPFChart;
+import org.apache.poi.xwpf.usermodel.XWPFDocument;
+import org.openxmlformats.schemas.drawingml.x2006.chart.*;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+/**
+ * @description: SAQ鍥捐〃 鏁g偣鍥捐窡鏌卞舰鍥炬暟鎹彉鏇�
+ * @author: zhijie
+ * @create: 2021-06-07 23:31
+ **/
+@Slf4j
+public class SAQChart {
+
+
+    public static void main(String[] args) throws IOException {
+        XWPFDocument document = new XWPFDocument(POIXMLDocument.openPackage("D:\\娴嬭瘎绯荤粺\\闇�姹俓\2.docx"));
+        Map<String, Object> textMap = new HashMap<String, Object>();
+        changeChart(document,textMap);
+    }
+
+    /**
+     * 鏇挎崲SAQ鍥捐〃鏁版嵁
+     * @param document 鏂囨。瀵硅薄
+     * @param textMap 鎶ュ憡瀛楀吀閿�煎
+     * @return
+     */
+    public static boolean changeChart(XWPFDocument document, Map<String, Object> textMap){
+        List<SeriesData> seriesDatas = initData(textMap);
+        if(seriesDatas == null){
+            log.error("鏇挎崲SAQ鍥捐〃鏁版嵁,鍒濆鍖栨暟鎹け璐�!");
+            return false;
+        }
+        //SAQ鍥捐〃鏁版嵁
+        changeSAQChart(document,seriesDatas);
+        return true;
+    }
+
+    /**
+     * 鍒ゆ柇鏄惁涓虹┖
+     * @param value
+     * @return
+     */
+    public static boolean checkParamsIsNull(String... value) {
+        for (int i = 0; i < value.length; i++) {
+            if (Objects.isNull(value[i])) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 鍒濆鍖栨姤鍛婃暟鎹�
+     * @param textMap
+     * @return
+     */
+    public static List<SeriesData> initData(Map<String, Object> textMap){
+        //鑾峰彇鍛戒腑鏁板��
+        String p_sde23 = (String) textMap.get("P_SDE23");
+        String p_im24 = (String) textMap.get("P_IM24");
+        String p_incon25 = (String) textMap.get("P_INCON25");
+        //鍒ゆ柇鏄惁涓虹┖
+        if (checkParamsIsNull(p_sde23, p_im24, p_incon25)) {
+            return null;
+        }
+        Double P_SDE23 = Double.valueOf(p_sde23);
+        Double P_IM24 = Double.valueOf(p_im24);
+        Double P_INCON25 = Double.valueOf(p_incon25);
+
+        // 娴嬭瘯鏁版嵁
+        List<SeriesData> seriesDatas = Arrays.asList(
+                new SeriesData("涓汉鏁板�煎湪姝よ皟鏁�", Arrays.asList(
+                        new RowData("涓汉鏁板�煎湪姝よ皟鏁�", P_INCON25),
+                        new RowData("涓汉鏁板�煎湪姝よ皟鏁�", P_IM24),
+                        new RowData("涓汉鏁板�煎湪姝よ皟鏁�", P_SDE23)
+                )),
+                new SeriesData("涓绘煴褰㈡暟鎹紙x杞达級1", Arrays.asList(
+                        new RowData("涓绘煴褰㈡暟鎹紙x杞达級1", 0),
+                        new RowData("涓绘煴褰㈡暟鎹紙x杞达級1", 5),
+                        new RowData("涓绘煴褰㈡暟鎹紙x杞达級1", 5)
+                )),
+                new SeriesData("涓绘煴褰㈡暟鎹紙x杞达級2", Arrays.asList(
+                        new RowData("涓绘煴褰㈡暟鎹紙x杞达級2", 5),
+                        new RowData("涓绘煴褰㈡暟鎹紙x杞达級2", 5),
+                        new RowData("涓绘煴褰㈡暟鎹紙x杞达級2", 5)
+                )),
+                new SeriesData("杈呭姪鏌卞舰鏁版嵁", Arrays.asList(
+                        new RowData("杈呭姪鏌卞舰鏁版嵁", 100),
+                        new RowData("杈呭姪鏌卞舰鏁版嵁", 95),
+                        new RowData("杈呭姪鏌卞舰鏁版嵁", 95)
+                )),
+                new SeriesData("Y杞�", Arrays.asList(
+                        new RowData("Y杞�", 27),
+                        new RowData("Y杞�", 60),
+                        new RowData("Y杞�", 93)
+                ))
+        );
+        return seriesDatas;
+    }
+
+    /**
+     * 鏇挎崲word鍥捐〃 鏁g偣鍥捐窡鏌卞舰鍥剧粍鍚堝浘褰�
+     * @param doc
+     * @param seriesDatas
+     */
+    public static void changeSAQChart(XWPFDocument doc,List<SeriesData> seriesDatas) {
+        try {
+            //鍔ㄦ�佸埛鏂板浘琛�
+            List<POIXMLDocumentPart> relations = doc.getRelations();
+            for (POIXMLDocumentPart part : relations) {
+                if (part instanceof XWPFChart) {
+                    // 鍥捐〃鍏冪礌
+                    XWPFChart chart = (XWPFChart) part;
+
+                    // 鏌ョ湅閲岄潰鐨勫浘琛ㄦ暟鎹紝鎵嶈兘鐭ラ亾鏄粈涔堝浘琛�
+                    CTPlotArea plot = chart.getCTChart().getPlotArea();
+                    // excel鍐呯疆琛ㄦ牸
+                    XSSFWorkbook workbook = chart.getWorkbook();
+                    XSSFSheet sheet = workbook.getSheetAt(0);
+
+                    //鏁g偣鍥�
+                    if (!plot.getScatterChartList().isEmpty()) {
+                        CTScatterChart scatterChart = plot.getScatterChartArray(0);
+                        //System.out.println("鏁g偣鍥緖"+plot.getScatterChartList().size()+"}");
+                        //鍒锋柊鍐呯疆excel鏁版嵁
+                        refreshExcel(seriesDatas, workbook, sheet);
+                        workbook.write(chart.getPackagePart().getOutputStream());
+
+                        //鏁g偣鍥炬暟鎹簮 XY鍧愭爣
+                        List<SeriesData> scatterDatas = new ArrayList<SeriesData>();
+                        scatterDatas.add(seriesDatas.get(0));
+                        scatterDatas.add(seriesDatas.get(4));
+                        int i = 0;
+                        for (CTScatterSer ser : scatterChart.getSerList()) {
+                            //鏇存柊鏁g偣鍥剧紦瀛�
+                            updateScatterChart(scatterDatas, ser.getXVal(), ser.getYVal());
+                            ++i;
+                        }
+                    }
+                    //鏌卞舰鍥�
+                    if (!plot.getBarChartList().isEmpty()) {
+                        CTBarChart barChart = plot.getBarChartArray(0);
+                        //System.out.println("鏌卞舰鍥緖"+plot.getScatterChartList().size()+"}");
+                        //鍒锋柊鍐呯疆excel鏁版嵁
+                        refreshExcel(seriesDatas, workbook, sheet);
+                        workbook.write(chart.getPackagePart().getOutputStream());
+
+                        //鏌卞舰鍥炬暟鎹簮
+                        List<SeriesData> barDatas = seriesDatas.subList(1,4);
+                        //鍥犱负鏌卞舰鍥綜TBarSer娌℃寜excel椤哄簭璧� 璋冩崲鏁版嵁浣嶇疆淇濇寔瀵瑰簲
+                        Collections.swap(barDatas, 1, 2);
+                        int i = 0;
+                        for (CTBarSer ser : barChart.getSerList()) {
+                            //鏇存柊鏌卞舰鍥炬暟鎹紦瀛�
+                            updateBarChart(barDatas.get(i), ser.getVal());
+                            ++i;
+                        }
+                    }
+                }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("SAQGS鏇挎崲word鍥捐〃 鏁g偣鍥捐窡鏌卞舰鍥剧粍鍚堝浘褰㈠け璐ワ細{}",e);
+        }
+    }
+
+    /**
+     * 鏇存柊鍥捐〃鐨勫叧鑱� excel
+     *
+     * @param seriesDatas
+     * @param workbook
+     * @param sheet
+     */
+    protected static void refreshExcel(List<SeriesData> seriesDatas, XSSFWorkbook workbook, XSSFSheet sheet) {
+        XSSFRow title = sheet.getRow(0);
+        //閬嶅巻鏁版嵁鏁扮粍杩涜excel璧嬪��
+        for (int i = 0; i < seriesDatas.size(); i++) {
+            SeriesData data = seriesDatas.get(i);
+            if (data.name != null && !data.name.isEmpty()) {
+                // 绗竴琛屾爣棰�
+                XSSFCell cell = title.getCell(i);
+                if (cell == null) {
+                    cell = title.createCell(i + 1);
+                }
+                cell.setCellValue(data.name);
+            }
+            int size = data.value.size();
+            //閬嶅巻鏁版嵁杩涜璧嬪��
+            for (int j = 0; j < size; j++) {
+                //浠庣浜岃寮�濮嬭祴鍊�
+                XSSFRow row = sheet.getRow(j + 1);
+                if (row == null) {
+                    row = sheet.createRow(j + 1);
+                }
+                RowData cellValu = data.value.get(j);
+
+                //绗竴鍒楀紑濮嬭祴鍊�
+                XSSFCell cell = row.getCell(i);
+                if (cell == null) {
+                    cell = row.createCell(i);
+                }
+                cell.setCellValue(cellValu.value);
+            }
+            //鍒犻櫎澶氫綑琛屾暟
+            int lastRowNum = sheet.getLastRowNum();
+            if (lastRowNum > size) {
+                for (int idx = lastRowNum; idx > size; idx--) {
+                    sheet.removeRow(sheet.getRow(idx));
+                }
+            }
+        }
+    }
+
+
+    /**
+     * 鏇存柊 鏁g偣鍥� 缂撳瓨鏁版嵁
+     *
+     * @param seriesDatas 鏁版嵁
+     * @param xDataSource X鍧愭爣鏁版嵁缂撳瓨
+     * @param yDataSource Y鍧愭爣鏁版嵁缂撳瓨
+     */
+    protected static void updateScatterChart(List<SeriesData> seriesDatas, CTAxDataSource xDataSource,
+                                               CTNumDataSource yDataSource) {
+
+        //鑾峰彇xy鍧愭爣鏁版嵁鏉℃暟
+        long xNumCnt = xDataSource.getNumRef().getNumCache().getPtCount().getVal();
+        long yNumCnt = yDataSource.getNumRef().getNumCache().getPtCount().getVal();
+
+        //鑾峰彇XY鏈�鏂版暟鎹�
+        List<RowData> xRowDatas = seriesDatas.get(0).getValue();
+        int xRowDataSize = xRowDatas.size();
+        List<RowData> yRowDatas = seriesDatas.get(1).getValue();
+        int yRowDataSize = yRowDatas.size();
+
+        //鏇存柊X鍧愭爣缂撳瓨
+        for (int i = 0; i < xRowDatas.size(); i++) {
+            RowData cellValu = xRowDatas.get(i);
+            CTNumVal val = xNumCnt > i ? xDataSource.getNumRef().getNumCache().getPtArray(i)
+                    : xDataSource.getNumRef().getNumCache().addNewPt();
+            val.setIdx(i);
+            val.setV(String.format("%.0f", cellValu.value));
+        }
+
+        //鏇存柊Y鍧愭爣缂撳瓨
+        for (int i = 0; i < yRowDatas.size(); i++) {
+            RowData cellValu = yRowDatas.get(i);
+            CTNumVal val = yNumCnt > i ? yDataSource.getNumRef().getNumCache().getPtArray(i)
+                    : yDataSource.getNumRef().getNumCache().addNewPt();
+            val.setIdx(i);
+            val.setV(String.format("%.0f", cellValu.value));
+        }
+
+        // 鏇存柊瀵瑰簲excel鐨勮寖鍥�
+        xDataSource.getNumRef().setF(
+                replaceRowEnd(xDataSource.getNumRef().getF(),
+                        xNumCnt,
+                        xRowDataSize));
+        yDataSource.getNumRef().setF(
+                replaceRowEnd(yDataSource.getNumRef().getF(),
+                        yNumCnt,
+                        yRowDataSize));
+
+        // 鍒犻櫎澶氱殑
+        if (xNumCnt > xRowDataSize) {
+            for (int idx = xRowDataSize; idx < xNumCnt; idx++) {
+                xDataSource.getNumRef().getNumCache().removePt(xRowDataSize);
+            }
+        }
+        if (yNumCnt > yRowDataSize) {
+            for (int idx = yRowDataSize; idx < yNumCnt; idx++) {
+                yDataSource.getNumRef().getNumCache().removePt(yRowDataSize);
+            }
+        }
+        // 鏇存柊涓暟
+        xDataSource.getNumRef().getNumCache().getPtCount().setVal(xRowDataSize);
+        // 鏇存柊涓暟
+        yDataSource.getNumRef().getNumCache().getPtCount().setVal(yRowDataSize);
+    }
+
+
+    /**
+     * 鏇存柊 鏌卞舰鍥� 鐨勭紦瀛樻暟鎹�
+     *
+     * @param seriesDatas   鏁版嵁
+     * @param numDataSource 鏁版嵁鐨勭紦瀛�
+     */
+    protected static void updateBarChart(SeriesData seriesDatas, CTNumDataSource numDataSource) {
+        //鑾峰彇鏌卞舰鍥炬暟鎹暟閲�
+        long ptNumCnt = numDataSource.getNumRef().getNumCache().getPtCount().getVal();
+        int dataSize = seriesDatas.value.size();
+        for (int i = 0; i < dataSize; i++) {
+            RowData cellValu = seriesDatas.value.get(i);
+            CTNumVal val = ptNumCnt > i ? numDataSource.getNumRef().getNumCache().getPtArray(i)
+                    : numDataSource.getNumRef().getNumCache().addNewPt();
+            val.setIdx(i);
+            val.setV(String.format("%.0f", cellValu.value));
+
+        }
+
+        // 鏇存柊瀵瑰簲excel鐨勮寖鍥�
+        numDataSource.getNumRef().setF(
+                replaceRowEnd(numDataSource.getNumRef().getF(),
+                        ptNumCnt,
+                        dataSize));
+
+        // 鍒犻櫎澶氱殑
+        if (ptNumCnt > dataSize) {
+            for (int idx = dataSize; idx < ptNumCnt; idx++) {
+                numDataSource.getNumRef().getNumCache().removePt(dataSize);
+            }
+        }
+        // 鏇存柊涓暟
+        numDataSource.getNumRef().getNumCache().getPtCount().setVal(dataSize);
+    }
+
+
+    /**
+     * 鏇挎崲 褰㈠锛� Sheet1!$A$2:$A$4 鐨勫瓧绗�
+     *
+     * @param range
+     * @return
+     */
+    public static String replaceRowEnd(String range, long oldSize, long newSize) {
+        Pattern pattern = Pattern.compile("(:\\$[A-Z]+\\$)(\\d+)");
+        Matcher matcher = pattern.matcher(range);
+        if (matcher.find()) {
+            long old = Long.parseLong(matcher.group(2));
+            return range.replaceAll("(:\\$[A-Z]+\\$)(\\d+)", "$1" + Long.toString(old - oldSize + newSize));
+        }
+        return range;
+    }
+
+    /**
+     * 鑾峰彇鍥捐〃鏈夊摢浜涚被鍨�
+     * @param part
+     */
+    public static void getChartType(POIXMLDocumentPart part){
+        XWPFChart chart = (XWPFChart) part;
+        //鏍规嵁灞炴�х涓�鍒楀悕绉板垏鎹㈡暟鎹被鍨�
+        CTChart ctChart = chart.getCTChart();
+        CTPlotArea plotArea = ctChart.getPlotArea();
+
+        if (!plotArea.getBarChartList().isEmpty()) {
+            System.out.println("鏌辩姸鍥緖"+plotArea.getBarChartList().size()+"}");
+        }
+        if (!plotArea.getPieChartList().isEmpty()) {
+            System.out.println("楗煎浘{"+plotArea.getPieChartList().size()+"}");
+        }
+        if (!plotArea.getLineChartList().isEmpty()) {
+            System.out.println("绾垮舰鍥緖"+plotArea.getLineChartList().size()+"}");
+        }
+        if (!plotArea.getBar3DChartList().isEmpty()) {
+            System.out.println("鏌辩姸鍥�3D{"+plotArea.getBar3DChartList().size()+"}");
+        }
+        if (!plotArea.getScatterChartList().isEmpty()) {
+            System.out.println("鏁g偣鍥緖"+plotArea.getScatterChartList().size()+"}");
+        }
+    }
+
+}
diff --git a/src/main/java/com/ots/project/tool/report/SAQ/chart/SeriesData.java b/src/main/java/com/ots/project/tool/report/SAQ/chart/SeriesData.java
new file mode 100644
index 0000000..bbb10dc
--- /dev/null
+++ b/src/main/java/com/ots/project/tool/report/SAQ/chart/SeriesData.java
@@ -0,0 +1,26 @@
+package com.ots.project.tool.report.SAQ.chart;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * @description: 鍥捐〃鏁版嵁
+ * @author: zhijie
+ * @create: 2021-06-07 23:29
+ **/
+@Data
+@NoArgsConstructor                 //鏃犲弬鏋勯��
+@AllArgsConstructor                //鏈夊弬鏋勯��
+public class SeriesData {
+
+    /**
+     * value 绯诲垪鐨勫悕瀛�
+     */
+    public String name;
+
+    public List<RowData> value;
+
+}
diff --git a/src/main/java/com/ots/project/tool/report/SAQ/condition/ResponseFidelityDiagnosisSAQ.java b/src/main/java/com/ots/project/tool/report/SAQ/condition/ResponseFidelityDiagnosisSAQ.java
index 93dd83b..d371261 100644
--- a/src/main/java/com/ots/project/tool/report/SAQ/condition/ResponseFidelityDiagnosisSAQ.java
+++ b/src/main/java/com/ots/project/tool/report/SAQ/condition/ResponseFidelityDiagnosisSAQ.java
@@ -25,6 +25,7 @@
         map.put(name + IMAGE_PREFIX + "3", Objects.isNull(P_INCON25) ? "0" : String.valueOf(P_INCON25));
         return map;
     }
+    @Override
     public TLibraryCode calculate(Map<String, String> map, LangTypeEnum langType) {
         try {
             String p_sde_t1 = map.get("P_SDE_T1");
diff --git a/src/main/java/com/ots/project/tool/report/SAQ/condition/ResponseFidelityDiagnosisSAQTitle.java b/src/main/java/com/ots/project/tool/report/SAQ/condition/ResponseFidelityDiagnosisSAQTitle.java
index 44b9c5e..47590f7 100644
--- a/src/main/java/com/ots/project/tool/report/SAQ/condition/ResponseFidelityDiagnosisSAQTitle.java
+++ b/src/main/java/com/ots/project/tool/report/SAQ/condition/ResponseFidelityDiagnosisSAQTitle.java
@@ -20,6 +20,7 @@
     public Map<String, String> getMAQwaterDropsImages() {
         return null;
     }
+    @Override
     public TLibraryCode calculate(Map<String, String> map, LangTypeEnum langType) {
         try {
             String p_sde_t1 = map.get("P_SDE_T1");
diff --git a/src/main/java/com/ots/project/tool/report/SAQ/gs/condition/ResponseFidelityDiagnosisSAQGs.java b/src/main/java/com/ots/project/tool/report/SAQ/gs/condition/ResponseFidelityDiagnosisSAQGs.java
new file mode 100644
index 0000000..989c4cb
--- /dev/null
+++ b/src/main/java/com/ots/project/tool/report/SAQ/gs/condition/ResponseFidelityDiagnosisSAQGs.java
@@ -0,0 +1,136 @@
+package com.ots.project.tool.report.SAQ.gs.condition;
+
+import com.ots.common.enums.LangTypeEnum;
+import com.ots.project.exam.domain.TLibraryCode;
+import com.ots.project.tool.report.MAQ.base.BaseCondition;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.*;
+
+/**
+* @Description: SAQ绠�鏄撶増缁撴灉鏍囬璁$畻
+* @Author: zhijie
+* @Date: 2021/6/6
+*/
+@Getter
+@Setter
+@Slf4j
+public class ResponseFidelityDiagnosisSAQGs extends BaseCondition {
+    private String name = "ResponseFidelityDiagnosisSAQGs";
+    private Double P_SDE23;
+    private Double P_IM24;
+    private Double P_INCON25;
+
+    @Override
+    public Map<String, String> getMAQwaterDropsImages() {
+        Map map = new HashMap();
+        map.put(name + IMAGE_PREFIX + "1", Objects.isNull(P_SDE23) ? "0" : String.valueOf(P_SDE23));
+        map.put(name + IMAGE_PREFIX + "2", Objects.isNull(P_IM24) ? "0" : String.valueOf(P_IM24));
+        map.put(name + IMAGE_PREFIX + "3", Objects.isNull(P_INCON25) ? "0" : String.valueOf(P_INCON25));
+        return map;
+    }
+
+    /**
+     * 鍛戒腑璁$畻
+     * @param map
+     * @param langType
+     * @return
+     */
+    @Override
+    public TLibraryCode calculate(Map<String, String> map, LangTypeEnum langType) {
+        try {
+            /**
+             * 鑾峰彇娉板浗鎺ュ彛杩斿洖鐨勬不鏍�
+             */
+            String p_sde_t1 = map.get("P_SDE_T1");
+            String p_im_t1 = map.get("P_IM_T1");
+            String p_incon_t1 = map.get("P_INCON_T1");
+            String p_sde23 = map.get("P_SDE23");
+            String p_im24 = map.get("P_IM24");
+            String p_incon25 = map.get("P_INCON25");
+            //妫�鏌ユ槸鍚︿负绌�
+            if (checkParamsIsNull(p_sde_t1, p_im_t1, p_incon_t1, p_sde23, p_im24, p_incon25)) {
+                return null;
+            }
+            Double P_SDE_T1 = Double.valueOf(p_sde_t1);
+            Double P_IM_T1 = Double.valueOf(p_im_t1);
+            Double P_INCON_T1 = Double.valueOf(p_incon_t1);
+            P_SDE23 = Double.valueOf(p_sde23);
+            P_IM24 = Double.valueOf(p_im24);
+            P_INCON25 = Double.valueOf(p_incon25);
+            //鏍规嵁鎸囨爣璁$畻瀵瑰簲瀛楀吀
+            boolean LIBSAQGS8801 = (P_SDE_T1 >= 95 || P_IM_T1 >= 95 || P_INCON_T1 >= 95) && (P_SDE23 >= 95 || P_IM24 >= 95 || P_INCON25 >= 95);
+            boolean LIBSAQGS8802 = (P_SDE_T1 >= 95 || P_IM_T1 >= 95 || P_INCON_T1 >= 95) && (5 < P_SDE23 && P_SDE23 < 95 && 5 < P_IM24 && P_IM24 < 95 && P_INCON25 < 95);
+            boolean LIBSAQGS8803 = (P_SDE_T1 >= 95 || P_IM_T1 >= 95 || P_INCON_T1 >= 95) && (P_SDE23 <= 5 || P_IM24 <= 5) && (P_INCON25 < 95);
+            boolean LIBSAQGS8804 = (P_SDE_T1 < 95 && P_IM_T1 < 95 && P_INCON_T1 < 95) && (P_SDE23 >= 95 || P_IM24 >= 95 || P_INCON25 >= 95);
+            boolean LIBSAQGS8805 = (P_SDE_T1 < 95 && P_IM_T1 < 95 && P_INCON_T1 < 95) && (5 < P_SDE23 && P_SDE23 < 95 && 5 < P_IM24 && P_IM24 < 95 && P_INCON25 < 95);
+            boolean LIBSAQGS8806 = (P_SDE_T1 < 95 && P_IM_T1 < 95 && P_INCON_T1 < 95) && (P_SDE23 <= 5 || P_IM24 <= 5) && (P_INCON25 < 95);
+            Map calculateMap = new HashMap();
+            calculateMap.put(LIBSAQGS8801, "LIBSAQGS8801");
+            calculateMap.put(LIBSAQGS8802, "LIBSAQGS8802");
+            calculateMap.put(LIBSAQGS8803, "LIBSAQGS8803");
+            calculateMap.put(LIBSAQGS8804, "LIBSAQGS8804");
+            calculateMap.put(LIBSAQGS8805, "LIBSAQGS8805");
+            calculateMap.put(LIBSAQGS8806, "LIBSAQGS8806");
+            String codeId = selectTrueObject(calculateMap);
+            //鏍规嵁鍛戒腑鍊艰幏鍙栨姤鍛婂瓧鍏歌繑鍥�
+            TLibraryCode maqReportLibrary = getMaqReportLibrary(map, codeId, langType);
+            return maqReportLibrary;
+        } catch (Exception ex) {
+            log.error("ResponseFidelityDiagnosisSAQGs error:{}", ex.getMessage(), ex);
+            return null;
+        }
+    }
+
+    @Override
+    public List<TLibraryCode> calculateList(Map<String, String> map, LangTypeEnum langType) {
+        try {
+            /**
+             * 鑾峰彇娉板浗鎺ュ彛杩斿洖鐨勬不鏍�
+             */
+            String p_sde_t1 = map.get("P_SDE_T1");
+            String p_im_t1 = map.get("P_IM_T1");
+            String p_incon_t1 = map.get("P_INCON_T1");
+            String p_sde23 = map.get("P_SDE23");
+            String p_im24 = map.get("P_IM24");
+            String p_incon25 = map.get("P_INCON25");
+            //妫�鏌ユ槸鍚︿负绌�
+            if (checkParamsIsNull(p_sde_t1, p_im_t1, p_incon_t1, p_sde23, p_im24, p_incon25)) {
+                return null;
+            }
+            Double P_SDE_T1 = Double.valueOf(p_sde_t1);
+            Double P_IM_T1 = Double.valueOf(p_im_t1);
+            Double P_INCON_T1 = Double.valueOf(p_incon_t1);
+            P_SDE23 = Double.valueOf(p_sde23);
+            P_IM24 = Double.valueOf(p_im24);
+            P_INCON25 = Double.valueOf(p_incon25);
+            //鏍规嵁鎸囨爣璁$畻瀵瑰簲瀛楀吀
+            boolean LIBSAQGS8801_3 = (P_SDE_T1 >= 95 || P_IM_T1 >= 95 || P_INCON_T1 >= 95) && (P_SDE23 >= 95 || P_IM24 >= 95 || P_INCON25 >= 95);
+            boolean LIBSAQGS8802_3 = (P_SDE_T1 >= 95 || P_IM_T1 >= 95 || P_INCON_T1 >= 95) && ((5 < P_SDE23 && P_SDE23 < 95) && (5 < P_IM24 && P_IM24 < 95) && P_INCON25 < 95);
+            boolean LIBSAQGS8803_3 = (P_SDE_T1 >= 95 || P_IM_T1 >= 95 || P_INCON_T1 >= 95) && (P_SDE23 <= 5 || P_IM24 <= 5) && (P_INCON25 < 95);
+            boolean LIBSAQGS8804_3 = (P_SDE_T1 < 95 && P_IM_T1 < 95 && P_INCON_T1 < 95) && (P_SDE23 >= 95 || P_IM24 >= 95 || P_INCON25 >= 95);
+            boolean LIBSAQGS8805_3 = (P_SDE_T1 < 95 && P_IM_T1 < 95 && P_INCON_T1 < 95) && ((5 < P_SDE23 && P_SDE23 < 95) && (5 < P_IM24 && P_IM24 < 95) && P_INCON25 < 95);
+            boolean LIBSAQGS8806_3 = (P_SDE_T1 < 95 && P_IM_T1 < 95 && P_INCON_T1 < 95) && (P_SDE23 <= 5 || P_IM24 <= 5) && (P_INCON25 < 95);
+            Map calculateMap = new HashMap();
+            calculateMap.put(LIBSAQGS8801_3, "LIBSAQGS88011,LIBSAQGS88012,LIBSAQGS88013");
+            calculateMap.put(LIBSAQGS8802_3, "LIBSAQGS88021,LIBSAQGS88022,LIBSAQGS88023");
+            calculateMap.put(LIBSAQGS8803_3, "LIBSAQGS88031,LIBSAQGS88032,LIBSAQGS88033");
+            calculateMap.put(LIBSAQGS8804_3, "LIBSAQGS88041,LIBSAQGS88042,LIBSAQGS88043");
+            calculateMap.put(LIBSAQGS8805_3, "LIBSAQGS88051,LIBSAQGS88052,LIBSAQGS88053");
+            calculateMap.put(LIBSAQGS8806_3, "LIBSAQGS88061,LIBSAQGS88062,LIBSAQGS88063");
+            String codeId = selectTrueObject(calculateMap);
+            String[] split = codeId.split(",");
+            List<TLibraryCode> libcodes = new ArrayList<>();
+            Arrays.stream(split).forEach(item -> {
+                libcodes.add(getMaqReportLibrary(map, item, langType));
+            });
+            return libcodes;
+        } catch (Exception ex) {
+            log.error("ResponseFidelityDiagnosisSAQGs error:{}", ex.getMessage(), ex);
+            return null;
+        }
+    }
+
+}
diff --git a/src/main/java/com/ots/project/tool/report/SAQ/gs/condition/ResponseFidelityDiagnosisSAQGsTitle.java b/src/main/java/com/ots/project/tool/report/SAQ/gs/condition/ResponseFidelityDiagnosisSAQGsTitle.java
new file mode 100644
index 0000000..5182c91
--- /dev/null
+++ b/src/main/java/com/ots/project/tool/report/SAQ/gs/condition/ResponseFidelityDiagnosisSAQGsTitle.java
@@ -0,0 +1,77 @@
+package com.ots.project.tool.report.SAQ.gs.condition;
+
+import com.ots.common.enums.LangTypeEnum;
+import com.ots.project.exam.domain.TLibraryCode;
+import com.ots.project.tool.report.MAQ.base.BaseCondition;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Description: SAQ绠�鏄撶増缁撴灉鍊艰绠�
+ * @Author: zhijie
+ * @Date: 2021/6/6
+ */
+@Getter
+@Setter
+@Slf4j
+public class ResponseFidelityDiagnosisSAQGsTitle extends BaseCondition {
+    private String name = "ResponseFidelityDiagnosisSAQGsTitle";
+    private Double P_SDE_T1;
+    private Double P_IM_T1;
+    private Double P_INCON_T1;
+    @Override
+    public Map<String, String> getMAQwaterDropsImages() {
+        return null;
+    }
+
+    /**
+     * 鍛戒腑璁$畻
+     * @param map
+     * @param langType
+     * @return
+     */
+    @Override
+    public TLibraryCode calculate(Map<String, String> map, LangTypeEnum langType) {
+        try {
+            String p_sde_t1 = map.get("P_SDE_T1");
+            String p_im_t1 = map.get("P_IM_T1");
+            String p_incon_t1 = map.get("P_INCON_T1");
+            String p_sde23 = map.get("P_SDE23");
+            String p_im24 = map.get("P_IM24");
+            String p_incon25 = map.get("P_INCON25");
+            if (checkParamsIsNull(p_sde_t1, p_im_t1, p_incon_t1, p_sde23, p_im24, p_incon25)) {
+                return null;
+            }
+            P_SDE_T1 = Double.valueOf(p_sde_t1);
+            P_IM_T1 = Double.valueOf(p_im_t1);
+            P_INCON_T1 = Double.valueOf(p_incon_t1);
+            Double P_SDE23 = Double.valueOf(p_sde23);
+            Double P_IM24 = Double.valueOf(p_im24);
+            Double P_INCON25 = Double.valueOf(p_incon25);
+            boolean LIBSAQ8810 =  (P_SDE_T1 >= 95 || P_IM_T1 >= 95 || P_INCON_T1 >= 95) && (P_SDE23 >= 95 || P_IM24 >= 95 || P_INCON25 >= 95);
+            boolean LIBSAQ8820 =  (P_SDE_T1 >= 95 || P_IM_T1 >= 95 || P_INCON_T1 >= 95) && (5 < P_SDE23 && P_SDE23< 95 && 5 < P_IM24 && P_IM24< 95 && P_INCON25 < 95);
+            boolean LIBSAQ8830 =  (P_SDE_T1 >= 95 || P_IM_T1 >= 95 || P_INCON_T1 >= 95) && (P_SDE23 <= 5 || P_IM24 <= 5) && (P_INCON25 < 95);
+            boolean LIBSAQ8840 =  (P_SDE_T1 < 95 && P_IM_T1 < 95 && P_INCON_T1 < 95) && (P_SDE23 >= 95 || P_IM24 >= 95 || P_INCON25 >= 95);
+            boolean LIBSAQ8850 =  (P_SDE_T1 < 95 && P_IM_T1 < 95 && P_INCON_T1 < 95) && (5 < P_SDE23 && P_SDE23 < 95 && 5 < P_IM24 && P_IM24 < 95 && P_INCON25 < 95);
+            boolean LIBSAQ8860 =  (P_SDE_T1 < 95 && P_IM_T1 < 95 && P_INCON_T1 < 95) && (P_SDE23 <= 5 || P_IM24 <= 5) && (P_INCON25 < 95);
+            Map calculateMap = new HashMap();
+            calculateMap.put(LIBSAQ8810, "LIBSAQ8810");
+            calculateMap.put(LIBSAQ8820, "LIBSAQ8820");
+            calculateMap.put(LIBSAQ8830, "LIBSAQ8830");
+            calculateMap.put(LIBSAQ8840, "LIBSAQ8840");
+            calculateMap.put(LIBSAQ8850, "LIBSAQ8850");
+            calculateMap.put(LIBSAQ8860, "LIBSAQ8860");
+            String codeId = selectTrueObject(calculateMap);
+            
+            TLibraryCode maqReportLibrary = getMaqReportLibrary(map, codeId ,langType);
+            return maqReportLibrary;
+        } catch (Exception ex) {
+            log.error("ResponseFidelityDiagnosisSAQTitle error:{}", ex.getMessage(), ex);
+            return null;
+        }
+    }
+}

--
Gitblit v1.9.1