[测评系统]--测评系统核心代码库
zhijie
2021-06-08 56c8bc18def3992259da50948119259f571d04ee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
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;
        }
    }
 
}