Explorar el Código

删除多余代码

zsf hace 5 meses
padre
commit
613194fb66

+ 0 - 72
src/main/java/com/rf/psychological/dao/model/MemoryCheckEntity.java

@@ -1,72 +0,0 @@
-package com.rf.psychological.dao.model;
-
-import com.rf.psychological.base.model.BaseEntity;
-import lombok.*;
-import org.hibernate.annotations.DynamicUpdate;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Table;
-
-/**
- * @author zzf
- * @description:记忆检查实体类
- * @date 2021/5/13 11:02
- */
-@Entity
-@Data
-@Getter
-@Setter
-@NoArgsConstructor
-@AllArgsConstructor
-@Table(name = "t_memory_check" )
-@org.hibernate.annotations.Table(appliesTo = "t_memory_check", comment = "记忆检查结果表")
-@DynamicUpdate
-public class MemoryCheckEntity extends BaseEntity {
-
-    @Column(name = "phone",columnDefinition = "varchar(20) not null comment '用户手机号'")
-    private String phone;
-
-    @Column(name = "institution_no", columnDefinition = "varchar(50) comment '所属机构编码'")
-    private String institutionNo;
-
-    @Column(name = "question_no",columnDefinition = "varchar(5) not null comment '所属题号'")
-    private String questionNo;
-
-    @Column(name = "gradea",columnDefinition = "int(4) comment '成绩a'")
-    private String gradea;
-
-    @Column(name = "gradeb",columnDefinition = "int(4) comment '成绩b'")
-    private String gradeb;
-
-    @Column(name = "gradec",columnDefinition = "int(4) comment '成绩c'")
-    private String gradec;
-
-    @Column(name = "mina",columnDefinition = "varchar(15) comment '时长a'")
-    private String mina;
-
-    @Column(name = "minb",columnDefinition = "varchar(15) comment '时长b'")
-    private String minb;
-
-    @Column(name = "memory_type" ,columnDefinition = "int(2) not null comment '记忆类型:0-无需记忆;1-即时记忆;2-延时记忆;3-长时记忆'")
-    private int memoryType;
-
-    @Column(name = "status",columnDefinition = "int(2) not null comment '状态:0-已结束;1-进行中'")
-    private int status;
-
-    @Column(name = "test_date",columnDefinition = "varchar(50) not null comment '测试日期'")
-    private String testDate;
-
-    @Column(name = "correlation_emory",columnDefinition = "varchar(36) comment '关联记忆id'")
-    private String correlationMemory;
-
-    @Column(name = "credentials",columnDefinition = "varchar(255) comment '既时记忆凭证'")
-    private String credentials;
-
-    @Column(name = "type" ,columnDefinition = "varchar(50) DEFAULT 'RTC' comment '任务类型:RTC-成人版;RTC_CHILD-儿童版'")
-    private String type;
-
-    @Column(name = "test_type" ,columnDefinition = "varchar(5) DEFAULT '0' comment '测试类型:0-流程测试;1-分项测试'")
-    private String testType;
-
-}

+ 0 - 60
src/main/java/com/rf/psychological/dao/repository/MemoryCheckRepository.java

@@ -1,60 +0,0 @@
-package com.rf.psychological.dao.repository;
-
-import com.rf.psychological.base.repository.BaseRepository;
-import com.rf.psychological.dao.model.MemoryCheckEntity;
-import org.springframework.data.jpa.repository.Modifying;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.List;
-
-/**
- * @author zsy
- * @description:
- * @date 2021/5/14 10:54
- */
-public interface MemoryCheckRepository extends BaseRepository<MemoryCheckEntity,String> {
-
-    /**
-     * 根据关联记忆id修改既时记忆状态
-     * @param correlationMemory
-     */
-    @Transactional
-    @Modifying(clearAutomatically = true)
-    @Query(value="update t_memory_check set status = '0' where id = :correlationMemory ",nativeQuery=true)
-    void updateStatus(@Param("correlationMemory")String correlationMemory);
-
-    /**
-     * 根据phone获取用户进行中记忆检查
-     * @param phone
-     */
-    @Query(value="select * from t_memory_check where status = '1' and if(:questionNo is not null and :questionNo!='',question_no = :questionNo ,1=1) " +
-            "and type = :type and test_type = :testType and binary phone = :phone and institution_no = :institutionNo",nativeQuery=true)
-    List<MemoryCheckEntity> getMemoryCheckList(@Param("phone") String phone,@Param("type") String type,@Param("testType") String testType
-            ,@Param("questionNo") String questionNo,@Param("institutionNo") String institutionNo);
-    /**
-     * 根据id获取用户记忆检查信息
-     * @param correlationMemory
-     */
-    @Query(value="select * from t_memory_check where id = :correlationMemory",nativeQuery=true)
-    MemoryCheckEntity selectById(@Param("correlationMemory")String correlationMemory);
-
-    /**
-     * 查询当前用户第六题信息
-     * @param
-     */
-    @Query(value="select * from t_memory_check where status = '1' and binary phone = :phone and institution_no = :institutionNo and correlation_emory = :correlationMemory",nativeQuery=true)
-    MemoryCheckEntity selectMemory(@Param("phone") String phone, @Param("correlationMemory")String correlationMemory, @Param("institutionNo")String institutionNo);
-
-    /**
-     * 清除进行中任务
-     * @param
-     */
-    @Transactional
-    @Modifying(clearAutomatically = true)
-    @Query(value="update t_memory_check set status = '0' where status = '1' and if(:questionNo is not null and :questionNo!='',question_no = :questionNo ,1=1) " +
-            "and type = :type and test_type = :testType and binary phone = :phone and institution_no = :institutionNo",nativeQuery=true)
-    void clearMemory(@Param("phone") String phone,@Param("type") String type,@Param("testType") String testType,@Param("questionNo") String questionNo,@Param("institutionNo") String institutionNo);
-
-}

+ 0 - 48
src/main/java/com/rf/psychological/institution/model/InstitutionUserEntity.java

@@ -1,48 +0,0 @@
-package com.rf.psychological.institution.model;
-
-import com.rf.psychological.base.model.BaseEntity;
-import lombok.*;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Table;
-
-@Entity
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@EqualsAndHashCode(callSuper=false)
-@Table(name = "t_institution_user")
-@org.hibernate.annotations.Table(appliesTo = "t_institution_user", comment = "机构管理员表")
-public class InstitutionUserEntity extends BaseEntity {
-
-    @Column(name = "phone",columnDefinition = "varchar(20) not null comment '手机号(唯一)'")
-    private String phone;
-
-    @Column(name = "institution_name", columnDefinition = "varchar(50) comment '所属机构名称'")
-    private String institutionName;
-
-    @Column(name = "institution_no", columnDefinition = "varchar(50) comment '所属机构编码'")
-    private String institutionNo;
-
-    @Column(name = "password", columnDefinition = "varchar(50) comment '登陆密码'")
-    private String password;
-
-    @Column(name = "gender", columnDefinition = "varchar(2)   not null comment '性别(0-男;1-女)'")
-    private String gender;
-
-    @Column(name = "pet_name", columnDefinition = "varchar(10) not null comment '昵称'")
-    private String petName;
-
-    @Column(name = "birthday", columnDefinition = "varchar(15) not null comment '出生日期'")
-    private String birthday;
-
-    @Column(name = "profession", columnDefinition = "varchar(50) comment '职业'")
-    private String profession;
-
-    @Column(name = "user_status", columnDefinition = "varchar(2) comment '用户状态,1-待审核 2-审核通过 3-密码被重置状态'")
-    private String userStatus = "1";
-
-    @Column(name = "addition_info", columnDefinition = "varchar(500) comment '附加信息'")
-    private String additionInfo;
-}

+ 0 - 113
src/main/java/com/rf/psychological/institution/repository/InstitutionUserRepository.java

@@ -1,113 +0,0 @@
-package com.rf.psychological.institution.repository;
-
-import com.rf.psychological.base.repository.BaseRepository;
-import com.rf.psychological.institution.model.InstitutionUserEntity;
-import org.springframework.data.jpa.repository.Modifying;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.List;
-
-public interface InstitutionUserRepository extends BaseRepository<InstitutionUserEntity, String> {
-
-    /**
-     * 根据机构编号
-     *
-     * @return
-     */
-    @Query(value = "select id, institution_name, institution_no, password, gender, pet_name, phone, birthday, profession, addition_info, user_status from t_institution_user where institution_no = :institutionNo ", nativeQuery = true)
-    InstitutionUserEntity findInstitutionByNo(@Param("institutionNo") String institutionNo);
-
-    /**
-     * 根据手机号登录
-     *
-     * @param phone
-     * @param password
-     * @return
-     */
-    InstitutionUserEntity findByPhoneAndPassword(String phone, String password);
-
-    /**
-     * 根据手机号修改密码
-     *
-     * @param phone
-     * @param password
-     */
-    @Transactional
-    @Modifying(clearAutomatically = true)
-    @Query(value = "update t_institution_user set password = :password where phone = :phone and institution_no=:institutionNo", nativeQuery = true)
-    void updatePassword(@Param("phone") String phone, @Param("password") String password, @Param("institutionNo") String institutionNo);
-
-    /**
-     * 根据手机号
-     *
-     * @param phone
-     * @return
-     */
-    InstitutionUserEntity findByPhone(String phone);
-
-    InstitutionUserEntity findByInstitutionNoAndPhone(String institutionNo, String phone);
-
-    /**
-     * 分页查询所有机构管理员信息
-     *
-     * @param pageNum
-     * @param pageSize
-     * @return
-     */
-    @Query(value = "select id, institution_name, institution_no, password, gender, pet_name, phone, birthday, profession, addition_info, user_status from t_institution_user limit :pageNum ,:pageSize ", nativeQuery = true)
-    List<InstitutionUserEntity> findAll(@Param("pageNum") int pageNum, @Param("pageSize") int pageSize);
-
-    /**
-     * 可以模糊查询所有机构管理员
-     *
-     * @param pageNum
-     * @param pageSize
-     * @param searchKey
-     * @return
-     */
-    @Query(value = "select id, institution_name, institution_no, password, gender, pet_name, phone, birthday, profession, addition_info, user_status from t_institution_user  where phone like %:searchKey% or institution_name like %:searchKey%   limit :pageNum ,:pageSize", nativeQuery = true)
-    List<InstitutionUserEntity> findAllByName(@Param("pageNum") int pageNum, @Param("pageSize") int pageSize, @Param("searchKey") String searchKey);
-
-    @Query(value = "select count(1) from t_institution_user  where phone like %:searchKey% or institution_name like %:searchKey%", nativeQuery = true)
-    int allNum(@Param("searchKey") String searchKey);
-
-    @Query(value = "select id, institution_name, institution_no, password, gender, pet_name, phone, birthday, profession, addition_info, user_status from t_institution_user  where institution_no =:institutionNo and" +
-            " if(:searchKey is not null and :searchKey!='',(pet_name like CONCAT('%',:searchKey,'%') or phone like CONCAT('%',:searchKey,'%') ) ,1=1)  limit :pageNum ,:pageSize", nativeQuery = true)
-    List<InstitutionUserEntity> findAllByInNo(@Param("pageNum") int pageNum, @Param("pageSize") int pageSize, @Param("institutionNo") String institutionNo, @Param("searchKey") String searchKey);
-
-    @Query(value = "select count(1) from t_institution_user  where institution_no =:institutionNo and" +
-            " if(:searchKey is not null and :searchKey!='',(pet_name like CONCAT('%',:searchKey,'%') or phone like CONCAT('%',:searchKey,'%') ) ,1=1)", nativeQuery = true)
-    int numAllByInNo(@Param("institutionNo") String institutionNo, @Param("searchKey") String searchKey);
-
-    /**
-     * 根据手机号删除机构用户
-     *
-     * @param phone
-     */
-    @Transactional
-    @Modifying(clearAutomatically = true)
-    void deleteByPhoneAndInstitutionNo(String phone, String institutionNo);
-
-
-    /**
-     * 审核机构用户
-     *
-     * @param phone
-     * @param userStatus
-     */
-    @Transactional
-    @Modifying(clearAutomatically = true)
-    @Query(value = "update t_institution_user set user_status = :userStatus where phone = :phone and institution_no=:institutionNo", nativeQuery = true)
-    void updateUserStatusByPhone(@Param("phone") String phone, @Param("userStatus") String userStatus, @Param("institutionNo") String institutionNo);
-
-    /**
-     * 根据机构编号删除
-     *
-     * @param institutionNo
-     */
-    @Transactional
-    @Modifying(clearAutomatically = true)
-    void deleteAllByInstitutionNo(String institutionNo);
-}

+ 0 - 73
src/main/java/com/rf/psychological/institution/service/InstitutionUserService.java

@@ -1,73 +0,0 @@
-package com.rf.psychological.institution.service;
-
-import com.rf.psychological.institution.model.InstitutionUserEntity;
-
-import java.util.List;
-
-public interface InstitutionUserService {
-
-    /**
-     * 根据手机号查询
-     *
-     * @return
-     */
-    InstitutionUserEntity findInstitutionByNo(String institutionNo);
-
-    /**
-     * 根据机构id
-     *
-     * @return
-     */
-    InstitutionUserEntity getOne(String institutionId);
-
-    InstitutionUserEntity findByPhoneAndPassword(String phone, String password);
-
-    InstitutionUserEntity findByPhone(String phone);
-
-    InstitutionUserEntity findByInstitutionNoAndPhone(String institutionNo, String phone);
-
-    /**
-     * 保存机构用户
-     *
-     * @param institutionUserEntity
-     */
-    void save(InstitutionUserEntity institutionUserEntity);
-
-
-    /**
-     * 根据手机号修改密码
-     *
-     * @return
-     */
-    void updatePassword(String phone, String password, String institutionNo);
-
-    /**
-     * 可以模糊查询所有机构用户
-     *
-     * @return
-     */
-    List<InstitutionUserEntity> findAllByName(int pageNum, int pageSize, String searchKey);
-
-    int allNum(String searchKey);
-
-    List<InstitutionUserEntity> findAllInAdminByInNo(int pageNum, int pageSize, String institutionNo, String searchKey);
-
-    int numAllInAdminByInNo(String institutionNo, String searchKey);
-
-    /**
-     * 根据手机号删除机构用户
-     *
-     * @param phone
-     */
-    void deleteByPhoneAndInstitutionNo(String phone, String institutionNo);
-
-
-    /**
-     * 审核机构用户
-     *
-     * @param phone
-     * @param userStatus
-     */
-    void updateUserStatusByPhone(String phone, String userStatus, String institutionNo);
-
-}

+ 7 - 15
src/main/java/com/rf/psychological/institution/service/impl/InstitutionServiceImpl.java

@@ -1,23 +1,20 @@
 package com.rf.psychological.institution.service.impl;
 
-import cn.hutool.core.date.DatePattern;
-import cn.hutool.core.date.DateUtil;
-import com.rf.psychological.group.dao.repository.GroupAuthRepository;
-import com.rf.psychological.group.dao.repository.GroupInfoRepository;
-import com.rf.psychological.institution.repository.InstitutionAuthRepository;
-import com.rf.psychological.institution.repository.InstitutionUserRepository;
-import com.rf.psychological.plan.dao.model.TestPlanEntity;
-import com.rf.psychological.plan.service.TestPlanService;
-import com.rf.psychological.scale.service.UserRecordService;
-import com.rf.psychological.user.dao.model.UserEntity;
 import com.rf.psychological.dao.vo.SaveInstitutionVO;
 import com.rf.psychological.enums.UserRole;
 import com.rf.psychological.enums.UserStatus;
 import com.rf.psychological.group.dao.model.GroupEntity;
+import com.rf.psychological.group.dao.repository.GroupAuthRepository;
+import com.rf.psychological.group.dao.repository.GroupInfoRepository;
 import com.rf.psychological.group.service.GroupInfoService;
 import com.rf.psychological.institution.model.InstitutionEntity;
+import com.rf.psychological.institution.repository.InstitutionAuthRepository;
 import com.rf.psychological.institution.repository.InstitutionRepository;
 import com.rf.psychological.institution.service.InstitutionService;
+import com.rf.psychological.plan.dao.model.TestPlanEntity;
+import com.rf.psychological.plan.service.TestPlanService;
+import com.rf.psychological.scale.service.UserRecordService;
+import com.rf.psychological.user.dao.model.UserEntity;
 import com.rf.psychological.user.dao.repository.UserRepository;
 import com.rf.psychological.user.service.UserService;
 import com.rf.psychological.utils.Constant;
@@ -47,9 +44,6 @@ public class InstitutionServiceImpl implements InstitutionService {
     @Autowired
     private InstitutionRepository institutionRepository;
 
-    @Autowired
-    private InstitutionUserRepository institutionUserRepository;
-
     @Autowired
     private InstitutionAuthRepository institutionAuthRepository;
 
@@ -109,8 +103,6 @@ public class InstitutionServiceImpl implements InstitutionService {
             }
             //删除机构
             this.institutionRepository.deleteById(institutionId);
-            //删除机构管理员
-            institutionUserRepository.deleteAllByInstitutionNo(institutionNo);
             //删除机构权限
             institutionAuthRepository.deleteAuthDataByInstitutionNo(institutionNo);
             //删除机构下的组

+ 0 - 88
src/main/java/com/rf/psychological/institution/service/impl/InstitutionUserServiceImpl.java

@@ -1,88 +0,0 @@
-package com.rf.psychological.institution.service.impl;
-
-import com.rf.psychological.institution.model.InstitutionUserEntity;
-import com.rf.psychological.institution.repository.InstitutionUserRepository;
-import com.rf.psychological.institution.service.InstitutionUserService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-@Service
-public class InstitutionUserServiceImpl implements InstitutionUserService {
-
-    @Autowired
-    private InstitutionUserRepository institutionUserRepository;
-
-    @Override
-    public InstitutionUserEntity findInstitutionByNo(String institutionNo) {
-        return this.institutionUserRepository.findInstitutionByNo(institutionNo);
-    }
-
-    @Override
-    public InstitutionUserEntity getOne(String institutionId) {
-        return this.institutionUserRepository.findById(institutionId).get();
-    }
-
-    @Override
-    public InstitutionUserEntity findByPhoneAndPassword(String phone, String password) {
-        return this.institutionUserRepository.findByPhoneAndPassword(phone, password);
-    }
-
-    @Override
-    public InstitutionUserEntity findByPhone(String phone) {
-        return this.institutionUserRepository.findByPhone(phone);
-    }
-
-    @Override
-    public InstitutionUserEntity findByInstitutionNoAndPhone(String institutionNo, String phone) {
-        return this.institutionUserRepository.findByInstitutionNoAndPhone(institutionNo, phone);
-    }
-
-    @Override
-    public void save(InstitutionUserEntity institutionUserEntity) {
-        this.institutionUserRepository.save(institutionUserEntity);
-    }
-
-
-    @Override
-    public void updatePassword(String phone, String password, String institutionNo) {
-        this.institutionUserRepository.updatePassword(phone, password, institutionNo);
-    }
-
-    @Override
-    public List<InstitutionUserEntity> findAllByName(int pageNum, int pageSize, String searchKey) {
-        int beginIndex = (pageNum - 1) * pageSize;
-        if (searchKey != null && !"".equals(searchKey)) {
-            return this.institutionUserRepository.findAllByName(beginIndex, pageSize, searchKey);
-        } else {
-            return this.institutionUserRepository.findAll(beginIndex, pageSize);
-        }
-    }
-
-    @Override
-    public int allNum(String searchKey) {
-        return this.institutionUserRepository.allNum(searchKey);
-    }
-
-    @Override
-    public List<InstitutionUserEntity> findAllInAdminByInNo(int pageNum, int pageSize, String institutionNo, String searchKey) {
-        return this.institutionUserRepository.findAllByInNo((pageNum - 1) * pageSize, pageSize, institutionNo, searchKey);
-    }
-
-    @Override
-    public int numAllInAdminByInNo(String institutionNo, String searchKey) {
-        return this.institutionUserRepository.numAllByInNo(institutionNo, searchKey);
-    }
-
-    @Override
-    public void deleteByPhoneAndInstitutionNo(String phone, String institutionNo) {
-        this.institutionUserRepository.deleteByPhoneAndInstitutionNo(phone, institutionNo);
-    }
-
-    @Override
-    public void updateUserStatusByPhone(String phone, String userStatus, String institutionNo) {
-        this.institutionUserRepository.updateUserStatusByPhone(phone, userStatus, institutionNo);
-    }
-
-}

+ 0 - 2
src/main/java/com/rf/psychological/opLog/aspect/UserLogAspect.java

@@ -9,8 +9,6 @@ import com.rf.psychological.utils.DateUtil;
 import com.rf.psychological.utils.IPUtiles;
 import com.rf.psychological.utils.JWTUtil;
 import com.rf.psychological.utils.Result;
-import com.rf.psychological.institution.model.InstitutionEntity;
-import com.rf.psychological.institution.model.InstitutionUserEntity;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.aspectj.lang.JoinPoint;

+ 0 - 1030
src/main/java/com/rf/psychological/scale/rest/MemoryCheckController.java

@@ -1,1030 +0,0 @@
-package com.rf.psychological.scale.rest;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.auth0.jwt.interfaces.DecodedJWT;
-import com.rf.psychological.base.rest.BaseController;
-import com.rf.psychological.file.excel.ExcelClass;
-import com.rf.psychological.dao.model.MemoryCheckEntity;
-import com.rf.psychological.dao.model.ObjectEntity;
-import com.rf.psychological.user.dao.model.UserEntity;
-import com.rf.psychological.scale.dao.model.UserRecordEntity;
-import com.rf.psychological.opLog.annotation.OperationLogAnnotation;
-import com.rf.psychological.security.AesEncryptUtils;
-import com.rf.psychological.security.SafetyProcess;
-import com.rf.psychological.scale.service.CognitiveTaskService;
-import com.rf.psychological.scale.service.MemoryCheckService;
-import com.rf.psychological.scale.service.UserRecordService;
-import com.rf.psychological.user.service.UserService;
-import com.rf.psychological.utils.*;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.*;
-
-
-/**
- * @author zsy
- * @description:记忆检查信息管理
- * @date 2021/6/17 15:55
- */
-
-@Slf4j
-@RestController
-@RequestMapping("/memory")
-@Api(tags = "记忆检查信息管理")
-public class MemoryCheckController extends BaseController {
-
-    @Autowired
-    private MemoryCheckService memoryCheckService;
-
-    @Autowired
-    private UserService userService;
-
-    @Autowired
-    private UserRecordService userRecordService;
-
-    @Autowired
-    private CognitiveTaskService cognitiveTaskService;
-
-    /**
-     * 添加记忆检查信息
-     *
-     * @param
-     * @return
-     */
-    @SafetyProcess
-    @OperationLogAnnotation
-    @PostMapping("/saveMemoryCheck")
-    @ApiOperation("添加记忆检查信息")
-    public Result saveMemoryCheck(@RequestBody String json) throws Exception {
-        //public Result saveMemoryCheck(@RequestBody JSONObject jsonObject ) throws Exception {
-        String data = AesEncryptUtils.decrypt(JSONObject.parseObject(json).getString("data"));
-        JSONObject jsonObject = JSONObject.parseObject(data);
-        System.out.println("----------------result-------------------");
-        System.out.println(jsonObject);
-        String userId = jsonObject.getString("userId");
-        String type = Constant.QUEST_TYPE_RTC;
-        if (jsonObject.containsKey("type")) {
-            type = jsonObject.getString("type");
-        }
-        String testType = Constant.DEFAULT_VALUE_ZERO;
-        if (jsonObject.containsKey("testType")) {
-            testType = jsonObject.getString("testType");
-        }
-        String testPlanId = "0";
-        if (jsonObject.containsKey("testPlanId")) {
-            testPlanId = jsonObject.getString("testPlanId");
-        }
-        UserEntity userEntity = this.userService.getOne(userId);
-        String phone = userEntity.getPhone();
-        String institutionNo = userEntity.getInstitutionNo();
-
-        DateFormat df = new SimpleDateFormat("yyyyMMddHHmm");
-        //当前时间
-        String testTime = df.format(new Date());
-        JSONArray jsonArray = jsonObject.getJSONArray("memoryCheck");
-        //答题结果列表
-        List<MemoryCheckEntity> dataList = jsonArray.toJavaList(MemoryCheckEntity.class);
-        //创建测试记录所需信息
-        List<MemoryCheckEntity> MemoryCheckEntitys = new ArrayList<>();
-        int y = 0;
-        for (MemoryCheckEntity memoryCheckEntity : dataList) {
-            memoryCheckEntity.setPhone(phone);
-            memoryCheckEntity.setTestDate(testTime);
-            memoryCheckEntity.setType(type);
-            memoryCheckEntity.setTestType(testType);
-            memoryCheckEntity.setInstitutionNo(institutionNo);
-            if (memoryCheckEntity.getMemoryType() == 2) {
-                if (testType.equals("1")) {
-                    this.memoryCheckService.save(memoryCheckEntity);
-                    //根据phone获取用户进行中记忆检查
-                    MemoryCheckEntitys = this.memoryCheckService.getMemoryCheckList(phone, type, testType,memoryCheckEntity.getQuestionNo(),institutionNo);
-                } else {
-                    if (!memoryCheckEntity.getQuestionNo().equals("5")) {
-                        this.memoryCheckService.save(memoryCheckEntity);
-                        return success();
-                    } else {
-                        this.memoryCheckService.save(memoryCheckEntity);
-                        //根据phone获取用户进行中记忆检查
-                        MemoryCheckEntitys = this.memoryCheckService.getMemoryCheckList(phone, type, testType,null,institutionNo);
-                    }
-                }
-                for (MemoryCheckEntity memoryCheckEntity1 : MemoryCheckEntitys) {
-                    this.memoryCheckService.updateStatus(memoryCheckEntity1.getId());
-                }
-            } else {
-                if (testType.equals("1") && (memoryCheckEntity.getQuestionNo().equals("6") || memoryCheckEntity.getQuestionNo().equals("7"))) {
-                    memoryCheckEntity.setStatus(0);
-                    this.memoryCheckService.save(memoryCheckEntity);
-                    MemoryCheckEntitys.add(memoryCheckEntity);
-                } else {
-                    y++;
-                    if (memoryCheckEntity.getQuestionNo().equals("6") || memoryCheckEntity.getQuestionNo().equals("7") || memoryCheckEntity.getQuestionNo().equals("8")) {
-                        memoryCheckEntity.setCorrelationMemory(dataList.get(0).getMina() + testTime);
-                    }
-                    this.memoryCheckService.save(memoryCheckEntity);
-                    if (dataList.size() == y) {
-                        return success();
-                    }
-                }
-            }
-        }
-        String datas = new String();
-        //生成测试记录文件并在数据库插入用户测试记录
-        String userName = userEntity.getPetName();
-        String userBirthday = userEntity.getBirthday();
-        String userSex = userEntity.getGender();
-        if (userSex.equals("0")) {
-            userSex = "男";
-        } else {
-            userSex = "女";
-        }
-        testTime = new SimpleDateFormat("yyyy年MM月dd日HH时mm分ss秒").format(new Date());
-        String fileName = userName + Constant.SPLIT_CHAR + userBirthday + Constant.SPLIT_CHAR + userSex + Constant.SPLIT_CHAR + testTime;
-        String testResult = new String();
-        String name = new String();
-        List<Map<String, String>> resultMapList = new ArrayList<>();
-        // 创建返回的json对象
-        JSONObject resultJson = new JSONObject(true);
-        // 创建入库的json对象
-        JSONObject resultDBJson = new JSONObject(true);
-
-        List<ObjectEntity> objectEntityList = new ArrayList<>();
-        for (MemoryCheckEntity memoryCheck : MemoryCheckEntitys) {
-            if (memoryCheck.getQuestionNo().equals("1")) {
-                ObjectEntity objectEntity1 = new ObjectEntity();
-                ObjectEntity objectEntity2 = new ObjectEntity();
-                ObjectEntity objectEntity3 = new ObjectEntity();
-                if (memoryCheck.getMemoryType() == 1) {
-                    objectEntity1.setKey("指向记忆-即时记忆指向成绩");
-                    objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                    objectEntity2.setKey("指向记忆-即时记忆非指向成绩");
-                    objectEntity2.setValue(String.valueOf(memoryCheck.getGradeb()));
-                    objectEntity3.setKey("指向记忆-即时记忆总成绩");
-                    objectEntity3.setValue(String.valueOf(Integer.valueOf(memoryCheck.getGradea()) + Integer.valueOf(memoryCheck.getGradeb())));
-                    resultJson.put("指向记忆-即时记忆指向成绩", String.valueOf(memoryCheck.getGradea()));
-                    resultJson.put("指向记忆-即时记忆非指向成绩", String.valueOf(memoryCheck.getGradeb()));
-                    resultJson.put("指向记忆-即时记忆总成绩", String.valueOf(Integer.valueOf(memoryCheck.getGradea()) + Integer.valueOf(memoryCheck.getGradeb())));
-                } else {
-                    objectEntity1.setKey("指向记忆-延时记忆指向成绩");
-                    objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                    objectEntity2.setKey("指向记忆-延时记忆非指向成绩");
-                    objectEntity2.setValue(String.valueOf(memoryCheck.getGradeb()));
-                    objectEntity3.setKey("指向记忆-延时记忆总成绩");
-                    objectEntity3.setValue(String.valueOf(Integer.valueOf(memoryCheck.getGradea()) + Integer.valueOf(memoryCheck.getGradeb())));
-                    resultJson.put("指向记忆-延时记忆指向成绩", String.valueOf(memoryCheck.getGradea()));
-                    resultJson.put("指向记忆-延时记忆非指向成绩", String.valueOf(memoryCheck.getGradeb()));
-                    resultJson.put("指向记忆-延时记忆总成绩", String.valueOf(Integer.valueOf(memoryCheck.getGradea()) + Integer.valueOf(memoryCheck.getGradeb())));
-                }
-                objectEntityList.add(objectEntity1);
-                objectEntityList.add(objectEntity2);
-                objectEntityList.add(objectEntity3);
-            } else if (memoryCheck.getQuestionNo().equals("2")) {
-                ObjectEntity objectEntity1 = new ObjectEntity();
-                ObjectEntity objectEntity2 = new ObjectEntity();
-                ObjectEntity objectEntity3 = new ObjectEntity();
-                if (memoryCheck.getMemoryType() == 1) {
-                    objectEntity1.setKey("词汇联想-即时记忆简单成绩");
-                    objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                    objectEntity2.setKey("词汇联想-即时记忆复杂成绩");
-                    objectEntity2.setValue(String.valueOf(memoryCheck.getGradeb()));
-                    objectEntity3.setKey("词汇联想-即时记忆总成绩");
-                    objectEntity3.setValue(String.valueOf(memoryCheck.getGradec()));
-                    resultJson.put("词汇联想-即时记忆简单成绩", String.valueOf(memoryCheck.getGradea()));
-                    resultJson.put("词汇联想-即时记忆复杂成绩", String.valueOf(memoryCheck.getGradeb()));
-                    resultJson.put("词汇联想-即时记忆总成绩", String.valueOf(memoryCheck.getGradec()));
-                } else {
-                    objectEntity1.setKey("词汇联想-延时记忆简单成绩");
-                    objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                    objectEntity2.setKey("词汇联想-延时记忆复杂成绩");
-                    objectEntity2.setValue(String.valueOf(memoryCheck.getGradeb()));
-                    objectEntity3.setKey("词汇联想-延时记忆总成绩");
-                    objectEntity3.setValue(String.valueOf(memoryCheck.getGradec()));
-                    resultJson.put("词汇联想-延时记忆简单成绩", String.valueOf(memoryCheck.getGradea()));
-                    resultJson.put("词汇联想-延时记忆复杂成绩", String.valueOf(memoryCheck.getGradeb()));
-                    resultJson.put("词汇联想-延时记忆总成绩", String.valueOf(memoryCheck.getGradec()));
-                }
-                objectEntityList.add(objectEntity1);
-                objectEntityList.add(objectEntity2);
-                objectEntityList.add(objectEntity3);
-            } else if (memoryCheck.getQuestionNo().equals("3")) {
-                ObjectEntity objectEntity1 = new ObjectEntity();
-                if (memoryCheck.getMemoryType() == 1) {
-                    objectEntity1.setKey("图像自由回忆-即时记忆图像成绩");
-                    objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                    resultJson.put("图像自由回忆-即时记忆图像成绩", String.valueOf(memoryCheck.getGradea()));
-                } else {
-                    objectEntity1.setKey("图像自由回忆-延时记忆图像成绩");
-                    objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                    resultJson.put("图像自由回忆-延时记忆图像成绩", String.valueOf(memoryCheck.getGradea()));
-                }
-                objectEntityList.add(objectEntity1);
-            } else if (memoryCheck.getQuestionNo().equals("4")) {
-                ObjectEntity objectEntity1 = new ObjectEntity();
-                ObjectEntity objectEntity2 = new ObjectEntity();
-                ObjectEntity objectEntity3 = new ObjectEntity();
-                if (memoryCheck.getMemoryType() == 1) {
-                    objectEntity1.setKey("图片联想-即时记忆即时成绩");
-                    objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                    objectEntity2.setKey("图片联想-即时记忆即时再确认成绩");
-                    objectEntity2.setValue(String.valueOf(memoryCheck.getGradeb()));
-                    objectEntity3.setKey("图片联想-即时记忆总成绩");
-                    objectEntity3.setValue(String.valueOf(Integer.valueOf(memoryCheck.getGradea()) + Integer.valueOf(memoryCheck.getGradeb())));
-                    resultJson.put("图片联想-即时记忆即时成绩", String.valueOf(memoryCheck.getGradea()));
-                    resultJson.put("图片联想-即时记忆即时再确认成绩", String.valueOf(memoryCheck.getGradeb()));
-                    resultJson.put("图片联想-即时记忆总成绩", String.valueOf(Integer.valueOf(memoryCheck.getGradea()) + Integer.valueOf(memoryCheck.getGradeb())));
-                } else {
-                    objectEntity1.setKey("图片联想-延时记忆即时成绩");
-                    objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                    objectEntity2.setKey("图片联想-延时记忆即时再确认成绩");
-                    objectEntity2.setValue(String.valueOf(memoryCheck.getGradeb()));
-                    objectEntity3.setKey("图片联想-延时记忆总成绩");
-                    objectEntity3.setValue(String.valueOf(Integer.valueOf(memoryCheck.getGradea()) + Integer.valueOf(memoryCheck.getGradeb())));
-                    resultJson.put("图片联想-延时记忆即时成绩", String.valueOf(memoryCheck.getGradea()));
-                    resultJson.put("图片联想-延时记忆即时再确认成绩", String.valueOf(memoryCheck.getGradeb()));
-                    resultJson.put("图片联想-延时记忆总成绩", String.valueOf(Integer.valueOf(memoryCheck.getGradea()) + Integer.valueOf(memoryCheck.getGradeb())));
-                }
-                objectEntityList.add(objectEntity1);
-                objectEntityList.add(objectEntity2);
-                objectEntityList.add(objectEntity3);
-            } else if (memoryCheck.getQuestionNo().equals("5")) {
-                ObjectEntity objectEntity1 = new ObjectEntity();
-                if (memoryCheck.getMemoryType() == 1) {
-                    objectEntity1.setKey("人像特点回忆-即时记忆人像成绩");
-                    objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                    resultJson.put("人像特点回忆-即时记忆人像成绩", String.valueOf(memoryCheck.getGradea()));
-                } else {
-                    objectEntity1.setKey("人像特点回忆-延时记忆人像成绩");
-                    objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                    resultJson.put("人像特点回忆-延时记忆人像成绩", String.valueOf(memoryCheck.getGradea()));
-                }
-                objectEntityList.add(objectEntity1);
-            } else if (memoryCheck.getQuestionNo().equals("7")) {
-                ObjectEntity objectEntity1 = new ObjectEntity();
-                ObjectEntity objectEntity2 = new ObjectEntity();
-                ObjectEntity objectEntity3 = new ObjectEntity();
-                objectEntity1.setKey("前瞻记忆-四字成语[全部正确率,部分正确率]");
-                objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                objectEntity2.setKey("前瞻记忆-模糊数字[全部正确率,部分正确率]");
-                objectEntity2.setValue(String.valueOf(memoryCheck.getGradeb()));
-                objectEntity3.setKey("前瞻记忆-总分");
-                objectEntity3.setValue(String.valueOf(memoryCheck.getGradec()));
-                resultJson.put("前瞻记忆-四字成语[全部正确率,部分正确率]", String.valueOf(memoryCheck.getGradea()));
-                resultJson.put("前瞻记忆-模糊数字[全部正确率,部分正确率]", String.valueOf(memoryCheck.getGradeb()));
-                resultJson.put("前瞻记忆-总分", String.valueOf(memoryCheck.getGradec()));
-                objectEntityList.add(objectEntity1);
-                objectEntityList.add(objectEntity2);
-                objectEntityList.add(objectEntity3);
-            } else if (memoryCheck.getQuestionNo().equals("8")) {
-                ObjectEntity objectEntity1 = new ObjectEntity();
-                ObjectEntity objectEntity2 = new ObjectEntity();
-                ObjectEntity objectEntity3 = new ObjectEntity();
-                objectEntity1.setKey("AD临床记忆问卷-第一题");
-                objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                objectEntity2.setKey("AD临床记忆问卷-第二题");
-                objectEntity2.setValue(String.valueOf(memoryCheck.getGradeb()));
-                objectEntity3.setKey("AD临床记忆问卷-第三题");
-                objectEntity3.setValue(String.valueOf(memoryCheck.getGradec()));
-                resultJson.put("AD临床记忆问卷-第一题", String.valueOf(memoryCheck.getGradea()));
-                resultJson.put("AD临床记忆问卷-第二题", String.valueOf(memoryCheck.getGradeb()));
-                resultJson.put("AD临床记忆问卷-第三题", String.valueOf(memoryCheck.getGradec()));
-                objectEntityList.add(objectEntity1);
-                objectEntityList.add(objectEntity2);
-                objectEntityList.add(objectEntity3);
-            } else {
-                ObjectEntity objectEntity1 = new ObjectEntity();
-                objectEntity1.setKey("视觉空间工作记忆-视觉空间成绩");
-                objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                resultJson.put("视觉空间工作记忆-视觉空间成绩", String.valueOf(memoryCheck.getGradea()));
-                objectEntityList.add(objectEntity1);
-            }
-        }
-        datas = MemoryCheckEntitys.toString();
-        if (Constant.QUEST_TYPE_RTC.equals(type)) {
-            fileName = fileName + "-" + Constant.SHEET_NAME_RTC + ".xlsx";
-            name = Constant.SHEET_NAME_RTC;
-        } else {
-            fileName = fileName + "-" + Constant.SHEET_NAME_RTC_CHILD + ".xlsx";
-            name = Constant.SHEET_NAME_RTC_CHILD;
-        }
-
-        ExcelUtil.createExcelFile(ObjectEntity.class, objectEntityList, null, new ExcelClass().contentExcel(Constant.QUEST_TYPE_RTC), fileName, name);
-
-        // 获取JSON第一层所有的key
-        Set<String> keys = resultJson.keySet();
-
-        //计算结果
-        JSONArray dbJsonList = new JSONArray();
-        JSONObject dbJson = new JSONObject(true);
-        //列名
-        List colNames = new ArrayList();
-        colNames.add("");
-        colNames.add("即时记忆");
-        colNames.add("延时记忆");
-        dbJson.put("colNames", colNames);
-        JSONArray tableContext = new JSONArray();
-
-        if (Constant.QUEST_TYPE_RTC_CHILD.equals(type)) {
-            for (MemoryCheckEntity memoryCheck : MemoryCheckEntitys) {
-                if (memoryCheck.getMemoryType() == 2 || memoryCheck.getQuestionNo().equals("6") || memoryCheck.getQuestionNo().equals("7")){
-                    if (memoryCheck.getQuestionNo().equals("1")) {
-                        List colValue1 = new ArrayList();
-                        colValue1.add(resultJson.get("指向记忆-即时记忆总成绩"));
-                        colValue1.add(resultJson.get("指向记忆-延时记忆总成绩"));
-                        JSONObject row1 = new JSONObject();
-                        row1.put("name", "指向记忆");
-                        row1.put("value", colValue1);
-                        tableContext.add(row1);
-                    } else if (memoryCheck.getQuestionNo().equals("2")) {
-                        List colValue2 = new ArrayList();
-                        colValue2.add(resultJson.get("词汇联想-即时记忆总成绩"));
-                        colValue2.add(resultJson.get("词汇联想-延时记忆总成绩"));
-                        JSONObject row2 = new JSONObject();
-                        row2.put("name", "词汇联想");
-                        row2.put("value", colValue2);
-                        tableContext.add(row2);
-                    } else if (memoryCheck.getQuestionNo().equals("3")) {
-                        List colValue3 = new ArrayList();
-                        colValue3.add(resultJson.get("图像自由回忆-即时记忆图像成绩"));
-                        colValue3.add(resultJson.get("图像自由回忆-延时记忆图像成绩"));
-                        JSONObject row3 = new JSONObject();
-                        row3.put("name", "图象自由回忆");
-                        row3.put("value", colValue3);
-                        tableContext.add(row3);
-                    } else if (memoryCheck.getQuestionNo().equals("4")) {
-                        List colValue4 = new ArrayList();
-                        colValue4.add(resultJson.get("图片联想-即时记忆即时成绩") + "、" + resultJson.get("图片联想-即时记忆即时再确认成绩") + "、" + resultJson.get("图片联想-即时记忆总成绩"));
-                        colValue4.add(resultJson.get("图片联想-延时记忆即时成绩") + "、" + resultJson.get("图片联想-延时记忆即时再确认成绩") + "、" + resultJson.get("图片联想-延时记忆总成绩"));
-                        JSONObject row4 = new JSONObject();
-                        row4.put("name", "图片联想");
-                        row4.put("value", colValue4);
-                        tableContext.add(row4);
-                    } else if (memoryCheck.getQuestionNo().equals("5")) {
-                        List colValue5 = new ArrayList();
-                        colValue5.add(resultJson.get("人像特点回忆-即时记忆人像成绩"));
-                        colValue5.add(resultJson.get("人像特点回忆-延时记忆人像成绩"));
-                        JSONObject row5 = new JSONObject();
-                        row5.put("name", "人像特点");
-                        row5.put("value", colValue5);
-                        tableContext.add(row5);
-                    } else if (memoryCheck.getQuestionNo().equals("7")) {
-                        List colValue7 = new ArrayList();
-                        colValue7.add(resultJson.get("前瞻记忆-总分"));
-                        colValue7.add(resultJson.get("/"));
-                        JSONObject row7 = new JSONObject();
-                        row7.put("name", "前瞻记忆");
-                        row7.put("value", colValue7);
-                        tableContext.add(row7);
-                    } else {
-                        List colValue6 = new ArrayList();
-                        colValue6.add(resultJson.get("视觉空间工作记忆-视觉空间成绩"));
-                        colValue6.add(resultJson.get("/"));
-                        JSONObject row6 = new JSONObject();
-                        row6.put("name", "视觉空间工作记忆");
-                        row6.put("value", colValue6);
-                        tableContext.add(row6);
-                    }
-                }
-            }
-        } else {
-            //列值
-            List colValue1 = new ArrayList();
-            colValue1.add(resultJson.get("指向记忆-即时记忆总成绩"));
-            colValue1.add(resultJson.get("指向记忆-延时记忆总成绩"));
-            JSONObject row1 = new JSONObject();
-            row1.put("name", "指向记忆");
-            row1.put("value", colValue1);
-            tableContext.add(row1);
-
-            List colValue2 = new ArrayList();
-            colValue2.add(resultJson.get("词汇联想-即时记忆总成绩"));
-            colValue2.add(resultJson.get("词汇联想-延时记忆总成绩"));
-            JSONObject row2 = new JSONObject();
-            row2.put("name", "词汇联想");
-            row2.put("value", colValue2);
-            tableContext.add(row2);
-
-            List colValue3 = new ArrayList();
-            colValue3.add(resultJson.get("图像自由回忆-即时记忆图像成绩"));
-            colValue3.add(resultJson.get("图像自由回忆-延时记忆图像成绩"));
-            JSONObject row3 = new JSONObject();
-            row3.put("name", "图象自由回忆");
-            row3.put("value", colValue3);
-            tableContext.add(row3);
-
-            List colValue4 = new ArrayList();
-            colValue4.add(resultJson.get("图片联想-即时记忆即时成绩") + "、" + resultJson.get("图片联想-即时记忆即时再确认成绩") + "、" + resultJson.get("图片联想-即时记忆总成绩"));
-            colValue4.add(resultJson.get("图片联想-延时记忆即时成绩") + "、" + resultJson.get("图片联想-延时记忆即时再确认成绩") + "、" + resultJson.get("图片联想-延时记忆总成绩"));
-            JSONObject row4 = new JSONObject();
-            row4.put("name", "图片联想");
-            row4.put("value", colValue4);
-            tableContext.add(row4);
-
-            List colValue5 = new ArrayList();
-            colValue5.add(resultJson.get("人像特点回忆-即时记忆人像成绩"));
-            colValue5.add(resultJson.get("人像特点回忆-延时记忆人像成绩"));
-            JSONObject row5 = new JSONObject();
-            row5.put("name", "人像特点");
-            row5.put("value", colValue5);
-            tableContext.add(row5);
-
-            List colValue6 = new ArrayList();
-            colValue6.add(resultJson.get("视觉空间工作记忆-视觉空间成绩"));
-            colValue6.add(resultJson.get("/"));
-            JSONObject row6 = new JSONObject();
-            row6.put("name", "视觉空间工作记忆");
-            row6.put("value", colValue6);
-            tableContext.add(row6);
-
-            List colValue7 = new ArrayList();
-            colValue7.add(resultJson.get("前瞻记忆-总分"));
-            colValue7.add(resultJson.get("/"));
-            JSONObject row7 = new JSONObject();
-            row7.put("name", "前瞻记忆");
-            row7.put("value", colValue7);
-            tableContext.add(row7);
-        }
-
-        dbJson.put("tableContext", tableContext);
-        dbJsonList.add(dbJson);
-
-        int i = 1;
-        // 获取第一层每个key对应的值 的类型
-        for (String key : keys) {
-            if (i == keys.size()) {
-                testResult += key + ":" + resultJson.get(key);
-            } else {
-                testResult += key + ":" + resultJson.get(key) + ";";
-            }
-            i++;
-        }
-        //测试记录
-        String filePath;
-        filePath = "./心理检测/检测结果/" + new SimpleDateFormat("yyyy-MM-dd").format(new Date()) + "/" + name + "/" + fileName;
-        UserRecordEntity userRecordEntity = testRecord(type, phone, institutionNo, testTime, filePath, dbJsonList.toString(), name, "", datas, testResult, testPlanId);
-        System.out.println("resultJson:" + resultJson);
-        return success(userRecordEntity.getId(), "完成");
-
-    }
-
-
-//=====================第一版本逻辑,勿删========================================
-    /*@SafetyProcess
-    @OperationLogAnnotation
-    @PostMapping("/saveMemoryCheck")
-    @ApiOperation("添加记忆检查信息")
-    public Result saveMemoryCheck(@RequestBody String json) throws Exception {
-        //public Result saveMemoryCheck(@RequestBody JSONObject jsonObject ) throws Exception {
-        String data = AesEncryptUtils.decrypt(JSONObject.parseObject(json).getString("data"));
-        JSONObject jsonObject = JSONObject.parseObject(data);
-        System.out.println("----------------result-------------------");
-        System.out.println(jsonObject);
-        String userId = jsonObject.getString("userId");
-        String type = Constant.QUEST_TYPE_RTC;
-        if (jsonObject.containsKey("type")) {
-            type = jsonObject.getString("type");
-        }
-        String testType = Constant.DEFAULT_VALUE_ZERO;
-        if (jsonObject.containsKey("testType")) {
-            testType = jsonObject.getString("testType");
-        }
-        String testPlanId = "0";
-        if (jsonObject.containsKey("testPlanId")) {
-            testPlanId = jsonObject.getString("testPlanId");
-        }
-        UserEntity userEntity = this.userService.getOne(userId);
-        String phone = userEntity.getPhone();
-        String institutionNo = userEntity.getInstitutionNo();
-
-        DateFormat df = new SimpleDateFormat("yyyyMMddHHmm");
-        //当前时间
-        String testTime = df.format(new Date());
-        JSONArray jsonArray = jsonObject.getJSONArray("memoryCheck");
-        //答题结果列表
-        List<MemoryCheckEntity> dataList = jsonArray.toJavaList(MemoryCheckEntity.class);
-        //创建测试记录所需信息
-        List<MemoryCheckEntity> MemoryCheckEntitys = new ArrayList<>();
-        int y = 0;
-        for (MemoryCheckEntity memoryCheckEntity : dataList) {
-            memoryCheckEntity.setPhone(phone);
-            memoryCheckEntity.setTestDate(testTime);
-            memoryCheckEntity.setType(type);
-            memoryCheckEntity.setTestType(testType);
-            if (memoryCheckEntity.getMemoryType() == 2) {
-                if (testType.equals("1")) {
-                    this.memoryCheckService.save(memoryCheckEntity);
-                    //根据phone获取用户进行中记忆检查
-                    MemoryCheckEntitys = this.memoryCheckService.getMemoryCheckList(phone, type, testType,memoryCheckEntity.getQuestionNo());
-                } else {
-                    if (!memoryCheckEntity.getQuestionNo().equals("5")) {
-                        this.memoryCheckService.save(memoryCheckEntity);
-                        return success();
-                    } else {
-                        this.memoryCheckService.save(memoryCheckEntity);
-                        //根据phone获取用户进行中记忆检查
-                        MemoryCheckEntitys = this.memoryCheckService.getMemoryCheckList(phone, type, testType,null);
-                    *//*if (memoryCheckEntity.getCorrelationMemory() != null || !memoryCheckEntity.getCorrelationMemory().equals("")) {
-                        MemoryCheckEntity memoryCheck = this.memoryCheckService.selectById(memoryCheckEntity.getCorrelationMemory());
-                        MemoryCheckEntitys.add(memoryCheck);
-                        if (memoryCheck.getQuestionNo().equals("1")) {
-                            //查询当前用户第六题信息
-                            MemoryCheckEntity memory = this.memoryCheckService.selectMemory(phone, memoryCheck.getMina() + memoryCheck.getTestDate());
-                            if (memory != null) {
-                                MemoryCheckEntitys.add(memory);
-                                this.memoryCheckService.updateStatus(memory.getId());
-                            }
-                        }
-                    }
-                        for (MemoryCheckEntity memoryCheckEntity1 : MemoryCheckEntitys) {
-                            this.memoryCheckService.updateStatus(memoryCheckEntity1.getId());
-                        }*//*
-
-                    }
-                }
-                for (MemoryCheckEntity memoryCheckEntity1 : MemoryCheckEntitys) {
-                    this.memoryCheckService.updateStatus(memoryCheckEntity1.getId());
-                }
-            } else {
-                if (testType.equals("1") && (memoryCheckEntity.getQuestionNo().equals("6") || memoryCheckEntity.getQuestionNo().equals("7"))) {
-                    memoryCheckEntity.setStatus(0);
-                    this.memoryCheckService.save(memoryCheckEntity);
-                    MemoryCheckEntitys.add(memoryCheckEntity);
-                } else {
-                    y++;
-                    if (memoryCheckEntity.getQuestionNo().equals("6") || memoryCheckEntity.getQuestionNo().equals("7") || memoryCheckEntity.getQuestionNo().equals("8")) {
-                        memoryCheckEntity.setCorrelationMemory(dataList.get(0).getMina() + testTime);
-                    }
-                    this.memoryCheckService.save(memoryCheckEntity);
-                    if (dataList.size() == y) {
-                        return success();
-                    }
-                }
-            }
-        }
-        String datas = new String();
-        //生成测试记录文件并在数据库插入用户测试记录
-        String userName = userEntity.getPetName();
-        String userBirthday = userEntity.getBirthday();
-        String userSex = userEntity.getGender();
-        if (userSex.equals("0")) {
-            userSex = "男";
-        } else {
-            userSex = "女";
-        }
-        testTime = new SimpleDateFormat("yyyy年MM月dd日HH时mm分ss秒").format(new Date());
-        String fileName = userName + Constant.SPLIT_CHAR + userBirthday + Constant.SPLIT_CHAR + userSex + Constant.SPLIT_CHAR + testTime;
-        String testResult = new String();
-        String name = new String();
-        List<Map<String, String>> resultMapList = new ArrayList<>();
-        // 创建返回的json对象
-        JSONObject resultJson = new JSONObject(true);
-        // 创建入库的json对象
-        JSONObject resultDBJson = new JSONObject(true);
-
-        List<ObjectEntity> objectEntityList = new ArrayList<>();
-        for (MemoryCheckEntity memoryCheck : MemoryCheckEntitys) {
-            if (memoryCheck.getQuestionNo().equals("1")) {
-                ObjectEntity objectEntity1 = new ObjectEntity();
-                ObjectEntity objectEntity2 = new ObjectEntity();
-                ObjectEntity objectEntity3 = new ObjectEntity();
-                if (memoryCheck.getMemoryType() == 1) {
-                    objectEntity1.setKey("指向记忆-即时记忆指向成绩");
-                    objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                    objectEntity2.setKey("指向记忆-即时记忆非指向成绩");
-                    objectEntity2.setValue(String.valueOf(memoryCheck.getGradeb()));
-                    objectEntity3.setKey("指向记忆-即时记忆总成绩");
-                    objectEntity3.setValue(String.valueOf(Integer.valueOf(memoryCheck.getGradea()) + Integer.valueOf(memoryCheck.getGradeb())));
-                    resultJson.put("指向记忆-即时记忆指向成绩", String.valueOf(memoryCheck.getGradea()));
-                    resultJson.put("指向记忆-即时记忆非指向成绩", String.valueOf(memoryCheck.getGradeb()));
-                    resultJson.put("指向记忆-即时记忆总成绩", String.valueOf(Integer.valueOf(memoryCheck.getGradea()) + Integer.valueOf(memoryCheck.getGradeb())));
-                } else {
-                    objectEntity1.setKey("指向记忆-延时记忆指向成绩");
-                    objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                    objectEntity2.setKey("指向记忆-延时记忆非指向成绩");
-                    objectEntity2.setValue(String.valueOf(memoryCheck.getGradeb()));
-                    objectEntity3.setKey("指向记忆-延时记忆总成绩");
-                    objectEntity3.setValue(String.valueOf(Integer.valueOf(memoryCheck.getGradea()) + Integer.valueOf(memoryCheck.getGradeb())));
-                    resultJson.put("指向记忆-延时记忆指向成绩", String.valueOf(memoryCheck.getGradea()));
-                    resultJson.put("指向记忆-延时记忆非指向成绩", String.valueOf(memoryCheck.getGradeb()));
-                    resultJson.put("指向记忆-延时记忆总成绩", String.valueOf(Integer.valueOf(memoryCheck.getGradea()) + Integer.valueOf(memoryCheck.getGradeb())));
-                }
-                objectEntityList.add(objectEntity1);
-                objectEntityList.add(objectEntity2);
-                objectEntityList.add(objectEntity3);
-            } else if (memoryCheck.getQuestionNo().equals("2")) {
-                ObjectEntity objectEntity1 = new ObjectEntity();
-                ObjectEntity objectEntity2 = new ObjectEntity();
-                ObjectEntity objectEntity3 = new ObjectEntity();
-                if (memoryCheck.getMemoryType() == 1) {
-                    objectEntity1.setKey("词汇联想-即时记忆简单成绩");
-                    objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                    objectEntity2.setKey("词汇联想-即时记忆复杂成绩");
-                    objectEntity2.setValue(String.valueOf(memoryCheck.getGradeb()));
-                    objectEntity3.setKey("词汇联想-即时记忆总成绩");
-                    objectEntity3.setValue(String.valueOf(memoryCheck.getGradec()));
-                    resultJson.put("词汇联想-即时记忆简单成绩", String.valueOf(memoryCheck.getGradea()));
-                    resultJson.put("词汇联想-即时记忆复杂成绩", String.valueOf(memoryCheck.getGradeb()));
-                    resultJson.put("词汇联想-即时记忆总成绩", String.valueOf(memoryCheck.getGradec()));
-                } else {
-                    objectEntity1.setKey("词汇联想-延时记忆简单成绩");
-                    objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                    objectEntity2.setKey("词汇联想-延时记忆复杂成绩");
-                    objectEntity2.setValue(String.valueOf(memoryCheck.getGradeb()));
-                    objectEntity3.setKey("词汇联想-延时记忆总成绩");
-                    objectEntity3.setValue(String.valueOf(memoryCheck.getGradec()));
-                    resultJson.put("词汇联想-延时记忆简单成绩", String.valueOf(memoryCheck.getGradea()));
-                    resultJson.put("词汇联想-延时记忆复杂成绩", String.valueOf(memoryCheck.getGradeb()));
-                    resultJson.put("词汇联想-延时记忆总成绩", String.valueOf(memoryCheck.getGradec()));
-                }
-                objectEntityList.add(objectEntity1);
-                objectEntityList.add(objectEntity2);
-                objectEntityList.add(objectEntity3);
-            } else if (memoryCheck.getQuestionNo().equals("3")) {
-                ObjectEntity objectEntity1 = new ObjectEntity();
-                if (memoryCheck.getMemoryType() == 1) {
-                    objectEntity1.setKey("图像自由回忆-即时记忆图像成绩");
-                    objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                    resultJson.put("图像自由回忆-即时记忆图像成绩", String.valueOf(memoryCheck.getGradea()));
-                } else {
-                    objectEntity1.setKey("图像自由回忆-延时记忆图像成绩");
-                    objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                    resultJson.put("图像自由回忆-延时记忆图像成绩", String.valueOf(memoryCheck.getGradea()));
-                }
-                objectEntityList.add(objectEntity1);
-            } else if (memoryCheck.getQuestionNo().equals("4")) {
-                ObjectEntity objectEntity1 = new ObjectEntity();
-                ObjectEntity objectEntity2 = new ObjectEntity();
-                ObjectEntity objectEntity3 = new ObjectEntity();
-                if (memoryCheck.getMemoryType() == 1) {
-                    objectEntity1.setKey("图片联想-即时记忆即时成绩");
-                    objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                    objectEntity2.setKey("图片联想-即时记忆即时再确认成绩");
-                    objectEntity2.setValue(String.valueOf(memoryCheck.getGradeb()));
-                    objectEntity3.setKey("图片联想-即时记忆总成绩");
-                    objectEntity3.setValue(String.valueOf(Integer.valueOf(memoryCheck.getGradea()) + Integer.valueOf(memoryCheck.getGradeb())));
-                    resultJson.put("图片联想-即时记忆即时成绩", String.valueOf(memoryCheck.getGradea()));
-                    resultJson.put("图片联想-即时记忆即时再确认成绩", String.valueOf(memoryCheck.getGradeb()));
-                    resultJson.put("图片联想-即时记忆总成绩", String.valueOf(Integer.valueOf(memoryCheck.getGradea()) + Integer.valueOf(memoryCheck.getGradeb())));
-                } else {
-                    objectEntity1.setKey("图片联想-延时记忆即时成绩");
-                    objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                    objectEntity2.setKey("图片联想-延时记忆即时再确认成绩");
-                    objectEntity2.setValue(String.valueOf(memoryCheck.getGradeb()));
-                    objectEntity3.setKey("图片联想-延时记忆总成绩");
-                    objectEntity3.setValue(String.valueOf(Integer.valueOf(memoryCheck.getGradea()) + Integer.valueOf(memoryCheck.getGradeb())));
-                    resultJson.put("图片联想-延时记忆即时成绩", String.valueOf(memoryCheck.getGradea()));
-                    resultJson.put("图片联想-延时记忆即时再确认成绩", String.valueOf(memoryCheck.getGradeb()));
-                    resultJson.put("图片联想-延时记忆总成绩", String.valueOf(Integer.valueOf(memoryCheck.getGradea()) + Integer.valueOf(memoryCheck.getGradeb())));
-                }
-                objectEntityList.add(objectEntity1);
-                objectEntityList.add(objectEntity2);
-                objectEntityList.add(objectEntity3);
-            } else if (memoryCheck.getQuestionNo().equals("5")) {
-                ObjectEntity objectEntity1 = new ObjectEntity();
-                if (memoryCheck.getMemoryType() == 1) {
-                    objectEntity1.setKey("人像特点回忆-即时记忆人像成绩");
-                    objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                    resultJson.put("人像特点回忆-即时记忆人像成绩", String.valueOf(memoryCheck.getGradea()));
-                } else {
-                    objectEntity1.setKey("人像特点回忆-延时记忆人像成绩");
-                    objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                    resultJson.put("人像特点回忆-延时记忆人像成绩", String.valueOf(memoryCheck.getGradea()));
-                }
-                objectEntityList.add(objectEntity1);
-            } else if (memoryCheck.getQuestionNo().equals("7")) {
-                ObjectEntity objectEntity1 = new ObjectEntity();
-                ObjectEntity objectEntity2 = new ObjectEntity();
-                ObjectEntity objectEntity3 = new ObjectEntity();
-                objectEntity1.setKey("前瞻记忆-四字成语[全部正确率,部分正确率]");
-                objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                objectEntity2.setKey("前瞻记忆-模糊数字[全部正确率,部分正确率]");
-                objectEntity2.setValue(String.valueOf(memoryCheck.getGradeb()));
-                objectEntity3.setKey("前瞻记忆-总分");
-                objectEntity3.setValue(String.valueOf(memoryCheck.getGradec()));
-                resultJson.put("前瞻记忆-四字成语[全部正确率,部分正确率]", String.valueOf(memoryCheck.getGradea()));
-                resultJson.put("前瞻记忆-模糊数字[全部正确率,部分正确率]", String.valueOf(memoryCheck.getGradeb()));
-                resultJson.put("前瞻记忆-总分", String.valueOf(memoryCheck.getGradec()));
-                objectEntityList.add(objectEntity1);
-                objectEntityList.add(objectEntity2);
-                objectEntityList.add(objectEntity3);
-            } else if (memoryCheck.getQuestionNo().equals("8")) {
-                ObjectEntity objectEntity1 = new ObjectEntity();
-                ObjectEntity objectEntity2 = new ObjectEntity();
-                ObjectEntity objectEntity3 = new ObjectEntity();
-                objectEntity1.setKey("AD临床记忆问卷-第一题");
-                objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                objectEntity2.setKey("AD临床记忆问卷-第二题");
-                objectEntity2.setValue(String.valueOf(memoryCheck.getGradeb()));
-                objectEntity3.setKey("AD临床记忆问卷-第三题");
-                objectEntity3.setValue(String.valueOf(memoryCheck.getGradec()));
-                resultJson.put("AD临床记忆问卷-第一题", String.valueOf(memoryCheck.getGradea()));
-                resultJson.put("AD临床记忆问卷-第二题", String.valueOf(memoryCheck.getGradeb()));
-                resultJson.put("AD临床记忆问卷-第三题", String.valueOf(memoryCheck.getGradec()));
-                objectEntityList.add(objectEntity1);
-                objectEntityList.add(objectEntity2);
-                objectEntityList.add(objectEntity3);
-            } else {
-                ObjectEntity objectEntity1 = new ObjectEntity();
-                objectEntity1.setKey("视觉空间工作记忆-视觉空间成绩");
-                objectEntity1.setValue(String.valueOf(memoryCheck.getGradea()));
-                resultJson.put("视觉空间工作记忆-视觉空间成绩", String.valueOf(memoryCheck.getGradea()));
-                objectEntityList.add(objectEntity1);
-            }
-        }
-        datas = MemoryCheckEntitys.toString();
-        if (Constant.QUEST_TYPE_RTC.equals(type)) {
-            fileName = fileName + "-" + Constant.SHEET_NAME_RTC + ".xlsx";
-            name = Constant.SHEET_NAME_RTC;
-        } else {
-            fileName = fileName + "-" + Constant.SHEET_NAME_RTC_CHILD + ".xlsx";
-            name = Constant.SHEET_NAME_RTC_CHILD;
-        }
-
-        ExcelUtil.createExcelFile(ObjectEntity.class, objectEntityList, null, new ExcelClass().contentExcel(Constant.QUEST_TYPE_RTC), fileName, name);
-
-        // 获取JSON第一层所有的key
-        Set<String> keys = resultJson.keySet();
-
-        //计算结果
-        JSONArray dbJsonList = new JSONArray();
-        JSONObject dbJson = new JSONObject(true);
-        //列名
-        List colNames = new ArrayList();
-        colNames.add("");
-        colNames.add("即时记忆");
-        colNames.add("延时记忆");
-        dbJson.put("colNames", colNames);
-        JSONArray tableContext = new JSONArray();
-
-        if (Constant.QUEST_TYPE_RTC_CHILD.equals(type)) {
-            for (MemoryCheckEntity memoryCheck : MemoryCheckEntitys) {
-                if (memoryCheck.getMemoryType() == 2 || memoryCheck.getQuestionNo().equals("6") || memoryCheck.getQuestionNo().equals("7")){
-                    if (memoryCheck.getQuestionNo().equals("1")) {
-                        List colValue1 = new ArrayList();
-                        colValue1.add(resultJson.get("指向记忆-即时记忆总成绩"));
-                        colValue1.add(resultJson.get("指向记忆-延时记忆总成绩"));
-                        JSONObject row1 = new JSONObject();
-                        row1.put("name", "指向记忆");
-                        row1.put("value", colValue1);
-                        tableContext.add(row1);
-                    } else if (memoryCheck.getQuestionNo().equals("2")) {
-                        List colValue2 = new ArrayList();
-                        colValue2.add(resultJson.get("词汇联想-即时记忆总成绩"));
-                        colValue2.add(resultJson.get("词汇联想-延时记忆总成绩"));
-                        JSONObject row2 = new JSONObject();
-                        row2.put("name", "词汇联想");
-                        row2.put("value", colValue2);
-                        tableContext.add(row2);
-                    } else if (memoryCheck.getQuestionNo().equals("3")) {
-                        List colValue3 = new ArrayList();
-                        colValue3.add(resultJson.get("图像自由回忆-即时记忆图像成绩"));
-                        colValue3.add(resultJson.get("图像自由回忆-延时记忆图像成绩"));
-                        JSONObject row3 = new JSONObject();
-                        row3.put("name", "图象自由回忆");
-                        row3.put("value", colValue3);
-                        tableContext.add(row3);
-                    } else if (memoryCheck.getQuestionNo().equals("4")) {
-                        List colValue4 = new ArrayList();
-                        colValue4.add(resultJson.get("图片联想-即时记忆即时成绩") + "、" + resultJson.get("图片联想-即时记忆即时再确认成绩") + "、" + resultJson.get("图片联想-即时记忆总成绩"));
-                        colValue4.add(resultJson.get("图片联想-延时记忆即时成绩") + "、" + resultJson.get("图片联想-延时记忆即时再确认成绩") + "、" + resultJson.get("图片联想-延时记忆总成绩"));
-                        JSONObject row4 = new JSONObject();
-                        row4.put("name", "图片联想");
-                        row4.put("value", colValue4);
-                        tableContext.add(row4);
-                    } else if (memoryCheck.getQuestionNo().equals("5")) {
-                        List colValue5 = new ArrayList();
-                        colValue5.add(resultJson.get("人像特点回忆-即时记忆人像成绩"));
-                        colValue5.add(resultJson.get("人像特点回忆-延时记忆人像成绩"));
-                        JSONObject row5 = new JSONObject();
-                        row5.put("name", "人像特点");
-                        row5.put("value", colValue5);
-                        tableContext.add(row5);
-                    } else if (memoryCheck.getQuestionNo().equals("7")) {
-                        List colValue7 = new ArrayList();
-                        colValue7.add(resultJson.get("前瞻记忆-总分"));
-                        colValue7.add(resultJson.get("/"));
-                        JSONObject row7 = new JSONObject();
-                        row7.put("name", "前瞻记忆");
-                        row7.put("value", colValue7);
-                        tableContext.add(row7);
-                    } else {
-                        List colValue6 = new ArrayList();
-                        colValue6.add(resultJson.get("视觉空间工作记忆-视觉空间成绩"));
-                        colValue6.add(resultJson.get("/"));
-                        JSONObject row6 = new JSONObject();
-                        row6.put("name", "视觉空间工作记忆");
-                        row6.put("value", colValue6);
-                        tableContext.add(row6);
-                    }
-                }
-            }
-        } else {
-            //列值
-            List colValue1 = new ArrayList();
-            colValue1.add(resultJson.get("指向记忆-即时记忆总成绩"));
-            colValue1.add(resultJson.get("指向记忆-延时记忆总成绩"));
-            JSONObject row1 = new JSONObject();
-            row1.put("name", "指向记忆");
-            row1.put("value", colValue1);
-            tableContext.add(row1);
-
-            List colValue2 = new ArrayList();
-            colValue2.add(resultJson.get("词汇联想-即时记忆总成绩"));
-            colValue2.add(resultJson.get("词汇联想-延时记忆总成绩"));
-            JSONObject row2 = new JSONObject();
-            row2.put("name", "词汇联想");
-            row2.put("value", colValue2);
-            tableContext.add(row2);
-
-            List colValue3 = new ArrayList();
-            colValue3.add(resultJson.get("图像自由回忆-即时记忆图像成绩"));
-            colValue3.add(resultJson.get("图像自由回忆-延时记忆图像成绩"));
-            JSONObject row3 = new JSONObject();
-            row3.put("name", "图象自由回忆");
-            row3.put("value", colValue3);
-            tableContext.add(row3);
-
-            List colValue4 = new ArrayList();
-            colValue4.add(resultJson.get("图片联想-即时记忆即时成绩") + "、" + resultJson.get("图片联想-即时记忆即时再确认成绩") + "、" + resultJson.get("图片联想-即时记忆总成绩"));
-            colValue4.add(resultJson.get("图片联想-延时记忆即时成绩") + "、" + resultJson.get("图片联想-延时记忆即时再确认成绩") + "、" + resultJson.get("图片联想-延时记忆总成绩"));
-            JSONObject row4 = new JSONObject();
-            row4.put("name", "图片联想");
-            row4.put("value", colValue4);
-            tableContext.add(row4);
-
-            List colValue5 = new ArrayList();
-            colValue5.add(resultJson.get("人像特点回忆-即时记忆人像成绩"));
-            colValue5.add(resultJson.get("人像特点回忆-延时记忆人像成绩"));
-            JSONObject row5 = new JSONObject();
-            row5.put("name", "人像特点");
-            row5.put("value", colValue5);
-            tableContext.add(row5);
-
-            List colValue6 = new ArrayList();
-            colValue6.add(resultJson.get("视觉空间工作记忆-视觉空间成绩"));
-            colValue6.add(resultJson.get("/"));
-            JSONObject row6 = new JSONObject();
-            row6.put("name", "视觉空间工作记忆");
-            row6.put("value", colValue6);
-            tableContext.add(row6);
-
-            List colValue7 = new ArrayList();
-            colValue7.add(resultJson.get("前瞻记忆-总分"));
-            colValue7.add(resultJson.get("/"));
-            JSONObject row7 = new JSONObject();
-            row7.put("name", "前瞻记忆");
-            row7.put("value", colValue7);
-            tableContext.add(row7);
-        }
-
-        dbJson.put("tableContext", tableContext);
-        dbJsonList.add(dbJson);
-
-        int i = 1;
-        // 获取第一层每个key对应的值 的类型
-        for (String key : keys) {
-            if (i == keys.size()) {
-                testResult += key + ":" + resultJson.get(key);
-            } else {
-                testResult += key + ":" + resultJson.get(key) + ";";
-            }
-            i++;
-        }
-        //测试记录
-        String filePath;
-        filePath = "./心理检测/检测结果/" + new SimpleDateFormat("yyyy-MM-dd").format(new Date()) + "/" + name + "/" + fileName;
-        UserRecordEntity userRecordEntity = testRecord(type, phone, institutionNo, testTime, filePath, dbJsonList.toString(), name, "", datas, testResult, testPlanId);
-        System.out.println("resultJson:" + resultJson);
-        return success(userRecordEntity.getId(), "完成");
-
-    }*/
-
-    private UserRecordEntity testRecord(String flag, String phone, String institutionNo, String testTime, String fileName, String testResult, String name, String b64Img, String datas, String testResults, String testPlanId) {
-        //根据taskCode记录测试数
-        this.cognitiveTaskService.addTestNum(flag);
-        //添加用户测试记录
-        UserRecordEntity userRecordEntity = new UserRecordEntity();
-        userRecordEntity.setFlag(flag);
-        userRecordEntity.setPhone(phone);
-        userRecordEntity.setInstitutionNo(institutionNo);
-        userRecordEntity.setTestDate(testTime);
-        userRecordEntity.setTestResult(testResult);
-        userRecordEntity.setType("1");
-        userRecordEntity.setFileName(fileName);
-        userRecordEntity.setName(name);
-        userRecordEntity.setImg(b64Img);
-        userRecordEntity.setTestRecord(datas);
-        userRecordEntity.setTestResults(testResults);
-        if (testPlanId == null || testPlanId.equals("")) {
-            userRecordEntity.setTestPlanId("0");
-        } else {
-            userRecordEntity.setTestPlanId(testPlanId);
-        }
-        this.userRecordService.save(userRecordEntity);
-        return userRecordEntity;
-    }
-
-
-    /**
-     * 查询延时记忆是否可用
-     *
-     * @return
-     */
-    @SafetyProcess
-    @PostMapping("/getIfUsable")
-    @ApiOperation(value = "查询延时记忆是否可用")
-    public Result getIfUsable(@RequestBody String json, HttpServletRequest request) throws Exception {
-        String data = AesEncryptUtils.decrypt(JSONObject.parseObject(json).getString("data"));
-        JSONObject jsonObject = JSONObject.parseObject(data);
-        System.out.println("----------------result-------------------");System.out.println(jsonObject);
-        String phone = jsonObject.getString("phone");
-        String type = Constant.QUEST_TYPE_RTC;
-        if (jsonObject.containsKey("type")) {
-            type = jsonObject.getString("type");
-        }
-        String testType = Constant.DEFAULT_VALUE_ZERO;
-        if (jsonObject.containsKey("testType")) {
-            testType = jsonObject.getString("testType");
-        }
-        String questionNo = "";
-        if (jsonObject.containsKey("questionNo")) {
-            questionNo = jsonObject.getString("questionNo");
-        }
-        String token = request.getHeader("Authorization");
-        token = token.split(" ")[1];//以空格划分Bearer token,获取token
-        //从请求头中获取token
-        DecodedJWT verify = JWTUtil.verify(token);
-        String institutionNo = verify.getClaim("institutionNo").asString();
-        //根据phone获取用户进行中记忆检查
-        List<MemoryCheckEntity> memoryCheckEntityList = this.memoryCheckService.getMemoryCheckList(phone, type, testType,questionNo,institutionNo);
-        if (memoryCheckEntityList.size() > 0) {
-
-            DateFormat df = new SimpleDateFormat("yyyyMMddHHmm");
-            Date beginTime = null;
-            for (MemoryCheckEntity memoryCheckEntity : memoryCheckEntityList) {
-                if (memoryCheckEntity.getMemoryType() == 1) {
-                    //开始时间
-                    beginTime = df.parse(memoryCheckEntity.getTestDate());
-                    break;
-                }
-            }
-            //当前时间
-            Date endTime = df.parse(DateUtil.getNowTime("yyyyMMddHHmm"));
-            //计算时间差---分钟
-            int diff = DateUtil.getDistanceByUnit(beginTime, endTime, 2);
-            if (diff < 0 || diff >= 30) {
-                return success(memoryCheckEntityList);
-            } else {
-                int a = 30 - diff;
-                return success(a, "还未到时间");
-            }
-        }
-        return success(memoryCheckEntityList, "需要先进行即时测试");
-    }
-
-    /**
-     * 清除进行中任务
-     *
-     * @return
-     */
-    @SafetyProcess
-    @OperationLogAnnotation
-    @PostMapping("/clearMemory")
-    @ApiOperation(value = "清除进行中任务")
-    public Result clearMemory(@RequestBody String json, HttpServletRequest request) throws Exception {
-        //public Result saveMemoryCheck(@RequestBody JSONObject jsonObject ) throws Exception {
-        String data = AesEncryptUtils.decrypt(JSONObject.parseObject(json).getString("data"));
-        JSONObject jsonObject = JSONObject.parseObject(data);
-        String phone = jsonObject.getString("phone");
-        String type = Constant.QUEST_TYPE_RTC;
-        if (jsonObject.containsKey("type")) {
-            type = jsonObject.getString("type");
-        }
-        String testType = Constant.DEFAULT_VALUE_ZERO;
-        if (jsonObject.containsKey("testType")) {
-            testType = jsonObject.getString("testType");
-        }
-        String questionNo = "";
-        if (jsonObject.containsKey("questionNo")) {
-            questionNo = jsonObject.getString("questionNo");
-        }
-        String token = request.getHeader("Authorization");
-        token = token.split(" ")[1];//以空格划分Bearer token,获取token
-        //从请求头中获取token
-        DecodedJWT verify = JWTUtil.verify(token);
-        String institutionNo = verify.getClaim("institutionNo").asString();
-        //清除进行中任务
-        this.memoryCheckService.clearMemory(phone, type, testType,questionNo,institutionNo);
-        return success();
-    }
-}

+ 0 - 50
src/main/java/com/rf/psychological/scale/service/MemoryCheckService.java

@@ -1,50 +0,0 @@
-package com.rf.psychological.scale.service;
-
-import com.rf.psychological.dao.model.MemoryCheckEntity;
-
-import java.util.List;
-
-/**
- * @author zsy
- * @description:
- * @date 2021/5/14 10:49
- */
-public interface MemoryCheckService {
-
-
-    /**
-     * 保存
-     * @param memoryCheckEntity
-     */
-    void save(MemoryCheckEntity memoryCheckEntity);
-
-    /**
-     * 根据关联记忆id修改既时记忆状态
-     * @param correlationMemory
-     */
-    void updateStatus(String correlationMemory);
-
-    /**
-     * 根据phone获取用户进行中记忆检查
-     * @param phone
-     */
-    List<MemoryCheckEntity> getMemoryCheckList(String phone,String type,String testType,String questionNo,String institutionNo);
-
-    /**
-     * 根据id获取用户记忆检查信息
-     * @param correlationMemory
-     */
-    MemoryCheckEntity selectById(String correlationMemory);
-
-    /**
-     * 查询当前用户第六题信息
-     * @param
-     */
-    MemoryCheckEntity selectMemory(String phone,String correlationMemory,String institutionNo);
-
-    /**
-     * 清除进行中任务
-     * @param
-     */
-    void clearMemory(String phone,String type,String testType,String questionNo,String institutionNo);
-}

+ 0 - 86
src/main/java/com/rf/psychological/scale/service/impl/MemoryCheckServiceImpl.java

@@ -1,86 +0,0 @@
-package com.rf.psychological.scale.service.impl;
-
-import com.rf.psychological.dao.model.MemoryCheckEntity;
-import com.rf.psychological.dao.repository.MemoryCheckRepository;
-import com.rf.psychological.scale.service.MemoryCheckService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * @author zsy
- * @description:
- * @date 2021/5/14 10:51
- */
-@Service
-public class MemoryCheckServiceImpl implements MemoryCheckService {
-    @Autowired
-    private MemoryCheckRepository memoryCheckRepository;
-
-    /**
-     * 根据flag获取全部答案
-     *
-     * @param flag
-     */
-    //@Override
-    //public List<AnswerEntity> getAnswerByFlag(String flag) {
-    //return this.answerRepository.getAnswerByFlag(flag);
-    //}
-
-    /**
-     * 保存
-     * @param memoryCheckEntity
-     */
-    @Override
-    public void save(MemoryCheckEntity memoryCheckEntity) {
-        this.memoryCheckRepository.save(memoryCheckEntity);
-    }
-
-    /**
-     * 根据关联记忆id修改既时记忆状态
-     * @param correlationMemory
-     */
-    @Override
-    public void updateStatus(String correlationMemory) {
-        this.memoryCheckRepository.updateStatus(correlationMemory);
-    }
-
-    /**
-     * 根据phone获取用户进行中记忆检查
-     * @param phone
-     */
-    @Override
-    public List<MemoryCheckEntity> getMemoryCheckList(String phone,String type,String testType,String questionNo,String institutionNo) {
-        return this.memoryCheckRepository.getMemoryCheckList(phone,type,testType,questionNo,institutionNo);
-    }
-
-    /**
-     * 根据id获取用户记忆检查信息
-     * @param correlationMemory
-     */
-    @Override
-    public MemoryCheckEntity selectById(String correlationMemory) {
-        return this.memoryCheckRepository.selectById(correlationMemory);
-    }
-
-    /**
-     * 查询当前用户第六题信息
-     * @param
-     */
-    @Override
-    public MemoryCheckEntity selectMemory(String phone, String correlationMemory,String institutionNo) {
-        return this.memoryCheckRepository.selectMemory(phone,correlationMemory,institutionNo);
-    }
-
-    /**
-     * 清除进行中任务
-     * @param
-     */
-    @Override
-    public void clearMemory(String phone,String type,String testType,String questionNo,String institutionNo) {
-        this.memoryCheckRepository.clearMemory(phone,type,testType,questionNo,institutionNo);
-    }
-
-
-}

+ 0 - 35
src/main/java/com/rf/psychological/user/dao/model/UserRepeatNameNumEntity.java

@@ -1,35 +0,0 @@
-package com.rf.psychological.user.dao.model;
-
-import com.rf.psychological.base.model.BaseEntity;
-import lombok.*;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Table;
-
-/**
- * @author lpf
- * @description:
- * @date 17/12/2021下午3:21
- */
-
-@EqualsAndHashCode(callSuper = true)
-@Entity
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@Table(name = "t_repeat_username")
-@org.hibernate.annotations.Table(appliesTo = "t_repeat_username", comment = "机构下姓名拼音重复表")
-public class UserRepeatNameNumEntity extends BaseEntity {
-
-    @Column(name = "name_pinyin", columnDefinition = "varchar(40) not null comment '姓名拼音'")
-    private String namePinyin;
-
-    @Column(name = "institution_no", columnDefinition = "varchar(50) comment '所属机构编码'")
-    private String institutionNo;
-
-    @Column(name = "num", columnDefinition = "int(11)  default 1 comment '拼音重复次数'")
-    private int num;
-
-
-}

+ 0 - 28
src/main/java/com/rf/psychological/user/dao/repository/UserRepeatNameNumRepository.java

@@ -1,28 +0,0 @@
-package com.rf.psychological.user.dao.repository;
-
-import com.rf.psychological.base.repository.BaseRepository;
-import com.rf.psychological.user.dao.model.UserRepeatNameNumEntity;
-import org.springframework.data.jpa.repository.Modifying;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.List;
-
-/**
- * @author lpf
- * @description:
- * @date 17/12/2021下午4:35
- */
-public interface UserRepeatNameNumRepository extends BaseRepository<UserRepeatNameNumEntity, String> {
-
-    List<UserRepeatNameNumEntity> findAllByInstitutionNo(String institutionNo);
-
-    UserRepeatNameNumEntity findUserRepeatNameNumEntityByNamePinyinAndInstitutionNo(String namePinyin, String institutionNo);
-
-    @Transactional
-    @Modifying(clearAutomatically = true)
-    @Query(value = "update t_repeat_username set num = ?3 where name_pinyin=?1 and institution_no=?2", nativeQuery = true)
-    int updateNum(String namePinyin, String institutionNo, int num);
-
-
-}

+ 0 - 30
src/main/java/com/rf/psychological/user/service/UserRepeatNameNumService.java

@@ -1,30 +0,0 @@
-package com.rf.psychological.user.service;
-
-import com.rf.psychological.user.dao.model.UserRepeatNameNumEntity;
-
-import java.util.List;
-
-/**
- * @author lpf
- * @description:
- * @date 17/12/2021下午7:20
- */
-public interface UserRepeatNameNumService {
-
-    List<UserRepeatNameNumEntity> findAllByInstitutionNo(String institutionNo);
-
-    UserRepeatNameNumEntity findUserRepeatNameNumEntityByNamePinyinAndInstitutionNo(String namePinyin, String institutionNo);
-
-    int updateNum(String namePinyin, String institutionNo, int num);
-
-    UserRepeatNameNumEntity save(UserRepeatNameNumEntity userRepeatNameNumEntity);
-
-    /**
-     * 检查同机构下存在同拼音的人的人数
-     * @param institutionNo
-     * @param namePinyin
-     * @return 同拼音的人的人数
-     */
-    int testOrNotNamePinyin(String institutionNo, String namePinyin);
-
-}

+ 0 - 53
src/main/java/com/rf/psychological/user/service/impl/UserRepeatNameNumServiceImpl.java

@@ -1,53 +0,0 @@
-package com.rf.psychological.user.service.impl;
-
-import com.rf.psychological.user.dao.model.UserRepeatNameNumEntity;
-import com.rf.psychological.user.dao.repository.UserRepeatNameNumRepository;
-import com.rf.psychological.user.service.UserRepeatNameNumService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * @author lpf
- * @description:
- * @date 17/12/2021下午7:22
- */
-@Service
-public class UserRepeatNameNumServiceImpl implements UserRepeatNameNumService {
-
-    @Autowired
-    private UserRepeatNameNumRepository userRepeatNameNumRepository;
-
-    @Override
-    public List<UserRepeatNameNumEntity> findAllByInstitutionNo(String institutionNo) {
-        return userRepeatNameNumRepository.findAllByInstitutionNo(institutionNo);
-    }
-
-    @Override
-    public UserRepeatNameNumEntity findUserRepeatNameNumEntityByNamePinyinAndInstitutionNo(String namePinyin, String institutionNo) {
-        return userRepeatNameNumRepository.findUserRepeatNameNumEntityByNamePinyinAndInstitutionNo(namePinyin, institutionNo);
-    }
-
-    @Override
-    public int updateNum(String namePinyin, String institutionNo, int num) {
-        return userRepeatNameNumRepository.updateNum(namePinyin, institutionNo, num);
-    }
-
-    @Override
-    public UserRepeatNameNumEntity save(UserRepeatNameNumEntity userRepeatNameNumEntity) {
-        return userRepeatNameNumRepository.save(userRepeatNameNumEntity);
-    }
-
-    @Override
-    public int testOrNotNamePinyin(String institutionNo, String namePinyin) {
-        UserRepeatNameNumEntity userRepeatNameNumEntityByNamePinyinAndInstitutionNo = userRepeatNameNumRepository.findUserRepeatNameNumEntityByNamePinyinAndInstitutionNo(namePinyin, institutionNo);
-        if (userRepeatNameNumEntityByNamePinyinAndInstitutionNo == null) {
-            userRepeatNameNumRepository.save(new UserRepeatNameNumEntity(namePinyin, institutionNo, 0));
-            return 0;
-        } else {
-            userRepeatNameNumRepository.updateNum(namePinyin, institutionNo, userRepeatNameNumEntityByNamePinyinAndInstitutionNo.getNum() + 1);
-            return userRepeatNameNumEntityByNamePinyinAndInstitutionNo.getNum();
-        }
-    }
-}