Browse Source

生成考试报告

ywx
雍文秀 1 month ago
parent
commit
f391fc3716

+ 3
- 0
smarking/src/main/java/com/xhkjedu/smarking/model/report/reportstu/MsrStudent.java View File

52
     @Transient
52
     @Transient
53
     //学生考试状态0未进场1已进场2已交卷3缺考
53
     //学生考试状态0未进场1已进场2已交卷3缺考
54
     private Integer sstate;
54
     private Integer sstate;
55
+    @Transient
56
+    //得分率
57
+    private Double scorerate;
55
 }
58
 }

+ 12
- 1
smarking/src/main/java/com/xhkjedu/smarking/service/report/reportother/MsrExamService.java View File

58
         Integer totalnum = N_Utils.obj2Int(students.stream().map(MsClassStudent::getStudentid).distinct().count());
58
         Integer totalnum = N_Utils.obj2Int(students.stream().map(MsClassStudent::getStudentid).distinct().count());
59
         Integer stunum = N_Utils.obj2Int(paperStudents.stream().filter(s -> s.getSstate().equals(2)).map(MsPaperStudent::getStudentid).distinct().count());
59
         Integer stunum = N_Utils.obj2Int(paperStudents.stream().filter(s -> s.getSstate().equals(2)).map(MsPaperStudent::getStudentid).distinct().count());
60
         Integer missnum = totalnum - stunum;
60
         Integer missnum = totalnum - stunum;
61
+        double fullscore = subjects.stream().mapToDouble(MsPaper::getPscore).sum();
61
         List<MsrStudent> schoolStudents = new ArrayList<>();//学校学生成绩
62
         List<MsrStudent> schoolStudents = new ArrayList<>();//学校学生成绩
62
         List<MsrStudent> schoolSubjectStudents = new ArrayList<>();//学校科目学生成绩
63
         List<MsrStudent> schoolSubjectStudents = new ArrayList<>();//学校科目学生成绩
63
         List<MsrStudent> classStudents = new ArrayList<>();//班级学生成绩
64
         List<MsrStudent> classStudents = new ArrayList<>();//班级学生成绩
76
             cs.setStudentid(studentid);
77
             cs.setStudentid(studentid);
77
             cs.setStuscore(list.stream().mapToDouble(MsPaperStudent::getStuscore).sum());
78
             cs.setStuscore(list.stream().mapToDouble(MsPaperStudent::getStuscore).sum());
78
             cs.setSstate(list.stream().max(Comparator.comparing(MsPaperStudent::getSstate)).get().getSstate());
79
             cs.setSstate(list.stream().max(Comparator.comparing(MsPaperStudent::getSstate)).get().getSstate());
80
+            cs.setScorerate(N_Utils.getDoubleDivideAndMulitiply(cs.getStuscore(), fullscore));
79
             schoolStudents.add(cs);
81
             schoolStudents.add(cs);
80
         }
82
         }
81
         List<MsrStudent> paperStudents2 = new ArrayList<>();
83
         List<MsrStudent> paperStudents2 = new ArrayList<>();
150
 
152
 
151
         //科目分析
153
         //科目分析
152
         Map<String, List<MsPaperStudent>> subjectCollect = paperStudents.stream().collect(Collectors.groupingBy(MsPaperStudent::getSubjectid));
154
         Map<String, List<MsPaperStudent>> subjectCollect = paperStudents.stream().collect(Collectors.groupingBy(MsPaperStudent::getSubjectid));
153
-        double fullscore = subjects.stream().mapToDouble(MsPaper::getPscore).sum();
154
         List<MsrSubject> msrSubjects = new ArrayList<>();
155
         List<MsrSubject> msrSubjects = new ArrayList<>();
155
         MsrSubject msrSubject = new MsrSubject();
156
         MsrSubject msrSubject = new MsrSubject();
156
         msrSubject.setExamid(examid);
157
         msrSubject.setExamid(examid);
161
         msrSubject.setMinscore(schoolStatisticsMin);
162
         msrSubject.setMinscore(schoolStatisticsMin);
162
         msrSubject.setAvgscore(schoolStatisticsAverage);
163
         msrSubject.setAvgscore(schoolStatisticsAverage);
163
         msrSubject.setScorerate(N_Utils.getDoubleDivideAndMulitiply(schoolStatisticsAverage, fullscore));
164
         msrSubject.setScorerate(N_Utils.getDoubleDivideAndMulitiply(schoolStatisticsAverage, fullscore));
165
+        List<Double> scores = schoolStudents2.stream().map(MsrStudent::getStuscore).sorted().collect(Collectors.toList());
166
+        double bzc = MarkingUtil.bzc(scores);
167
+        msrSubject.setBzc(bzc);
168
+        msrSubject.setCyxs(N_Utils.getDoubleDivideAndMulitiply(bzc, schoolStatisticsAverage));
169
+        msrSubject.setNd(MarkingUtil.div(schoolStatisticsAverage, fullscore));
170
+        msrSubject.setQfd(MarkingUtil.qfd(scores));
171
+        List<Double> scoreRates = schoolStudents2.stream().map(MsrStudent::getScorerate).sorted().collect(Collectors.toList());
172
+        double dfllc = MarkingUtil.sub(scoreRates.get(scoreRates.size() - 1), scoreRates.get(0));
173
+        msrSubject.setDflxdlc(MarkingUtil.div(dfllc, schoolStatisticsAverage));
174
+        msrSubject.setDfllc(dfllc);
164
         msrSubject.setTotalnum(totalnum);
175
         msrSubject.setTotalnum(totalnum);
165
         msrSubject.setStunum(stunum);
176
         msrSubject.setStunum(stunum);
166
         msrSubject.setMissnum(missnum);
177
         msrSubject.setMissnum(missnum);

+ 26
- 0
smarking/src/main/java/com/xhkjedu/smarking/utils/MarkingUtil.java View File

398
         return N_Utils.formatDouble(Math.sqrt(fc(x)), 2);
398
         return N_Utils.formatDouble(Math.sqrt(fc(x)), 2);
399
     }
399
     }
400
 
400
 
401
+    //区分度=2×(高分组平均分-低分组平均分)/100
402
+    public static double qfd(List<Double> scores) {
403
+        if (N_Utils.isListEmpty(scores)) return 0;
404
+
405
+        int totalCount = scores.size();
406
+        int highCount = (int) Math.ceil(totalCount * 0.27); // 高分组人数
407
+        int lowCount = (int) Math.ceil(totalCount * 0.27);  // 低分组人数
408
+
409
+        List<Double> highGroup = new ArrayList<>(scores.subList(totalCount - highCount, totalCount)); // 高分组
410
+        List<Double> lowGroup = new ArrayList<>(scores.subList(0, lowCount)); // 低分组
411
+        // 计算高分组和低分组的平均分
412
+        double highGroupAvg = calculateAverage(highGroup);
413
+        double lowGroupAvg = calculateAverage(lowGroup);
414
+        return div(mul(2, sub(highGroupAvg, lowGroupAvg)), 100);
415
+    }
416
+
417
+    //计算平均分
418
+    public static double calculateAverage(List<Double> scores) {
419
+        if (N_Utils.isListEmpty(scores)) return 0;
420
+        double sum = 0.0;
421
+        for (double score : scores) {
422
+            sum = add(sum, score);
423
+        }
424
+        return div(sum, scores.size());
425
+    }
426
+
401
 
427
 
402
     public static void main(String[] args) {
428
     public static void main(String[] args) {
403
         String str = "ADAC-D-(C)(AB)(CD)(ACB)BB";
429
         String str = "ADAC-D-(C)(AB)(CD)(ACB)BB";

Loading…
Cancel
Save