| | |
| | | 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; |
| | |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | 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\">" |
| | |
| | | } |
| | | |
| | | 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) { |
| | | |
| | |
| | | //设置文本 |
| | | 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); |
| | |
| | | } |
| | | } |
| | | private static String getValByKey(String text, Map<String, Object> textMap) { |
| | | log.debug("changeTextBox:{}",text); |
| | | if (!checkText(text)) { |
| | | return text; |
| | | } |
| | |
| | | productTypeMap.put("SAQ", "SAQ"); |
| | | productTypeMap.put("JAQ", "JAQ"); |
| | | } |
| | | private static void setWaterDropAndBar() { |
| | | |
| | | /** |
| | | * 设置水滴背景对应图片 |
| | | */ |
| | | 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"); |
| | | |
| | |
| | | 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"); |
| | |
| | | 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"); |
| | |
| | | } |
| | | 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; |
| | |
| | | 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; |
| | |
| | | |
| | | 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); |
| | |
| | | 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 |
| | |
| | | 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(); |
| | |
| | | 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); |
| | |
| | | @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(); |
| | |
| | | @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(); |
| | |
| | | @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"); |
| | |
| | | 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"); |
| | |
| | | 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"); |
| | |
| | | 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)); |
| | |
| | | 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); |
| | |
| | | @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(); |
| | |
| | | @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(); |
| | |
| | | @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"); |
| | |
| | | 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"); |
| | |
| | | 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"); |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<TLibraryCode> calculateList(Map<String, String> map, LangTypeEnum langType) { |
| | | try { |
| | | String p_sde_t1 = map.get("P_SDE_T1"); |
| | |
| | | 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"); |
| | |
| | | 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"); |
| | |
| | | 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; |
| | |
| | | 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<>(); |
| | | |
| | |
| | | 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); |
| | |
| | | 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", |
| | |
| | | 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()); |
| | |
| | | textMap.put("reportGenerationDate", getReportGenerationDate()); |
| | | textMap.put("userName", getUserName()); |
| | | textMap.put("questionnaireEmail", getQuestionnaireEmail()); |
| | | |
| | | //根据报告类型获取报告字典 |
| | | getParamList(type).stream().forEach(p -> { |
| | | TLibraryCode calculate = p.calculate(thaiCalculationMap, 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()); |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | } |
New file |
| | |
| | | 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图表 散点图跟柱形图数据变更 |
| | | * @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图表 散点图跟柱形图组合图形 |
| | | * @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); |
| | | |
| | | //散点图 |
| | | if (!plot.getScatterChartList().isEmpty()) { |
| | | CTScatterChart scatterChart = plot.getScatterChartArray(0); |
| | | //System.out.println("散点图{"+plot.getScatterChartList().size()+"}"); |
| | | //刷新内置excel数据 |
| | | refreshExcel(seriesDatas, workbook, sheet); |
| | | workbook.write(chart.getPackagePart().getOutputStream()); |
| | | |
| | | //散点图数据源 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()) { |
| | | //更新散点图缓存 |
| | | 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); |
| | | //因为柱形图CTBarSer没按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图表 散点图跟柱形图组合图形失败:{}",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)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 更新 散点图 缓存数据 |
| | | * |
| | | * @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("散点图{"+plotArea.getScatterChartList().size()+"}"); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | 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"); |
| | |
| | | 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"); |
New file |
| | |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
| | | } |
| | | } |