Kaynağa Gözat

学生历史信息

LIVE_YE 1 yıl önce
ebeveyn
işleme
b88bc9b130

+ 9 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/info/StudentInfoController.java

@@ -101,4 +101,13 @@ public class StudentInfoController extends BaseController
     {
         return toAjax(studentInfoService.deleteStudentInfoByIds(ids));
     }
+
+    /**
+     * 统计学生档案信息
+     */
+    @GetMapping("/statistics")
+    public AjaxResult statistics(StudentInfo studentInfo)
+    {
+        return studentInfoService.statistics(studentInfo);
+    }
 }

+ 11 - 1
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/FormalParentsStudent.java

@@ -54,7 +54,17 @@ public class FormalParentsStudent extends BaseEntity
     @Excel(name = "学号")
     private String studentNumber;
 
-    public void setId(Long id) 
+    private String role;
+
+    public String getRole() {
+        return role;
+    }
+
+    public void setRole(String role) {
+        this.role = role;
+    }
+
+    public void setId(Long id)
     {
         this.id = id;
     }

+ 10 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/StudentInfo.java

@@ -119,6 +119,16 @@ public class StudentInfo extends BaseEntity
 
     private String classId;
 
+    private Long parentsId;
+
+    public Long getParentsId() {
+        return parentsId;
+    }
+
+    public void setParentsId(Long parentsId) {
+        this.parentsId = parentsId;
+    }
+
     public void setIsLset(String isLset) {
         this.isLset = isLset;
     }

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/TeacherInfo.java

@@ -101,6 +101,8 @@ public class TeacherInfo extends BaseEntity
     @JsonFormat(pattern = "yyyy-MM-dd")
     private Date jobTime;
 
+
+
     public Date getOnBoardTime() {
         return onBoardTime;
     }

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IStudentInfoService.java

@@ -60,4 +60,6 @@ public interface IStudentInfoService
      * @return 结果
      */
     public int deleteStudentInfoById(Long id);
+
+    AjaxResult statistics(StudentInfo studentInfo);
 }

+ 14 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FormalParentsStudentServiceImpl.java

@@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 import com.ruoyi.common.core.domain.entity.FormalParentsStudent;
 import com.ruoyi.common.core.domain.entity.SysUser;
@@ -102,7 +103,19 @@ public class FormalParentsStudentServiceImpl implements IFormalParentsStudentSer
     @Override
     public List<FormalParentsStudent> selectFormalParentsStudentListNoPage(FormalParentsStudent formalParentsStudent) {
         SysUser user = SecurityUtils.getLoginUser().getUser();
-        formalParentsStudent.setParentsId(user.getUserId());
+
+        if(!"admin".equals(user.getUserName())){
+            Map<String, Object> params = formalParentsStudent.getParams();
+            String role = "";
+            if (params != null && params.size() > 0) {
+                role = (String) params.get("role");
+            }
+
+            if("parents".equals(role)){
+                formalParentsStudent.setParentsId(user.getUserId());
+            }
+        }
+
         return formalParentsStudentMapper.selectFormalParentsStudentList(formalParentsStudent);
     }
 }

+ 61 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/StudentInfoServiceImpl.java

@@ -1,10 +1,15 @@
 package com.ruoyi.system.service.impl;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.utils.ClassUtils;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.domain.StudentInfoOld;
 import com.ruoyi.system.domain.StudentLiveOld;
 import com.ruoyi.system.domain.StudentMindOld;
@@ -57,6 +62,15 @@ public class StudentInfoServiceImpl implements IStudentInfoService
     @Override
     public List<StudentInfo> selectStudentInfoList(StudentInfo studentInfo)
     {
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        Map<String, Object> params = studentInfo.getParams();
+        String role = "";
+        if (params != null && params.size() > 0) {
+            role = (String) params.get("role");
+        }
+        if("parents".equals(role)){
+            studentInfo.setParentsId(user.getUserId());
+        }
         return studentInfoMapper.selectStudentInfoList(studentInfo);
     }
 
@@ -75,7 +89,7 @@ public class StudentInfoServiceImpl implements IStudentInfoService
         student.setStudentId(studentInfo.getStudentId());
         List<StudentInfo> studentInfos = studentInfoMapper.selectStudentInfoList(student);
         if(studentInfos!=null && studentInfos.size()>0){
-            return AjaxResult.error("参数错误");
+            return AjaxResult.error("该学生已存在,请勿重复添加");
         }
         studentInfo.setCreateTime(DateUtils.getNowDate());
         //新增 心理健康
@@ -91,6 +105,8 @@ public class StudentInfoServiceImpl implements IStudentInfoService
         studentLiveOld.setCreateTime(DateUtils.getNowDate());
         studentLiveOld.setUpdateTime(DateUtils.getNowDate());
         studentLiveOldMapper.insertStudentLiveOld(studentLiveOld);
+
+        studentInfoMapper.deleteStudentInfoById(studentInfo.getId());
         int rows = studentInfoMapper.insertStudentInfo(studentInfo);
         return rows > 0 ? AjaxResult.success() : AjaxResult.error();
 
@@ -141,4 +157,48 @@ public class StudentInfoServiceImpl implements IStudentInfoService
     {
         return studentInfoMapper.deleteStudentInfoById(id);
     }
+
+    @Override
+    public AjaxResult statistics(StudentInfo studentInfo) {
+
+        if(StringUtils.isEmpty(studentInfo.getClassId())){
+            return AjaxResult.error("请选择班级");
+        }
+        int zs = 0;
+        int nan = 0;
+        int nv = 0;
+        int js = 0;
+        int ls = 0;
+        int pk = 0;
+        Map<String,Object> map = new HashMap<>();
+        List<StudentInfo> studentInfoList = studentInfoMapper.selectStudentInfoList(studentInfo);
+        if(studentInfoList!=null && studentInfoList.size()>0){
+            for (StudentInfo info : studentInfoList) {
+                zs++;
+                if(StringUtils.isNotEmpty(info.getSex()) && info.getSex().equals("1")){
+                    nan++;
+                }else{
+                    nv++;
+                }
+
+                if(StringUtils.isNotEmpty(info.getIsNearsightedness()) && info.getIsNearsightedness().equals("1")){
+                    js++;
+                }
+                if(StringUtils.isNotEmpty(info.getIsLset()) && info.getIsLset().equals("1")){
+                    ls++;
+                }
+                if(StringUtils.isNotEmpty(info.getIsPoverty()) && info.getIsPoverty().equals("1")){
+                    pk++;
+                }
+            }
+        }
+        map.put("zs",zs);
+        map.put("nan",nan);
+        map.put("nv",nv);
+        map.put("js",js);
+        map.put("ls",ls);
+        map.put("pk",pk);
+
+        return AjaxResult.success("成功",map);
+    }
 }

+ 4 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TeacherInfoServiceImpl.java

@@ -3,7 +3,9 @@ package com.ruoyi.system.service.impl;
 import java.util.List;
 
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.system.domain.StudentInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -44,6 +46,7 @@ public class TeacherInfoServiceImpl implements ITeacherInfoService
     @Override
     public List<TeacherInfo> selectTeacherInfoList(TeacherInfo teacherInfo)
     {
+        SysUser user = SecurityUtils.getLoginUser().getUser();
         return teacherInfoMapper.selectTeacherInfoList(teacherInfo);
     }
 
@@ -61,7 +64,7 @@ public class TeacherInfoServiceImpl implements ITeacherInfoService
         teacher.setTeacherId(teacherInfo.getTeacherId());
         List<TeacherInfo> teacherInfos = teacherInfoMapper.selectTeacherInfoList(teacher);
         if(teacherInfos!=null && teacherInfos.size()>0){
-            return AjaxResult.error("参数错误");
+            return AjaxResult.error("老师信息已录入,请勿重复录入");
         }
         int rows = teacherInfoMapper.insertTeacherInfo(teacherInfo);
         return rows > 0 ? AjaxResult.success() : AjaxResult.error();

+ 7 - 0
ruoyi-system/src/main/resources/mapper/system/StudentInfoMapper.xml

@@ -47,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 
         <result property="classId"    column="classId"    />
+        <result property="parentsId"    column="parentsId"    />
 
     </resultMap>
 
@@ -82,7 +83,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="motherName != null  and motherName != ''"> and s.mother_name like concat('%', #{motherName}, '%')</if>
             <if test="motherTelephone != null  and motherTelephone != ''"> and s.mother_telephone = #{motherTelephone}</if>
             <if test="address != null  and address != ''"> and s.address = #{address}</if>
+
+            <if test="isNearsightedness != null  and isNearsightedness != ''"> and s.is_nearsightedness = #{isNearsightedness}</if>
+            <if test="isMedicalHistory != null  and isMedicalHistory != ''"> and s.is_medical_history = #{isMedicalHistory}</if>
+
             <if test="classId != null "> and f.class_id = #{classId}</if>
+            <if test="parentsId != null "> and f.parents_id = #{parentsId}</if>
+
         </where>
         order by create_time desc
     </select>