Browse Source

计算报告

zsf 10 months ago
parent
commit
385e29414e

+ 2 - 0
src/main/java/com/rf/psychological/dao/model/AnswerEntity.java

@@ -1,5 +1,6 @@
 package com.rf.psychological.dao.model;
 
+import com.alibaba.fastjson.annotation.JSONField;
 import com.rf.psychological.base.model.BaseEntity;
 import com.rf.psychological.security.EncryptDecodeConverter;
 import lombok.*;
@@ -29,6 +30,7 @@ public class AnswerEntity extends BaseEntity {
     @Column(name = "question_no", columnDefinition = "varchar(10) comment '所属题号'")
     private String questionNo;
 
+    @JSONField(name = "checkItems")
     @Convert(converter = EncryptDecodeConverter.class)
     @Column(name = "name", columnDefinition = "varchar(500) comment '答案内容'")
     private String name;

+ 0 - 10
src/main/java/com/rf/psychological/plan/rest/TestPlanController.java

@@ -306,16 +306,6 @@ public class TestPlanController extends BaseController {
                 testPlanUserContendDto.setStatus(cognitiveTaskEntity.getStatus());
                 testPlanUserContendDto.setMobileStatus(cognitiveTaskEntity.getMobileStatus());
                 testPlanUserContendDto.setReportVersion(Integer.parseInt(cognitiveTaskEntity.getReportVersion()));
-                if (testPlanContendEntity.getFlag().equals("RHYTHM")){
-                    UserRecordEntity userRecordEntity = this.userRecordService.getRHYTHM(phone, institutionNo, testPlanId);
-                    if (userRecordEntity != null && userRecordEntity.getImg().equals("27")) {
-
-                    }else {
-                        testPlanUserContendDto.setIsComplete(Constant.USER_PLAN_STATUS_UNCOMPLETED);
-                        testPlanUserContendDtos.add(testPlanUserContendDto);
-                        continue;
-                    }
-                }
             }
 
             testPlanUserContendDto.setIsComplete(Constant.USER_PLAN_STATUS_COMPLETED);

+ 80 - 3
src/main/java/com/rf/psychological/rest/DeviceController.java

@@ -57,15 +57,72 @@ public class DeviceController extends BaseController {
         return "hello";
     }
 
-    //@Autowired
+    @GetMapping("/updateItem")
+    public  void updateItem(String fileName,String flag){
+        File file = new File("C:\\Users\\Administrator\\Desktop\\"+fileName+".xlsx");
+        try {
+            List<List<List<Object>>> datas = ExcelUtil.getBankListByExcelSheet(new FileInputStream(file.getAbsolutePath()), file.getName());
+            List<ScaleEntity> scaleEntities = scaleService.getScaleByFlag(flag);
+            List<List<Object>> an = datas.get(1);
+            for (ScaleEntity scaleEntity : scaleEntities) {
+                log.info("------" + scaleEntity.getCheckItems());
+                String no = scaleEntity.getQuestionNo();
+                String item = null;
+                for (List<Object> objects : an) {
+                    if (objects.get(0).equals(no)) {
+                        if (StringUtils.isEmpty(item)) {
+                            item = objects.get(1).toString();
+                        } else {
+                            item = item + ";" + objects.get(1).toString();
+                        }
+                    }
+                }
+                scaleEntity.setCheckItems(item);
+                //scaleService.saveScale(scaleEntity);
+                log.info("------" + scaleEntity.getCheckItems());
+            }
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+
+
+
+    @GetMapping("/updateAnswer")
+    public  void updateAnswer(String fileName,String flag){
+        File file = new File("C:\\Users\\Administrator\\Desktop\\"+fileName+".xlsx");
+        try {
+            List<List<List<Object>>> datas = ExcelUtil.getBankListByExcelSheet(new FileInputStream(file.getAbsolutePath()), file.getName());
+            List<AnswerEntity> answerEntities = answerService.getAnswerByFlag(flag);
+            List<List<Object>> answerObj = datas.get(1);
+            for (int i =0;i<answerEntities.size();i++){
+                AnswerEntity answerEntity = answerEntities.get(i);
+                answerEntity.setName(DESede.encryptString(answerObj.get(i).get(1).toString()));
+                answerEntity.setScore(DESede.encryptString(answerObj.get(i).get(2).toString()));
+                log.info(answerEntity.getName());
+                //answerService.updateAnswer(answerEntity);
+            }
+
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+
     @GetMapping("/update")
     public String update() throws Exception {
 
         File file = new File("C:\\Users\\Administrator\\Desktop\\标准情商测试.xlsx");
         try {
             List<List<List<Object>>> datas = ExcelUtil.getBankListByExcelSheet(new FileInputStream(file.getAbsolutePath()), file.getName());
-            List<ScaleMarksEntity> scaleEntities = scaleMarksService.getScaleMarksByFlag("20240516150818");
-            List<List<Object>> an = datas.get(0);
+            List<ScaleMarksEntity> scaleEntities = scaleMarksService.getScaleMarksByFlag("20210820143117");
+            List<List<Object>> an = datas.get(2);
+            for (int i = 0;i<scaleEntities.size();i++){
+                ScaleMarksEntity entity = scaleEntities.get(i);
+                entity.setImprovementSuggestions(an.get(i).get(4).toString());
+               // scaleMarksService.saveScaleMarks(entity);
+            }
+
+            log.info("111");
 //            marksObj.forEach(item ->{
 //                ScaleMarksEntity entity = new ScaleMarksEntity();
 //                entity.setName("总分");
@@ -102,4 +159,24 @@ public class DeviceController extends BaseController {
         return "hello";
     }
 
+    @GetMapping("updateMarks")
+    public void updateMarks(String fileName,String flag){
+        File file = new File("C:\\Users\\Administrator\\Desktop\\"+fileName+".xlsx");
+        try {
+            List<List<List<Object>>> datas = ExcelUtil.getBankListByExcelSheet(new FileInputStream(file.getAbsolutePath()), file.getName());
+            List<ScaleMarksEntity> scaleMarksEntities = scaleMarksService.getScaleMarksByFlag(flag);
+            List<List<Object>> markObj = datas.get(2);
+            for (int i =0;i<1;i++){
+                ScaleMarksEntity entity = scaleMarksEntities.get(i);
+                //entity.setSymptom(markObj.get(i).get(0).toString());
+                entity.setImprovementSuggestions(markObj.get(i).get(3).toString());
+                log.info(entity.toString());
+                //scaleMarksService.saveScaleMarks(entity);
+            }
+
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+
 }

+ 1 - 244
src/main/java/com/rf/psychological/rest/ServerController.java

@@ -360,53 +360,6 @@ public class ServerController extends BaseController {
         return success(jsonObject);
     }
 
-    /**
-     * 征冰心理健康测评消息推送
-     *
-     * @return
-     */
-    @GetMapping("push/message/{phone}")
-    @ApiOperation(value = "心理健康测评消息推送")
-    public Result pushMessage(@PathVariable String phone) throws InterruptedException {
-        String url = "ws://127.0.0.1:54378/ws";
-        MyClient myClient = new MyClient(url);
-        myClient.connectBlocking();
-        JSONObject dataJson = new JSONObject();
-        dataJson.put("flag","begin");
-        dataJson.put("date", LocalDateTime.now().toString());
-        myClient.send(dataJson.toString());
-        Thread.sleep(500);
-        myClient.close();
-        this.TASK_STATUS.put(phone,"1");
-        return success();
-    }
-
-    /**
-     * 征冰心理健康测评状态查询
-     *
-     * @return
-     */
-    @GetMapping("push/status/{phoneNumber}")
-    @ApiOperation(value = "征冰心理健康测评状态查询")
-    public Result pushStatus(@PathVariable String phoneNumber) {
-        return success(this.TASK_STATUS.get(phoneNumber) == null?"0":this.TASK_STATUS.get(phoneNumber));
-    }
-
-    /**
-     * 用户查询靶向神经振荡评估与训练记录
-     *
-     * @return
-     */
-    @SafetyProcess
-    @GetMapping("RHYTHM/{phone}/{institutionNo}/{testPlanId}")
-    @ApiOperation(value = "用户查询靶向神经振荡评估与训练记录")
-    public Result RHYTHM(@PathVariable String phone, @PathVariable String institutionNo, @PathVariable String testPlanId) {
-        UserRecordEntity userRecordEntity = this.userRecordService.getRHYTHM(phone, institutionNo, testPlanId);
-        if (userRecordEntity != null && userRecordEntity.getImg() != null) {
-            return success(userRecordEntity.getImg());
-        }
-        return success("");
-    }
 
     /**
      * 删除机构自定义量表
@@ -437,31 +390,7 @@ public class ServerController extends BaseController {
         return success();
     }
 
-    @PostMapping("subjectInfo/update")
-    public Result updateSubjectInfo(@RequestBody JSONObject jsonObject) {
-        JSONArray categoryList = jsonObject.getJSONArray("type");
-        String flag = jsonObject.getString("flag");
-        String scaleLimit = jsonObject.getString("scaleLimit");
-        /*String  men = jsonObject.getString("people");
-        men = men.replace("[","").replace("]","");
-        if(men.contains("0")){
-            men = "0";
-        }*/
-        this.categorySubjectService.deleteCategorySubjectByFlag(flag);
-        for (Object obj : categoryList) {
-            CategorySubjectEntity categorySubjectEntity = new CategorySubjectEntity();
-            categorySubjectEntity.setFlag(flag);
-            categorySubjectEntity.setEname((String) obj);
-            this.categorySubjectService.save(categorySubjectEntity);
-        }
-        SubjectEntity subjectEntity = this.subjectService.getSubjectEntityByFlag(flag);
-        if (subjectEntity != null) {
-            subjectEntity.setScaleLimit(scaleLimit);
-            //subjectEntity.setMen(men.replace(" ",""));
-            this.subjectService.save(subjectEntity);
-        }
-        return success();
-    }
+
 
     /**
      * 量表上传需要接口
@@ -1131,23 +1060,6 @@ public class ServerController extends BaseController {
         return success(jsonObject);
     }
 
-
-
-    /**
-     * 用户查询枪林弹雨
-     *
-     * @return
-     */
-    @SafetyProcess
-    @GetMapping("GUNSBULLETS/{userId}")
-    @ApiOperation(value = "用户查询枪林弹雨记录")
-    public Result GUNSBULLETS(@PathVariable String userId) {
-        UserEntity one = this.userService.getOne(userId);
-        List<UserRecordEntity> gunsbullets = this.userRecordService.getGUNSBULLETS(one.getPhone(), one.getInstitutionNo());
-        return success(gunsbullets);
-    }
-
-
     /**
      * 根据id查询测试详细信息
      *
@@ -1496,161 +1408,6 @@ public class ServerController extends BaseController {
         return success();
     }
 
-
-    /* V1版本,暂时保留
-    @ApiOperation(value = "用户导入")
-    @Transactional(rollbackFor = Exception.class)
-    @PostMapping("userImport")
-    public Result userImport(String institutionNo, MultipartFile file, HttpServletResponse response) throws Exception {
-        if (file == null) {
-            return fail("文件为空");
-        }
-        if (institutionNo == null) {
-            return fail("机构编号为空");
-        }
-        //String message = "提交成功";
-        String filePath = "";//用户信息上传之后生成的用户名密码文件保存路径
-        String fileName = file.getOriginalFilename();
-        List<List<Object>> datas = ExcelUtil.getBankListByExcelForUserImport(file.getInputStream(), fileName);
-        if(datas.size() <= 0){
-            return fail("内容为空");
-        }
-        //插入数据库信息
-        List<UserEntity> userListDB = new ArrayList<>();
-        //生成导入后用户信息
-        List<UserEntity> userLists = new ArrayList<>();
-
-        StringBuilder result = new StringBuilder();
-        //result.append("账号:");
-        //判断是否有已经存在数据库的
-        boolean isExist = false;
-        //UserEntity tempUserDB;
-        String defaultGroupId = null;
-        try {
-            int y = 0;
-            for (int i = 0; i < datas.size(); i++) {
-                List<Object> users = datas.get(i);
-                if (users.get(0) == null || users.get(0) == "" || users.get(1) == null || users.get(1) == "" || users.get(2) == null || users.get(2) == ""
-                || users.get(3) == null || users.get(3) == "" || users.get(4) == null || users.get(4) == "" || users.get(5) == null || users.get(5) == "") {
-                    y = i + 1;
-                    result.append("第" + y +"条数据信息不完整").append("\r\n");
-                    isExist = true;
-                    continue;
-                }
-                //北京师范大学亚太实验学校, 陈亚浩2, 男, 2001-10-01, 学生, , 六年级一班, null, null
-                //插入数据库的信息
-                UserEntity tempUserDB = new UserEntity();
-                //导入成功用户信息
-                UserEntity userEntity = new UserEntity();
-                tempUserDB.setInstitutionName(users.get(0).toString());
-                tempUserDB.setPetName(users.get(1).toString());
-                userEntity.setInstitutionName(users.get(0).toString());
-                userEntity.setPetName(users.get(1).toString());
-                userEntity.setGender(users.get(2).toString());
-                if ("男".equals(users.get(2).toString())) {
-                    tempUserDB.setGender("0");
-                } else {
-                    tempUserDB.setGender("1");
-                }
-                tempUserDB.setBirthday(users.get(3).toString());
-                tempUserDB.setProfession(users.get(4).toString());
-                tempUserDB.setAdditionInfo(users.get(5).toString());
-                userEntity.setBirthday(users.get(3).toString());
-                userEntity.setProfession(users.get(4).toString());
-                userEntity.setAdditionInfo(users.get(5).toString());
-                int repeatNum = userRepeatNameNumService.testOrNotNamePinyin(institutionNo, getPinyin(users.get(1).toString()));
-                if (users.size() > 6) {
-                    if (null == users.get(6) || users.get(6).equals("")) {
-                        tempUserDB.setPhone(repeatNum == 0 ? getPinyin(users.get(1).toString()) : getPinyin(users.get(1).toString()) + repeatNum);
-                        userEntity.setPhone(repeatNum == 0 ? getPinyin(users.get(1).toString()) : getPinyin(users.get(1).toString()) + repeatNum);
-                    } else {
-                        tempUserDB.setPhone(users.get(6).toString());
-                        userEntity.setPhone(users.get(6).toString());
-                    }
-                } else {
-                    tempUserDB.setPhone(repeatNum == 0 ? getPinyin(users.get(1).toString()) : getPinyin(users.get(1).toString()) + repeatNum);
-                    userEntity.setPhone(repeatNum == 0 ? getPinyin(users.get(1).toString()) : getPinyin(users.get(1).toString()) + repeatNum);
-                }
-                if (users.size() > 7) {
-                    if (null == users.get(7) || users.get(7).equals("")) {
-                        tempUserDB.setPassword(DigestUtils.md5DigestAsHex(Constant.DEFAULT_PASSWORD.getBytes(StandardCharsets.UTF_8)));
-                        userEntity.setPassword(Constant.DEFAULT_PASSWORD);
-                    } else {
-                        tempUserDB.setPassword(DigestUtils.md5DigestAsHex(users.get(7).toString().getBytes(StandardCharsets.UTF_8)));
-                        userEntity.setPassword(users.get(7).toString());
-                    }
-                } else {
-                    tempUserDB.setPassword(DigestUtils.md5DigestAsHex(Constant.DEFAULT_PASSWORD.getBytes(StandardCharsets.UTF_8)));
-                    userEntity.setPassword(Constant.DEFAULT_PASSWORD);
-                }
-
-//                tempUserDB.setPhone(getPinyin(users.get(1).toString()));
-                tempUserDB.setInstitutionNo(institutionNo);
-                tempUserDB.setUserStatus("2");
-                userEntity.setInstitutionNo(institutionNo);
-                userEntity.setUserStatus("2");
-                //设置组id,未分组时组id为0
-                if (defaultGroupId == null) {
-                    GroupEntity groupByInstitutionNoAndName = this.groupInfoService.findGroupByInstitutionNoAndName(tempUserDB.getInstitutionNo(), Constant.DEFAULT_GROUP_NAME);
-                    if (groupByInstitutionNoAndName == null) {
-                        GroupEntity groupEntity = new GroupEntity();
-                        groupEntity.setGroupName(Constant.DEFAULT_GROUP_NAME);
-                        groupEntity.setInstitutionNo(tempUserDB.getInstitutionNo());
-                        groupEntity = this.groupInfoService.addGroup(groupEntity);
-                        //创建权限
-                        List<InstitutionAuthEntity> institutionAuthEntityList = this.institutionAuthService.getByInstitutionNo(tempUserDB.getInstitutionNo());
-                        for (int mi = 0; mi < institutionAuthEntityList.size(); mi++) {
-                            InstitutionAuthEntity institutionAuthEntity = new InstitutionAuthEntity();
-                            GroupAuthEntity groupAuthEntity = new GroupAuthEntity();
-                            groupAuthEntity.setBId(institutionAuthEntity.getBId());
-                            groupAuthEntity.setGroupId(groupEntity.getId());
-                            groupAuthEntity.setType(institutionAuthEntity.getType());
-                            this.groupAuthService.addGroupAuth(groupAuthEntity);
-                        }
-                        defaultGroupId = groupEntity.getId();
-                    } else {
-                        defaultGroupId = groupByInstitutionNoAndName.getId();
-                    }
-                }
-                tempUserDB.setGId(defaultGroupId);
-                tempUserDB.setModelPhone("0");
-                tempUserDB.setRoleType(UserRole.COMMON.getType());
-                userEntity.setGId(defaultGroupId);
-                userEntity.setModelPhone("0");
-                userEntity.setRoleType(UserRole.COMMON.getType());
-
-                //查看当前用户是否已经在数据库存在
-                UserEntity phoneAndInstitutionNo = userService.findPhoneAndInstitutionNo(tempUserDB.getPhone(), institutionNo);
-                if (phoneAndInstitutionNo != null) {
-                    y = i + 1;
-                    result.append("第" + y +"条数据账号" + phoneAndInstitutionNo.getPhone() + "已存在").append("\r\n");
-                    isExist = true;
-                    continue;
-                }
-                this.userService.save(tempUserDB);
-                userListDB.add(tempUserDB);
-                userLists.add(userEntity);
-
-            }
-            if (OSUtil.isLinux()) {
-                filePath = "./userImport/" + institutionNo + "/" + new SimpleDateFormat("yyyy-MM-dd").format(new Date()) + "/";
-            } else {
-                filePath = "./userImport/" + institutionNo + "/" + new SimpleDateFormat("yyyy-MM-dd").format(new Date()) + "/";
-            }
-            ExcelUtil.createExcelFileForPublic(UserEntity.class, userLists, null, new ExcelClass().userExportExcel(), fileName, filePath);
-            if (isExist) {
-                result.append(",跳过该信息。(请检查该信息)");
-                return success(filePath + fileName, result.toString());
-            } else {
-                return success(filePath + fileName, "批量导入成功");
-            }
-        } catch (Exception exception) {
-
-            exception.printStackTrace();
-            return fail("导入失败,请联系管理员");
-        }
-    }*/
-
     @ApiOperation(value = "用户导入")
     @Transactional(rollbackFor = Exception.class)
     @PostMapping("userImport")

+ 0 - 15
src/main/java/com/rf/psychological/scale/dao/repository/UserRecordRepository.java

@@ -115,22 +115,7 @@ public interface UserRecordRepository extends BaseRepository<UserRecordEntity, S
 
     UserRecordEntity findUserRecordEntitiesById(String id);
 
-    /**
-     * 用户查询靶向神经振荡评估与训练记录
-     *
-     * @return
-     */
-    @Query(value = "select id,flag,phone,test_date,file_name,test_result,type,name,img,test_record,test_results,institution_no,test_plan_id " +
-            "from t_user_record where binary phone = :phone and flag = 'RHYTHM' and test_plan_id=:testPlanId and institution_no=:institutionNo ORDER BY test_date DESC LIMIT 1", nativeQuery = true)
-    UserRecordEntity getRHYTHM(@Param("phone") String phone, @Param("institutionNo") String institutionNo, @Param("testPlanId") String testPlanId);
 
-    /**
-     * 用户查询枪林弹雨
-     *
-     * @return
-     */
-    @Query(value = "select id,flag,phone,test_date,file_name,test_result,type,name,img,test_record,test_results,institution_no,test_plan_id from t_user_record where binary phone = :phone and flag = 'GUNSBULLETS' and institution_no=:institutionNo ORDER BY test_date DESC LIMIT 1", nativeQuery = true)
-    List<UserRecordEntity> getGUNSBULLETS(@Param("phone") String phone, @Param("institutionNo") String institutionNo);
 
     /**
      * 查询机构下所有用户已经做的测试记录

+ 111 - 4
src/main/java/com/rf/psychological/scale/rest/WebScaleResultController.java

@@ -1,5 +1,8 @@
 package com.rf.psychological.scale.rest;
 
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.date.DatePattern;
+import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -23,13 +26,11 @@ import com.rf.psychological.security.AesEncryptUtils;
 import com.rf.psychological.security.SafetyProcess;
 import com.rf.psychological.user.dao.model.UserEntity;
 import com.rf.psychological.user.service.UserService;
-import com.rf.psychological.utils.Constant;
-import com.rf.psychological.utils.ExcelUtil;
-import com.rf.psychological.utils.Result;
-import com.rf.psychological.utils.ScaleScoringVersion;
+import com.rf.psychological.utils.*;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -100,6 +101,112 @@ public class WebScaleResultController extends BaseController {
 
 
 
+    @SafetyProcess
+    @OperationLogAnnotation("报告分析")
+    @PostMapping("/reportAnalysis/{flag}")
+    @ApiOperation(value = "flag:量表标志,jsonObject:测试结果")
+    public  Result reportAnalysis(@PathVariable String flag,@RequestBody String recordJson){
+        try {
+            //校验flag的合法性
+            SubjectEntity subjectEntity = subjectService.getSubjectEntityByFlag(flag);
+            if (subjectEntity == null){
+                return fail(null,"请确认Flag值的合法性");
+            }
+            //解析RecordJson内容
+            String data = AesEncryptUtils.decrypt(JSONObject.parseObject(recordJson).getString("data"));
+            JSONObject recordObject = JSONObject.parseObject(data);
+            Object userIdObj = recordObject.get("userId");
+            JSONArray recordArray = recordObject.getJSONArray("scale_result");
+            if (userIdObj==null){
+                return fail(null,"用户ID不能为空");
+            }
+            UserEntity userEntity = userService.findUserById(userIdObj.toString());
+            if (userEntity == null){
+                return fail(null,"用户不存在请确认!");
+            }
+            //计算总分
+            int score = calculateScore(flag,recordArray);
+            //根据总分获取到到结论
+            ScaleMarksEntity marks = obtainingConclusions(flag,score);
+            //TODO 获取到到维度得分
+            //保存测试记录
+            String resultId = saveUserRecord(userEntity,subjectEntity,marks,score,recordArray);
+            return success(resultId);
+        }catch (Exception e){
+            e.printStackTrace();
+            log.error(e.getMessage());
+            return fail(null,"操作失败");
+        }
+    }
+
+    /**
+     * 保存记录
+     * @param userEntity
+     * @param subjectEntity
+     * @param marks
+     * @param score
+     * @return
+     */
+    private String saveUserRecord(UserEntity userEntity, SubjectEntity subjectEntity, ScaleMarksEntity marks, int score,JSONArray recordArray) {
+        UserRecordEntity record = new UserRecordEntity();
+        record.setFlag(subjectEntity.getFlag());
+        record.setName(subjectEntity.getName());
+        record.setPhone(userEntity.getPhone());
+        record.setInstitutionNo(userEntity.getInstitutionNo());
+        record.setTestRecord(recordArray.toJSONString());
+        record.setTestDate(DateUtil.format(new Date(), DatePattern.CHINESE_DATE_TIME_PATTERN));
+        Map map = BeanUtil.beanToMap(marks);
+        map.put("score",score);
+        record.setTestResults(map.toString());
+        userRecordService.save(record);
+        return record.getId();
+    }
+
+    /**
+     * 获取到总分结论
+     * @param flag 量表标识
+     * @param score 得分
+     * @return
+     */
+    private ScaleMarksEntity obtainingConclusions(String flag, int score) {
+        List<ScaleMarksEntity> marksEntityList = scaleMarksService.getScaleMarksByFlag(flag);
+        if (CollectionUtils.isEmpty(marksEntityList)){
+            return null;
+        }
+        for (ScaleMarksEntity entity: marksEntityList){
+            if (Double.parseDouble(entity.getScoreStart()) <= score && Double.parseDouble(entity.getScoreEnd())<= score){
+                entity.setImprovementSuggestions(RandomSuggestionUtil.getSuggestion(entity.getImprovementSuggestions()));
+                return entity;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * 获取该测试记录中得分
+     * @param flag
+     * @param recordArray
+     * @return
+     */
+    private int calculateScore(String flag, JSONArray recordArray) {
+        int score = 0;
+        //获取到答案列表
+        List<AnswerEntity> answerList = answerService.getAnswerByFlag(flag);
+        if (CollectionUtils.isNotEmpty(recordArray)){
+            List<AnswerEntity> checkItemList = recordArray.toJavaList(AnswerEntity.class);
+            for (AnswerEntity item : checkItemList){
+                for (AnswerEntity answer:answerList){
+                    if (item.getQuestionNo().equals(answer.getQuestionNo()) && item.getName().equals(answer.getName())){
+                        score+=Integer.parseInt(answer.getScore());
+                        break;
+                    }
+                }
+            }
+        }
+
+        return score;
+    }
+
     @SafetyProcess
     @Transactional(rollbackFor = Exception.class)
     @OperationLogAnnotation("保存量表记录")

+ 2 - 13
src/main/java/com/rf/psychological/scale/service/UserRecordService.java

@@ -111,20 +111,9 @@ public interface UserRecordService {
      */
     UserRecordEntity getUserRecordById(String id);
 
-    /**
-     * 用户查询靶向神经振荡评估与训练记录
-     *
-     * @return
-     */
-    UserRecordEntity getRHYTHM(String phone, String institutionNo, String testPlanId);
 
-    /**
-     * 查询枪林弹雨
-     *
-     * @param phone
-     * @return
-     */
-    List<UserRecordEntity> getGUNSBULLETS(String phone, String institutionNo);
+
+
 
     /**
      * 查询机构下所有用户已经做的测试记录

+ 0 - 15
src/main/java/com/rf/psychological/scale/service/impl/UserRecordServiceImpl.java

@@ -287,21 +287,6 @@ public class UserRecordServiceImpl implements UserRecordService {
         return this.userRecordRepository.findUserRecordEntitiesById(id);
     }
 
-    /**
-     * 用户查询靶向神经振荡评估与训练记录
-     *
-     * @return
-     */
-    @Override
-    public UserRecordEntity getRHYTHM(String phone, String institutionNo, String testPlanId) {
-        return this.userRecordRepository.getRHYTHM(phone, institutionNo, testPlanId);
-    }
-
-    @Override
-    public List<UserRecordEntity> getGUNSBULLETS(String phone, String institutionNo) {
-        return this.userRecordRepository.getGUNSBULLETS(phone, institutionNo);
-    }
-
     @Override
     public List<InstitutionRecordingDTO> getInstitutionUserRecording(int pageNum, int pageSize, String type, String institutionNo, String searchKey, String beginTime, String endTime) {
         int beginIndex = (pageNum - 1) * pageSize;

+ 1 - 1
src/main/java/com/rf/psychological/security/DESede.java

@@ -171,7 +171,7 @@ public class DESede {
 
     public static void main(String[] args) throws Exception {
         String name = "hahah";
-        System.out.println(decryptString("bYDrH2DB7aMik/PKWV4nxytjhZkedfEXsESEumRo3SO+nQegB5u4sQ=="));
+        System.out.println(decryptString("27p2z4gBk/xNjD8p6nZNFE21IyxSxTpejYR2HcDAGCCdTnOtJ3n7gXz2nRgIySlAQk4MPkvO52hkWPUVJI/vsV+rKGjz4cjh50GRsef0OiX+2kRxsgVK6e54uRScnu1smQ8C2zIguhBaRgUbhbu9spsqA1bRQD90gGMf2gFEAZZ0Xl6z40d7Rmi/nQ7dH6Kgs8v1xt7oOh0zmwZwX3/Xp9FwEzXiCW2YmPm8eIjgvqu/Z3GgNFhZM6cuH/yPtgAXupfqNDtwaYQQSDPn2xrfJOp8c203olc7wLkoFf+QbtBdA4Te8QO5QoaWkIz5Jn1XpB1+06F1rLMZ+vAGzlEpfB+T5jJQT/vDexYIQm0uJCthYeZBkF5uIvOUzQ/fV8dsA0j92dKctFRncHbZC2o8/LOCrVCQu7wKkI2yoS/LffU6ixXD3j3ZRoqaWTF3/yQQMgIHa5JAhQ3Xf4sAlIoQoGXw/n1n7EWictv5qJBR7djBbdbz2b542kYhGrpcb/pHuQcyf2bNwKrNkQeE7Ph3JfJso1kdQDa8VmKlxSYgywu+SeedK5+bEicQZ1MPnVWqqaYVXLjIjY4AQ01WJfRIeXGU9vLS7H6Fv15Cl5SC3FH2UHtkeIsGjLS/MOxXSQybGWPFmnTqXmHTkcSGmKNUJ6tUvLMoruA87kxiZo6AMV2oqv9wympvpy2M0FrQdxuLyDxEVknHR3BmQuyN/Wy80bQiJ16nuf/QVzbXoP4iOuuSIw0fALxhTlVhE0EfIeUY15CWGa6eq4dFCq63STll0qEvbu7zvhWnHG9Rx6JsTF2NyDctUGLUf3YgfDZm7hD8SYTPt0I2QU2AHe6OWuoUu2DlV/sB54aNBGOTiw73UGEgBoroyfX7TRM3qS0cscMOwOcdKjv72GDzwqWXLVsCAW8eIAjjNfs1pMzAq0zIwuYVSzZnCA1uzKbZ213vKtMQ2vNkQQfEVJRPUS+brpk7Jdh4Hb7JtO7dTwFXO+0bPz/BU3URd1+VV+b3NxIRNJCOdkP1+lGXoMxyXxjgzQ2OS+QGrqKOQLf1iRqstEikMQnSaw6jFU3L4pUDiiDVHg6C/nPpIJL9QoAosRCxwfbIEkxs5+gyu2gZPX35dIO8gQvLwTQG463fiHlWTKP8vXjGU5VH0X1WCafS+eBqIXGhcBksuJsDqwytUfDzQq91l9/T09xk4wsVYPfUUvH2pCkPRM+XkpomM+dZJHflUUkEZRU5sjoUbrOqgewVRtQf8KmunzxUhw1UifLOWpbe40yOM+UPqnClEVeLYqCwua8FelO5OEBlm6NqTH5uQhYRndr/XA17xIsgRblXBEJ47tfCGHB4GZM1PUm+BbgfIf2w/oKguGfCEYD4x3nxQ5xNBFBTCQyMLXs84DBThmw1EbDH5a0jimp+sDHwWV67Qgc+tUfIoqnmvbcmOZ61hTvGyyXxHI2nRs2TiKmGT01sxhmE3lhIUlz5uIHSnfsQ0UXk01HR832Y9gmzN4NWwJK8vrSdYmX19K0ojCxZiqFgD+hD4BZQrf1nZyJXiXN1J4g9uREKXy2Z2nogp2xrDKluuxSMPyWqIwwyLrJVaO5Aspdes2q2/7kob/CoweH7jHxO+5gCSJEHtqgotCamZfEyeJ4hwByhvQZG2c8ii6bRuy2wydJNCG4gvAZfMxtn1FfhOC1cz0iKyn4gDizKiD1UKR/pADKlZuSgSIopDWUZyfY3H59TGn/eLgCCtYvM+IINBSFKQ9XkUoVQ4106tZwRDPsThSWgmFoFqHfeBnTi7FOTyHW+rWixdzs="));
         System.out.println(encryptString("坚韧黑铁"));
         System.out.println(encryptString("英勇黄铜"));
         System.out.println(encryptString("英勇黄铜+"));

+ 4 - 4
src/main/resources/config/application-public.yml

@@ -3,10 +3,10 @@ server:
   port: 8445
   address: 0.0.0.0
 
-#  ssl:
-#    key-store: classpath:hnhong-duo.com.jks
-#    key-store-password: pk4x5v3pz83va2
-#    key-store-type: JKS
+  ssl:
+    key-store: classpath:hnhong-duo.com.jks
+    key-store-password: pk4x5v3pz83va2
+    key-store-type: JKS
 
 
 spring: