|
@@ -2,36 +2,18 @@ package com.xjrsoft.module.databoard.controller;
|
|
|
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
-import com.github.yulichang.toolkit.MPJWrappers;
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
-import com.xjrsoft.common.enums.DeleteMark;
|
|
|
|
import com.xjrsoft.common.enums.GenderDictionaryEnum;
|
|
import com.xjrsoft.common.enums.GenderDictionaryEnum;
|
|
-import com.xjrsoft.common.enums.StudyStatusEnum;
|
|
|
|
import com.xjrsoft.common.model.result.RT;
|
|
import com.xjrsoft.common.model.result.RT;
|
|
import com.xjrsoft.common.mybatis.SqlRunnerAdapter;
|
|
import com.xjrsoft.common.mybatis.SqlRunnerAdapter;
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
-import com.xjrsoft.module.courseTable.entity.CourseTable;
|
|
|
|
-import com.xjrsoft.module.courseTable.service.ICourseTableService;
|
|
|
|
import com.xjrsoft.module.databoard.dto.StatisticsDetailDto;
|
|
import com.xjrsoft.module.databoard.dto.StatisticsDetailDto;
|
|
-import com.xjrsoft.module.databoard.dto.StatisticsDto;
|
|
|
|
-import com.xjrsoft.module.databoard.vo.CourseStatisticsVo;
|
|
|
|
import com.xjrsoft.module.databoard.vo.DistributionVo;
|
|
import com.xjrsoft.module.databoard.vo.DistributionVo;
|
|
-import com.xjrsoft.module.databoard.vo.HealthStatisticsVo;
|
|
|
|
-import com.xjrsoft.module.databoard.vo.MeetingStatisticsVo;
|
|
|
|
-import com.xjrsoft.module.databoard.vo.PersonStatisticsVo;
|
|
|
|
|
|
+import com.xjrsoft.module.databoard.vo.DurationVo;
|
|
|
|
+import com.xjrsoft.module.databoard.vo.HealthItemCountVo;
|
|
|
|
+import com.xjrsoft.module.databoard.vo.HealthStatisticsDetailVo;
|
|
import com.xjrsoft.module.databoard.vo.ProcessStatisticsDetailVo;
|
|
import com.xjrsoft.module.databoard.vo.ProcessStatisticsDetailVo;
|
|
-import com.xjrsoft.module.databoard.vo.VisitorStatisticsVo;
|
|
|
|
-import com.xjrsoft.module.outint.entity.VisitorOutInRecord;
|
|
|
|
-import com.xjrsoft.module.outint.service.IVisitorOutInRecordService;
|
|
|
|
-import com.xjrsoft.module.student.dto.BaseStudentUserPageDto;
|
|
|
|
-import com.xjrsoft.module.student.service.IBaseStudentService;
|
|
|
|
-import com.xjrsoft.module.student.vo.BaseStudentUserPageVo;
|
|
|
|
import com.xjrsoft.module.system.entity.DictionaryDetail;
|
|
import com.xjrsoft.module.system.entity.DictionaryDetail;
|
|
-import com.xjrsoft.module.teacher.entity.BaseTeacher;
|
|
|
|
-import com.xjrsoft.module.teacher.entity.XjrUser;
|
|
|
|
-import com.xjrsoft.module.teacher.service.ITeacherbaseManagerService;
|
|
|
|
-import com.xjrsoft.module.teacher.vo.XjrUserPageVo;
|
|
|
|
import com.xjrsoft.module.workflow.constant.WorkflowConstant;
|
|
import com.xjrsoft.module.workflow.constant.WorkflowConstant;
|
|
import com.xjrsoft.module.workflow.entity.WorkflowExtra;
|
|
import com.xjrsoft.module.workflow.entity.WorkflowExtra;
|
|
import com.xjrsoft.module.workflow.entity.WorkflowSchema;
|
|
import com.xjrsoft.module.workflow.entity.WorkflowSchema;
|
|
@@ -48,10 +30,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
-import java.time.LocalDate;
|
|
|
|
|
|
+import java.time.Duration;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Comparator;
|
|
import java.util.Comparator;
|
|
-import java.util.Date;
|
|
|
|
import java.util.HashSet;
|
|
import java.util.HashSet;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@@ -70,13 +51,9 @@ import java.util.stream.Collectors;
|
|
public class DatadetailController {
|
|
public class DatadetailController {
|
|
|
|
|
|
private final HistoryService historyService;
|
|
private final HistoryService historyService;
|
|
- private final ICourseTableService courseTableService;
|
|
|
|
- private final IVisitorOutInRecordService visitorService;
|
|
|
|
- private final IBaseStudentService studentService;
|
|
|
|
- private final ITeacherbaseManagerService teacherService;
|
|
|
|
private final IWorkflowExtraService extraService;
|
|
private final IWorkflowExtraService extraService;
|
|
|
|
|
|
- @GetMapping(value = "/process-statistics-detail")
|
|
|
|
|
|
+ @GetMapping(value = "/process-statistics")
|
|
@ApiOperation(value="流程统计详情")
|
|
@ApiOperation(value="流程统计详情")
|
|
@SaCheckPermission("databoard:detail")
|
|
@SaCheckPermission("databoard:detail")
|
|
public RT<ProcessStatisticsDetailVo> processStatistics(@Valid StatisticsDetailDto dto){
|
|
public RT<ProcessStatisticsDetailVo> processStatistics(@Valid StatisticsDetailDto dto){
|
|
@@ -157,197 +134,66 @@ public class DatadetailController {
|
|
);
|
|
);
|
|
}
|
|
}
|
|
result.setDistributionList(distributionList);
|
|
result.setDistributionList(distributionList);
|
|
- return RT.ok(result);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @GetMapping(value = "/meeting-statistics")
|
|
|
|
- @ApiOperation(value="会议统计")
|
|
|
|
- @SaCheckPermission("databoard:detail")
|
|
|
|
- public RT<MeetingStatisticsVo> meetingStatistics(@Valid StatisticsDto dto){
|
|
|
|
- String sql = "SELECT id, (SELECT COUNT(*) FROM xjr_user WHERE FIND_IN_SET(id, meeting_apply_participants)) AS person_count FROM wf_meeting_apply";
|
|
|
|
- List<Map<String, Object>> list = SqlRunnerAdapter.db().selectList(sql);
|
|
|
|
- MeetingStatisticsVo result = new MeetingStatisticsVo();
|
|
|
|
- result.setAllCount(list.size());
|
|
|
|
- int personCount = 0;
|
|
|
|
- for (Map<String, Object> objectMap : list) {
|
|
|
|
- personCount += (Long)objectMap.get("person_count");
|
|
|
|
- }
|
|
|
|
- result.setPersonCount(personCount);
|
|
|
|
- return RT.ok(result);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @GetMapping(value = "/course-statistics")
|
|
|
|
- @ApiOperation(value="课表统计")
|
|
|
|
- @SaCheckPermission("databoard:detail")
|
|
|
|
- public RT<CourseStatisticsVo> courseStatistics(@Valid StatisticsDto dto){
|
|
|
|
- List<CourseTable> list = courseTableService.list(
|
|
|
|
- new QueryWrapper<CourseTable>().lambda()
|
|
|
|
- .eq(CourseTable::getScheduleDate, new Date())
|
|
|
|
- );
|
|
|
|
- CourseStatisticsVo result = new CourseStatisticsVo();
|
|
|
|
- result.setAllCount(list.size());
|
|
|
|
- int teacherCount = 0, noTeacherCount = 0;
|
|
|
|
- for (CourseTable courseTable : list) {
|
|
|
|
- if(courseTable.getTimePeriod() != null && courseTable.getTeacherId() != 0){
|
|
|
|
- teacherCount ++;
|
|
|
|
|
|
+ List<DurationVo> durationList = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ List<Duration> timeDifferences = new ArrayList<>();
|
|
|
|
+ completeCountList.stream().filter(el -> el.getEndTime() != null && el.getStartTime() != null).forEach(el -> {
|
|
|
|
+ Duration diff = Duration.between(el.getEndTime(), el.getStartTime());
|
|
|
|
+ timeDifferences.add(diff);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ int zeroHour = 0;
|
|
|
|
+ int oneHour = 0;
|
|
|
|
+ int fourHour = 0;
|
|
|
|
+ int eightHour = 0;
|
|
|
|
+ for (Duration timeDifference : timeDifferences) {
|
|
|
|
+ long seconds = timeDifference.getSeconds();
|
|
|
|
+ if(seconds < 3600){
|
|
|
|
+ zeroHour ++;
|
|
|
|
+ }else if(seconds < 14400){
|
|
|
|
+ oneHour ++;
|
|
|
|
+ }else if(seconds < 28800){
|
|
|
|
+ fourHour ++;
|
|
}else{
|
|
}else{
|
|
- noTeacherCount ++;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- result.setTeacherCount(teacherCount);
|
|
|
|
- result.setNoTeacherCount(noTeacherCount);
|
|
|
|
-
|
|
|
|
- String sql = "SELECT * FROM wf_course_adjust WHERE STATUS = 1 AND exchange_date = NOW() and adjust_type = 'course_adjust'";
|
|
|
|
- long adjustCount = SqlRunnerAdapter.db().selectCount(sql);
|
|
|
|
- result.setAdjustCount(Integer.parseInt(adjustCount + ""));
|
|
|
|
-
|
|
|
|
- sql = "SELECT * FROM wf_course_adjust WHERE STATUS = 1 AND exchange_date = NOW() and adjust_type = 'course_exchange'";
|
|
|
|
- long exchangeCount = SqlRunnerAdapter.db().selectCount(sql);
|
|
|
|
- result.setReplaceCount(Integer.parseInt(exchangeCount + ""));
|
|
|
|
-
|
|
|
|
- return RT.ok(result);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @GetMapping(value = "/visitor-statistics")
|
|
|
|
- @ApiOperation(value="访客统计")
|
|
|
|
- @SaCheckPermission("databoard:detail")
|
|
|
|
- public RT<VisitorStatisticsVo> visitorStatistics(@Valid StatisticsDto dto){
|
|
|
|
- List<VisitorOutInRecord> list = visitorService.list(
|
|
|
|
- new QueryWrapper<VisitorOutInRecord>().lambda()
|
|
|
|
- .eq(VisitorOutInRecord::getDeleteMark, DeleteMark.DELETED.getCode())
|
|
|
|
- );
|
|
|
|
- VisitorStatisticsVo result = new VisitorStatisticsVo();
|
|
|
|
- result.setAllCount(list.size());
|
|
|
|
- LocalDate today = LocalDate.now();
|
|
|
|
- int todayCount = 0;
|
|
|
|
- for (VisitorOutInRecord record : list) {
|
|
|
|
- if(today.equals(record.getRecordTime().toLocalDate())){
|
|
|
|
- todayCount ++;
|
|
|
|
|
|
+ eightHour ++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- result.setTodayCount(todayCount);
|
|
|
|
- return RT.ok(result);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @GetMapping(value = "/person-statistics")
|
|
|
|
- @ApiOperation(value="全校师生数据概览")
|
|
|
|
- @SaCheckPermission("databoard:detail")
|
|
|
|
- public RT<PersonStatisticsVo> personStatistics(@Valid StatisticsDto dto){
|
|
|
|
-
|
|
|
|
- List<BaseStudentUserPageVo> studentList = studentService.getStudentList(new BaseStudentUserPageDto());
|
|
|
|
-
|
|
|
|
- PersonStatisticsVo result = new PersonStatisticsVo();
|
|
|
|
- result.setStudentCount(studentList.size());
|
|
|
|
|
|
+ DurationVo zeroVo = new DurationVo();
|
|
|
|
+ zeroVo.setDuration("0-1h");
|
|
|
|
+ zeroVo.setCount(zeroHour);
|
|
|
|
+ durationList.add(zeroVo);
|
|
|
|
|
|
- Set<String> studentMaleSet = studentList.stream()
|
|
|
|
- .filter(x -> (x.getGenderCn() != null && x.getGenderCn().equals(GenderDictionaryEnum.MALE.getCode())))
|
|
|
|
- .map(BaseStudentUserPageVo::getId).collect(Collectors.toSet());
|
|
|
|
- result.setStudentMaleCount(studentMaleSet.size());
|
|
|
|
|
|
+ zeroVo = new DurationVo();
|
|
|
|
+ zeroVo.setDuration("1-4h");
|
|
|
|
+ zeroVo.setCount(oneHour);
|
|
|
|
+ durationList.add(zeroVo);
|
|
|
|
|
|
- Set<String> studentFemaleSet = studentList.stream()
|
|
|
|
- .filter(x -> (x.getGenderCn() != null && x.getGenderCn().equals(GenderDictionaryEnum.FEMALE.getCode())))
|
|
|
|
- .map(BaseStudentUserPageVo::getId).collect(Collectors.toSet());
|
|
|
|
- result.setStudentFemaleCount(studentFemaleSet.size());
|
|
|
|
|
|
+ zeroVo = new DurationVo();
|
|
|
|
+ zeroVo.setDuration("4-8h");
|
|
|
|
+ zeroVo.setCount(fourHour);
|
|
|
|
+ durationList.add(zeroVo);
|
|
|
|
|
|
- Set<String> studentStayMaleSet = studentList.stream()
|
|
|
|
- .filter(x -> (
|
|
|
|
- x.getGenderCn() != null
|
|
|
|
- && x.getGenderCn().equals(GenderDictionaryEnum.MALE.getCode())
|
|
|
|
- && x.getStduyStatusCn() != null
|
|
|
|
- && x.getStduyStatusCn().equals(StudyStatusEnum.InResidence.getCode())
|
|
|
|
- ))
|
|
|
|
- .map(BaseStudentUserPageVo::getId).collect(Collectors.toSet());
|
|
|
|
- result.setStudentStayMaleCount(studentStayMaleSet.size());
|
|
|
|
|
|
+ zeroVo = new DurationVo();
|
|
|
|
+ zeroVo.setDuration("8h以上");
|
|
|
|
+ zeroVo.setCount(eightHour);
|
|
|
|
+ durationList.add(zeroVo);
|
|
|
|
|
|
- Set<String> studentNotStayMaleSet = studentList.stream()
|
|
|
|
- .filter(x -> (
|
|
|
|
- x.getGenderCn() != null
|
|
|
|
- && x.getGenderCn().equals(GenderDictionaryEnum.MALE.getCode())
|
|
|
|
- && x.getStduyStatusCn() != null
|
|
|
|
- && x.getStduyStatusCn().equals(StudyStatusEnum.AttendDaySchool.getCode())
|
|
|
|
- ))
|
|
|
|
- .map(BaseStudentUserPageVo::getId).collect(Collectors.toSet());
|
|
|
|
- result.setStudentNotStayMaleCount(studentNotStayMaleSet.size());
|
|
|
|
|
|
+ result.setDurationList(durationList);
|
|
|
|
|
|
- Set<String> studentStayFemaleSet = studentList.stream()
|
|
|
|
- .filter(x -> (
|
|
|
|
- x.getGenderCn() != null
|
|
|
|
- && x.getGenderCn().equals(GenderDictionaryEnum.FEMALE.getCode())
|
|
|
|
- && x.getStduyStatusCn() != null
|
|
|
|
- && x.getStduyStatusCn().equals(StudyStatusEnum.InResidence.getCode())
|
|
|
|
- ))
|
|
|
|
- .map(BaseStudentUserPageVo::getId).collect(Collectors.toSet());
|
|
|
|
- result.setStudentStayFemaleCount(studentStayFemaleSet.size());
|
|
|
|
-
|
|
|
|
- Set<String> studentNotStayFemaleSet = studentList.stream()
|
|
|
|
- .filter(x -> (
|
|
|
|
- x.getGenderCn() != null
|
|
|
|
- && x.getGenderCn().equals(GenderDictionaryEnum.FEMALE.getCode())
|
|
|
|
- && x.getStduyStatusCn() != null
|
|
|
|
- && x.getStduyStatusCn().equals(StudyStatusEnum.AttendDaySchool.getCode())
|
|
|
|
- ))
|
|
|
|
- .map(BaseStudentUserPageVo::getId).collect(Collectors.toSet());
|
|
|
|
- result.setStudentNotStayFemaleCount(studentNotStayFemaleSet.size());
|
|
|
|
-
|
|
|
|
- MPJLambdaWrapper<XjrUser> queryWrapper = MPJWrappers.<XjrUser>lambdaJoin()
|
|
|
|
- .disableSubLogicDel()
|
|
|
|
- .orderByDesc(XjrUser::getId)
|
|
|
|
- .select(XjrUser::getId)
|
|
|
|
- .select(XjrUser.class,x -> VoToColumnUtil.fieldsToColumns(XjrUserPageVo.class).contains(x.getProperty()))
|
|
|
|
- .innerJoin(BaseTeacher.class,BaseTeacher::getUserId,XjrUser::getId)
|
|
|
|
- .leftJoin(DictionaryDetail.class,DictionaryDetail::getCode,BaseTeacher::getJobState, ext->ext.selectAs(DictionaryDetail::getName, XjrUserPageVo::getJobState))
|
|
|
|
- .leftJoin(DictionaryDetail.class,DictionaryDetail::getCode,XjrUser::getCredentialType,ext->ext.selectAs(DictionaryDetail::getName, XjrUserPageVo::getCredentialType))
|
|
|
|
- .leftJoin(DictionaryDetail.class,DictionaryDetail::getCode,BaseTeacher::getEmployWay,ext->ext.selectAs(DictionaryDetail::getName, XjrUserPageVo::getEmployWay))
|
|
|
|
-
|
|
|
|
- .selectAsClass(BaseTeacher.class, XjrUserPageVo.class);
|
|
|
|
-
|
|
|
|
- List<XjrUserPageVo> teacherList = teacherService.selectJoinList(XjrUserPageVo.class, queryWrapper);
|
|
|
|
- result.setTeacherCount(teacherList.size());
|
|
|
|
-
|
|
|
|
- Set<String> teacherMaleSet = teacherList.stream()
|
|
|
|
- .filter(x -> (x.getGender() != null && x.getGender().equals(GenderDictionaryEnum.MALE.getCode())))
|
|
|
|
- .map(XjrUserPageVo::getId).collect(Collectors.toSet());
|
|
|
|
- result.setTeacherMaleCount(teacherMaleSet.size());
|
|
|
|
-
|
|
|
|
- Set<String> teacherFemaleSet = teacherList.stream()
|
|
|
|
- .filter(x -> (x.getGender() != null && x.getGender().equals(GenderDictionaryEnum.FEMALE.getCode())))
|
|
|
|
- .map(XjrUserPageVo::getId).collect(Collectors.toSet());
|
|
|
|
- result.setTeacherFemaleCount(teacherFemaleSet.size());
|
|
|
|
-
|
|
|
|
- Set<String> teacherSet1 = teacherList.stream()
|
|
|
|
- .filter(x -> (x.getEmployWay() != null && x.getEmployWay().equals("FB1601")))
|
|
|
|
- .map(XjrUserPageVo::getId).collect(Collectors.toSet());
|
|
|
|
- result.setTeacherCount1(teacherSet1.size());
|
|
|
|
- Set<String> teacherSet2 = teacherList.stream()
|
|
|
|
- .filter(x -> (x.getEmployWay() != null && x.getEmployWay().equals("FB1602")))
|
|
|
|
- .map(XjrUserPageVo::getId).collect(Collectors.toSet());
|
|
|
|
- result.setTeacherCount2(teacherSet2.size());
|
|
|
|
- Set<String> teacherSet3 = teacherList.stream()
|
|
|
|
- .filter(x -> (x.getEmployWay() != null && x.getEmployWay().equals("FB1606")))
|
|
|
|
- .map(XjrUserPageVo::getId).collect(Collectors.toSet());
|
|
|
|
- result.setTeacherCount3(teacherSet3.size());
|
|
|
|
- Set<String> teacherSet4 = teacherList.stream()
|
|
|
|
- .filter(x -> (x.getEmployWay() != null && x.getEmployWay().equals("FB1609")))
|
|
|
|
- .map(XjrUserPageVo::getId).collect(Collectors.toSet());
|
|
|
|
- result.setTeacherCount4(teacherSet4.size());
|
|
|
|
- Set<String> teacherSet5 = teacherList.stream()
|
|
|
|
- .filter(x -> (x.getEmployWay() != null && x.getEmployWay().equals("FB1608")))
|
|
|
|
- .map(XjrUserPageVo::getId).collect(Collectors.toSet());
|
|
|
|
- result.setTeacherCount5(teacherSet5.size());
|
|
|
|
return RT.ok(result);
|
|
return RT.ok(result);
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping(value = "/health-statistics")
|
|
@GetMapping(value = "/health-statistics")
|
|
@ApiOperation(value="学生健康统计")
|
|
@ApiOperation(value="学生健康统计")
|
|
@SaCheckPermission("databoard:detail")
|
|
@SaCheckPermission("databoard:detail")
|
|
- public RT<HealthStatisticsVo> healthStatistics(@Valid StatisticsDto dto){
|
|
|
|
|
|
+ public RT<HealthStatisticsDetailVo> healthStatistics(@Valid StatisticsDetailDto dto){
|
|
String sql = "SELECT gender,COUNT(*) AS a_count FROM student_infection WHERE status = 1 GROUP BY gender";
|
|
String sql = "SELECT gender,COUNT(*) AS a_count FROM student_infection WHERE status = 1 GROUP BY gender";
|
|
List<Map<String, Object>> list = SqlRunnerAdapter.db().selectList(sql);
|
|
List<Map<String, Object>> list = SqlRunnerAdapter.db().selectList(sql);
|
|
- HealthStatisticsVo result = new HealthStatisticsVo();
|
|
|
|
|
|
+ HealthStatisticsDetailVo result = new HealthStatisticsDetailVo();
|
|
for (Map<String, Object> objectMap : list) {
|
|
for (Map<String, Object> objectMap : list) {
|
|
- if(GenderDictionaryEnum.FEMALE.getCode().equals(objectMap.get("gender").toString())){
|
|
|
|
|
|
+ if(objectMap.get("gender") != null && GenderDictionaryEnum.FEMALE.getCode().equals(objectMap.get("gender").toString())){
|
|
result.setInfectionFemaleCount(Integer.parseInt(objectMap.get("a_count").toString()));
|
|
result.setInfectionFemaleCount(Integer.parseInt(objectMap.get("a_count").toString()));
|
|
- }if(GenderDictionaryEnum.MALE.getCode().equals(objectMap.get("gender").toString())){
|
|
|
|
|
|
+ }if(objectMap.get("gender") != null && GenderDictionaryEnum.MALE.getCode().equals(objectMap.get("gender").toString())){
|
|
result.setInfectionMaleCount(Integer.parseInt(objectMap.get("a_count").toString()));
|
|
result.setInfectionMaleCount(Integer.parseInt(objectMap.get("a_count").toString()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -355,12 +201,74 @@ public class DatadetailController {
|
|
sql = "SELECT gender,COUNT(*) AS a_count FROM student_psychological WHERE status = 1 GROUP BY gender";
|
|
sql = "SELECT gender,COUNT(*) AS a_count FROM student_psychological WHERE status = 1 GROUP BY gender";
|
|
list = SqlRunnerAdapter.db().selectList(sql);
|
|
list = SqlRunnerAdapter.db().selectList(sql);
|
|
for (Map<String, Object> objectMap : list) {
|
|
for (Map<String, Object> objectMap : list) {
|
|
- if(GenderDictionaryEnum.FEMALE.getCode().equals(objectMap.get("gender").toString())){
|
|
|
|
|
|
+ if(objectMap.get("gender") != null && GenderDictionaryEnum.FEMALE.getCode().equals(objectMap.get("gender").toString())){
|
|
result.setInfectionFemaleCount(Integer.parseInt(objectMap.get("a_count").toString()));
|
|
result.setInfectionFemaleCount(Integer.parseInt(objectMap.get("a_count").toString()));
|
|
- }if(GenderDictionaryEnum.MALE.getCode().equals(objectMap.get("gender").toString())){
|
|
|
|
|
|
+ }if(objectMap.get("gender") != null && GenderDictionaryEnum.MALE.getCode().equals(objectMap.get("gender").toString())){
|
|
result.setPsychologicalMaleCount(Integer.parseInt(objectMap.get("a_count").toString()));
|
|
result.setPsychologicalMaleCount(Integer.parseInt(objectMap.get("a_count").toString()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ List<HealthItemCountVo> gradeList = new ArrayList<>();
|
|
|
|
+ sql = "SELECT t1.name as item,COUNT(t3.student_id) AS count FROM base_grade t1" +
|
|
|
|
+ " INNER JOIN base_student_school_roll t2 ON t1.id= t2.grade_id" +
|
|
|
|
+ " INNER JOIN student_infection t3 ON t3.student_id = t2.user_id" +
|
|
|
|
+ " WHERE t3.status = 1 AND t1.delete_mark = 0" +
|
|
|
|
+ " GROUP BY t1.name";
|
|
|
|
+ list = SqlRunnerAdapter.db().selectList(sql);
|
|
|
|
+ for (Map<String, Object> objectMap : list) {
|
|
|
|
+ gradeList.add(
|
|
|
|
+ new HealthItemCountVo(){{
|
|
|
|
+ setItem(objectMap.get("item").toString());
|
|
|
|
+ setInfectionCount(Long.parseLong(objectMap.get("count").toString()));
|
|
|
|
+ }}
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ sql = "SELECT t1.name as item,COUNT(t3.student_id) AS count FROM base_grade t1" +
|
|
|
|
+ " INNER JOIN base_student_school_roll t2 ON t1.id= t2.grade_id" +
|
|
|
|
+ " INNER JOIN student_psychological t3 ON t3.student_id = t2.user_id" +
|
|
|
|
+ " WHERE t3.status = 1 AND t1.delete_mark = 0" +
|
|
|
|
+ " GROUP BY t1.name";
|
|
|
|
+ list = SqlRunnerAdapter.db().selectList(sql);
|
|
|
|
+ for (Map<String, Object> objectMap : list) {
|
|
|
|
+ for (HealthItemCountVo itemCountVo : gradeList) {
|
|
|
|
+ if(objectMap.get("item").toString().equals(itemCountVo.getItem())){
|
|
|
|
+ itemCountVo.setPsychologicalCount(Long.parseLong(objectMap.get("count").toString()));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ result.setGradeList(gradeList);
|
|
|
|
+
|
|
|
|
+ List<HealthItemCountVo> classList = new ArrayList<>();
|
|
|
|
+ sql = "SELECT t1.name as item,COUNT(t3.student_id) AS count FROM base_class t1" +
|
|
|
|
+ " INNER JOIN base_student_school_roll t2 ON t1.id= t2.grade_id" +
|
|
|
|
+ " INNER JOIN student_infection t3 ON t3.student_id = t2.user_id" +
|
|
|
|
+ " WHERE t3.status = 1 AND t1.delete_mark = 0" +
|
|
|
|
+ " GROUP BY t1.name";
|
|
|
|
+ list = SqlRunnerAdapter.db().selectList(sql);
|
|
|
|
+ for (Map<String, Object> objectMap : list) {
|
|
|
|
+ classList.add(
|
|
|
|
+ new HealthItemCountVo(){{
|
|
|
|
+ setItem(objectMap.get("item").toString());
|
|
|
|
+ setInfectionCount(Long.parseLong(objectMap.get("count").toString()));
|
|
|
|
+ }}
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ sql = "SELECT t1.name as item,COUNT(t3.student_id) AS count FROM base_class t1" +
|
|
|
|
+ " INNER JOIN base_student_school_roll t2 ON t1.id= t2.grade_id" +
|
|
|
|
+ " INNER JOIN student_psychological t3 ON t3.student_id = t2.user_id" +
|
|
|
|
+ " WHERE t3.status = 1 AND t1.delete_mark = 0" +
|
|
|
|
+ " GROUP BY t1.name";
|
|
|
|
+ list = SqlRunnerAdapter.db().selectList(sql);
|
|
|
|
+ for (Map<String, Object> objectMap : list) {
|
|
|
|
+ for (HealthItemCountVo itemCountVo : classList) {
|
|
|
|
+ if(objectMap.get("item").toString().equals(itemCountVo.getItem())){
|
|
|
|
+ itemCountVo.setPsychologicalCount(Long.parseLong(objectMap.get("count").toString()));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ result.setClassList(classList);
|
|
return RT.ok(result);
|
|
return RT.ok(result);
|
|
}
|
|
}
|
|
|
|
|