Browse Source

统计接口开发

zsf 1 year ago
parent
commit
3344f41630
19 changed files with 290 additions and 199 deletions
  1. 2 0
      src/main/java/com/rf/psychological/plan/dao/repository/TestPlanContendRepository.java
  2. 3 0
      src/main/java/com/rf/psychological/plan/dao/repository/TestPlanUserRepository.java
  3. 2 0
      src/main/java/com/rf/psychological/plan/service/TestPlanContendService.java
  4. 2 0
      src/main/java/com/rf/psychological/plan/service/TestPlanUserService.java
  5. 5 0
      src/main/java/com/rf/psychological/plan/service/impl/TestPlanContendServiceImpl.java
  6. 6 0
      src/main/java/com/rf/psychological/plan/service/impl/TestPlanUserServiceImpl.java
  7. 188 0
      src/main/java/com/rf/psychological/rest/ReportAnalysisController.java
  8. 2 8
      src/main/java/com/rf/psychological/rest/ServerController.java
  9. 3 0
      src/main/java/com/rf/psychological/scale/dao/model/UserRecordEntity.java
  10. 3 0
      src/main/java/com/rf/psychological/scale/dao/repository/UserRecordRepository.java
  11. 7 10
      src/main/java/com/rf/psychological/scale/rest/WebScaleResultController.java
  12. 2 0
      src/main/java/com/rf/psychological/scale/service/UserRecordService.java
  13. 6 0
      src/main/java/com/rf/psychological/scale/service/impl/UserRecordServiceImpl.java
  14. 1 1
      src/main/java/com/rf/psychological/threadpool/ThreadTask.java
  15. 3 0
      src/main/java/com/rf/psychological/user/dao/repository/UserRepository.java
  16. 2 0
      src/main/java/com/rf/psychological/user/service/UserService.java
  17. 5 0
      src/main/java/com/rf/psychological/user/service/impl/UserServiceImpl.java
  18. 17 148
      src/main/java/com/rf/psychological/utils/Constant.java
  19. 31 32
      src/main/java/com/rf/psychological/utils/SendMessageUtil.java

+ 2 - 0
src/main/java/com/rf/psychological/plan/dao/repository/TestPlanContendRepository.java

@@ -314,4 +314,6 @@ public interface TestPlanContendRepository extends BaseRepository<TestPlanConten
                     "where tcs.ename = ?5 ", nativeQuery = true)
     Page<TestPlanAuthConTaskDto> getTestPlanNoConTaskByCatagoryEnglinshName(String institutionNo, String type, String searchKey, String testPlanId, String categoryEname, Pageable pageable);
 
+
+    List<TestPlanContendEntity> findAllByTestPlanId(String planId);
 }

+ 3 - 0
src/main/java/com/rf/psychological/plan/dao/repository/TestPlanUserRepository.java

@@ -93,4 +93,7 @@ public interface TestPlanUserRepository extends BaseRepository<TestPlanUserEntit
 
     @Query(value = "select id,create_time,test_plan_id,u_id,update_time,is_complete from t_test_plan_user where u_id = :userId and test_plan_id = :planId",nativeQuery = true)
     TestPlanUserEntity findByUserIdAndPlanId(@Param("userId") String userId, @Param("planId") String planId);
+
+    @Query(value="select count(1)  from t_test_plan_user pu LEFT JOIN t_user_info u ON pu.u_id = u.id where pu.test_plan_id = :planId and u.institution_no =:institutionNo and u.structure_no like :structureNo",nativeQuery = true)
+    int countByTestPlanIdAndStructureNo(@Param("planId")String planId, @Param("structureNo")String structureNo, @Param("institutionNo")String institutionNo);
 }

+ 2 - 0
src/main/java/com/rf/psychological/plan/service/TestPlanContendService.java

@@ -63,4 +63,6 @@ public interface TestPlanContendService {
      * @return
      */
     int countContent(String testPlanId);
+
+    List<TestPlanContendEntity> findAllByTestPlanId(String testPlanId);
 }

+ 2 - 0
src/main/java/com/rf/psychological/plan/service/TestPlanUserService.java

@@ -26,6 +26,8 @@ public interface TestPlanUserService {
 
     int countByTestId(String testId);
 
+    int countByTestPlanIdAndStructureNo(String planId,String structureNo,String institutionNo);
+
     List<TestPlanUserEntity> findTestPlanByUId(String uId, int beginNum, int pageSize, String status);
 
     void deleteAllByTestPlanId(String testPlanId);

+ 5 - 0
src/main/java/com/rf/psychological/plan/service/impl/TestPlanContendServiceImpl.java

@@ -200,4 +200,9 @@ public class TestPlanContendServiceImpl implements TestPlanContendService {
     public int countContent(String testPlanId) {
         return this.testPlanContendRepository.countContent(testPlanId);
     }
+
+    @Override
+    public List<TestPlanContendEntity> findAllByTestPlanId(String testPlanId) {
+        return testPlanContendRepository.findAllByTestPlanId(testPlanId);
+    }
 }

+ 6 - 0
src/main/java/com/rf/psychological/plan/service/impl/TestPlanUserServiceImpl.java

@@ -50,6 +50,12 @@ public class TestPlanUserServiceImpl implements TestPlanUserService {
         return this.testPlanUserRepository.countByTestPlanId(testId);
     }
 
+    @Override
+    public int countByTestPlanIdAndStructureNo(String planId, String structureNo, String institutionNo) {
+        return testPlanUserRepository.countByTestPlanIdAndStructureNo(planId,structureNo,institutionNo);
+    }
+
+
     @Override
     public Page<TestPlanUserEntity> findTestPlanUserByTestId(String testId, String searchKey, int beginNum, int pageSize) {
         return this.testPlanUserRepository.findAllByTestPlanId(testId, searchKey, PageRequest.of(beginNum - 1, pageSize));

+ 188 - 0
src/main/java/com/rf/psychological/rest/ReportAnalysisController.java

@@ -0,0 +1,188 @@
+package com.rf.psychological.rest;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.rf.psychological.base.rest.BaseController;
+import com.rf.psychological.plan.dao.model.HisTestPlanEntry;
+import com.rf.psychological.plan.dao.model.TestPlanContendEntity;
+import com.rf.psychological.plan.dao.model.TestPlanEntity;
+import com.rf.psychological.plan.service.HisTestPlanService;
+import com.rf.psychological.plan.service.TestPlanContendService;
+import com.rf.psychological.plan.service.TestPlanService;
+import com.rf.psychological.plan.service.TestPlanUserService;
+import com.rf.psychological.scale.dao.model.ScaleMarksEntity;
+import com.rf.psychological.scale.service.ScaleMarksService;
+import com.rf.psychological.scale.service.UserRecordService;
+import com.rf.psychological.security.SafetyProcess;
+import com.rf.psychological.structure.dao.model.StructureEntity;
+import com.rf.psychological.structure.service.StructureService;
+import com.rf.psychological.user.service.UserService;
+import com.rf.psychological.utils.Constant;
+import com.rf.psychological.utils.Result;
+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.data.repository.query.Param;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:报告分析接口
+ * @Author: mimang
+ * @Date: 2024/1/25
+ */
+@Slf4j
+@RestController
+@RequestMapping("/report/analysis")
+@Api(tags = "报告分析")
+public class ReportAnalysisController extends BaseController {
+
+    @Autowired
+    private HisTestPlanService hisTestPlanService;
+
+    @Autowired
+    private TestPlanContendService planContendService;
+
+    @Autowired
+    private ScaleMarksService scaleMarksService;
+
+    @Autowired
+    private UserRecordService userRecordService;
+
+    @Autowired
+    private TestPlanUserService planUserService;
+
+    @Autowired
+    private UserService userService;
+
+    @Autowired
+    private StructureService structureService;
+
+    @GetMapping("/getReportResult")
+    @ApiOperation(value = "获取到该计划下量表及量表评分规则和各规则下人数")
+    @SafetyProcess
+    public Result getReportResult(@Param(value = "planId") String planId,@Param(value = "structureNo") String structureNo){
+        try {
+            List<JSONObject> subjectList = new ArrayList<>();
+            //获取到计划详情
+            HisTestPlanEntry plan = hisTestPlanService.findById(planId);
+            if (plan== null){
+                return fail("计划不存在请确认,请联系管理员");
+            }
+            if (Constant.TEST_PLAN_STATUS_UNSTART == plan.getStatus() || Constant.TEST_PLAN_STATUS_RUNNING== plan.getStatus() ){
+                return fail("计划未结束,暂不支持统计分析");
+            }
+            //获取到计划下关联量表
+            List<TestPlanContendEntity> planContendEntities = planContendService.findAllByTestPlanId(planId);
+            if (CollectionUtils.isEmpty(planContendEntities)){
+                return fail("该计划下无测试内容,请联系管理员");
+            }
+            planContendEntities.forEach(item ->{
+                //循环获取到量表
+                JSONObject subject = new JSONObject();
+                subject.put("name",item.getName());
+                //获取到该量表规则
+                List<ScaleMarksEntity> marksEntities = scaleMarksService.getScaleMarksByFlag(item.getFlag());
+                if (CollectionUtils.isEmpty(marksEntities)){
+                    subject.put("value",null);
+                }
+                List<JSONObject> markList = new ArrayList<>();
+                marksEntities.forEach(mark->{
+                    JSONObject markJson = new JSONObject();
+                    markJson.put("name",mark.getSymptom());
+                    //TODO 获取到结果中该结论数
+                    int value = userRecordService.countByInstitutionNoAndFlagAndConclusion(plan.getInstitutionNo(), mark.getFlag(), mark.getSymptom(),structureNo==null?"%":structureNo+"%");
+                    markJson.put("value",value);
+                    markList.add(markJson);
+                });
+                subject.put("value",markList);
+                subjectList.add(subject);
+            });
+
+            return success(subjectList);
+        }catch (Exception e){
+            log.error(e.getMessage());
+            return fail();
+        }
+    }
+
+    @GetMapping("/getUserNum")
+    @ApiOperation(value = "获取到组织下总人数和参与计划测试人数数")
+    @SafetyProcess
+    public Result getUserNum(@Param(value = "planId") String planId,@Param(value = "structureNo") String structureNo){
+        try {
+            HisTestPlanEntry plan = hisTestPlanService.findById(planId);
+            if (plan== null){
+                return fail("计划不存在请确认,请联系管理员");
+            }
+            //首先获取到计划下参与总人数
+            if (StringUtils.isEmpty(structureNo)){
+                structureNo = "%";
+            }
+            int  planUsers = planUserService.countByTestPlanIdAndStructureNo(planId,structureNo,plan.getInstitutionNo());
+            int  structureUsers = userService.countByStructureNo(plan.getInstitutionNo(),structureNo);
+            Map map = new HashMap();
+            map.put("planUsers",planUsers);
+            map.put("structureUsers",structureUsers);
+            return success(map);
+        }catch (Exception e){
+            log.error(e.getMessage());
+            return fail();
+        }
+    }
+
+    @GetMapping("/getVisResult")
+    @ApiOperation(value = "获取到同级数据")
+    @SafetyProcess
+    public Result getVisResult(@Param(value = "planId") String planId,@Param(value = "structureNo") String structureNo,@Param(value = "flag") String flag){
+        try {
+            List<JSONObject> orgList = new ArrayList<>();
+            HisTestPlanEntry plan = hisTestPlanService.findById(planId);
+            if (plan== null){
+                return fail("计划不存在请确认,请联系管理员");
+            }
+            //首先获取到计划下参与总人数
+            if (StringUtils.isEmpty(structureNo)){
+                return fail("组织编号不能为空");
+            }
+            //获取到子节点
+            List<StructureEntity> child = structureService.getChildByParent(structureNo,plan.getInstitutionNo());
+            if (CollectionUtils.isEmpty(child)){
+                return fail("不存在子节点,请重新选择");
+            }
+            child.forEach(item->{
+                JSONObject org = new JSONObject();
+                org.put("name",item.getStructureName());
+                //获取到该量表规则
+                List<ScaleMarksEntity> marksEntities = scaleMarksService.getScaleMarksByFlag(flag);
+                if (CollectionUtils.isEmpty(marksEntities)){
+                    org.put("value",null);
+                }
+                List<JSONObject> markList = new ArrayList<>();
+                marksEntities.forEach(mark->{
+                    JSONObject markJson = new JSONObject();
+                    markJson.put("name",mark.getSymptom());
+                    //TODO 获取到结果中该结论数
+                    int value = userRecordService.countByInstitutionNoAndFlagAndConclusion(plan.getInstitutionNo(), mark.getFlag(), mark.getSymptom(),item.getStructureNo()+"%");
+                    markJson.put("value",value);
+                    markList.add(markJson);
+                });
+                org.put("value",markList);
+                orgList.add(org);
+            });
+            return success(orgList);
+        }catch (Exception e){
+            log.error(e.getMessage());
+            return fail();
+        }
+    }
+}

+ 2 - 8
src/main/java/com/rf/psychological/rest/ServerController.java

@@ -522,10 +522,7 @@ public class ServerController extends BaseController {
         if (pageSize == 0) {
             pageSize = 20;
         }
-        //游客用户无id,数据库配置特定用户
-        if (StringUtils.isEmpty(uId)){
-            uId = Constant.PUBLIC_VISITOR_ID;
-        }
+
         int num;
         List<CognitiveTaskEntity> cognitiveTaskEntityList = new ArrayList<>();
         UserEntity one = userService.getOne(uId);
@@ -577,10 +574,7 @@ public class ServerController extends BaseController {
         if (pageSize == 0) {
             pageSize = 20;
         }
-        //游客用户无id,数据库配置特定用户
-        if (StringUtils.isEmpty(uId)){
-            uId = Constant.PUBLIC_VISITOR_ID;
-        }
+
         Long num;
         System.out.println(pageNum + "-----------" + pageSize + "-----------" + categoryEname + "-----------" + institutionNo + "---------" + scaleName);
         List<SubjectEntity> subjectEntityList = new ArrayList<>();

+ 3 - 0
src/main/java/com/rf/psychological/scale/dao/model/UserRecordEntity.java

@@ -47,6 +47,9 @@ public class UserRecordEntity extends BaseEntity {
     @Column(name = "test_results", columnDefinition = "text comment '测试结果(String类型)'")
     private String testResults;
 
+    @Column(name = "conclusion", columnDefinition = "varchar(50) comment '测试结果结论'")
+    private String conclusion;
+
     @Column(name = "file_name", columnDefinition = "varchar(255) comment '测试结果文件名称'")
     private String fileName;
 

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

@@ -247,6 +247,9 @@ public interface UserRecordRepository extends BaseRepository<UserRecordEntity, S
             "where tur.id= :id ", nativeQuery = true)
     InstitutionRecordingUsersDTO getRecordingUsersDTOById(@Param("id") String id);
 
+    @Query(value = "select count(1) FROM t_user_record ur where ur.institution_no =:institutionNo and ur.flag = :flag and ur.conclusion =:conclusion and ur.phone in (SELECT phone FROM t_user_info u where u.institution_no =:institutionNo and u.structure_no like :structureNo )",nativeQuery = true)
+    int countByInstitutionNoAndFlagAndConclusion(@Param("institutionNo") String institutionNo, @Param("flag")String flag, @Param("conclusion")String conclusion, @Param("structureNo")String structureNo);
+
     //    @Query(value = "SELECT  new com.rf.psychological.dao.model.ReturnEntity(a.flag,COUNT(a.flag)) FROM t_user_record  a WHERE a.flag IN ('RIVEN','GO_NO-GO','MEMORY','ALERTNESS','ADDITION') GROUP BY a.flag",nativeQuery=true)
     /*@Query(value="select  new com.rf.psychological.dao.model.ReturnEntity(r.flag,COUNT(r.flag))  from t_user_record as r  where r.flag in ('RIVEN','GO_NO-GO','MEMORY','ALERTNESS','ADDITION')   GROUP BY r.flag",nativeQuery = true)
     List<ReturnEntity> testAmount();*/

+ 7 - 10
src/main/java/com/rf/psychological/scale/rest/WebScaleResultController.java

@@ -119,8 +119,6 @@ public class WebScaleResultController extends BaseController {
         if(userEntity == null){
             return fail("用户不存在");
         }
-        //UserEntity userEntity = (UserEntity) session.getAttribute("userEntity");
-        //System.out.println("userEntity:"+userEntity);
         String userName = userEntity.getPetName();
         String userBirthday = userEntity.getBirthday();
         String userSex = userEntity.getGender();
@@ -148,9 +146,6 @@ public class WebScaleResultController extends BaseController {
             //更新测试计划状态
             updateUserPlanStatus(testPlanId,institutionNo,phone,flag, userEntity.getId(),testPlanContendService,testPlanUserService);
         }
-
-
-
         String testTime = new SimpleDateFormat("yyyy年MM月dd日HH时mm分ss秒").format(new Date());
         if (jsonObject.containsKey("startTime")) {
             testTime = new SimpleDateFormat("yyyy年MM月dd日HH时mm分ss秒").format(jsonObject.getDate("startTime"));
@@ -261,11 +256,9 @@ public class WebScaleResultController extends BaseController {
             row.put("value", colValue);
             tableContext.add(row);
         }
-
         dbJson.put("tableContext", tableContext);
-
         dbJsonList.add(dbJson);
-
+        String conclusion=null;
         //测试记录
         int i = 1;
         // 获取第一层每个key对应的值 的类型
@@ -275,19 +268,22 @@ public class WebScaleResultController extends BaseController {
             } else {
                 testResult += key + ":" + resultJson.get(key) + ";";
             }
+            if ( key.equals("总分症状")){
+                conclusion = resultJson.get(key).toString();
+            }
             i++;
         }
         String filePath;
         filePath = "./心理检测/检测结果/" + new SimpleDateFormat("yyyy-MM-dd").format(new Date()) + "/" + subjectEntities.get(0).getName() + "/" + fileName;
         System.out.println("resultJson:" + resultJson);
-        UserRecordEntity userRecordEntity = testRecord(flag, phone, institutionNo, testTime, filePath, JSON.toJSONString(dbJsonList, SerializerFeature.DisableCircularReferenceDetect), subjectEntities.get(0).getName(), JSON.toJSONString(dataList, SerializerFeature.DisableCircularReferenceDetect), testResult, testPlanId);
+        UserRecordEntity userRecordEntity = testRecord(flag, phone, institutionNo, testTime, filePath, JSON.toJSONString(dbJsonList, SerializerFeature.DisableCircularReferenceDetect), subjectEntities.get(0).getName(), JSON.toJSONString(dataList, SerializerFeature.DisableCircularReferenceDetect), testResult, testPlanId,conclusion);
 
         return success(userRecordEntity.getId(),"完成");
 
     }
 
 
-    private UserRecordEntity testRecord(String flag, String phone, String institutionNo, String testTime, String fileName, String testResult, String name, String dataList, String testResults, String testPlanId) {
+    private UserRecordEntity testRecord(String flag, String phone, String institutionNo, String testTime, String fileName, String testResult, String name, String dataList, String testResults, String testPlanId, String conclusion) {
         //根据flag记录测试数
         this.subjectService.addTestNum(flag);
         //添加用户测试记录
@@ -301,6 +297,7 @@ public class WebScaleResultController extends BaseController {
         userRecordEntity.setFileName(fileName);
         userRecordEntity.setName(name);
         userRecordEntity.setTestRecord(dataList);
+        userRecordEntity.setConclusion(conclusion);
         userRecordEntity.setTestResults(testResults);
         if (testPlanId == null || testPlanId.equals("")) {
             userRecordEntity.setTestPlanId("0");

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

@@ -68,6 +68,8 @@ public interface UserRecordService {
      */
     int countByPhoneAndType(String phone, String type, String beginTime, String endTime, String institutionNo);
 
+    int countByInstitutionNoAndFlagAndConclusion(String institutionNo,String flag,String conclusion,String structureNo );
+
     /**
      * 根据手机号查询用户测试记录总条数
      *

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

@@ -193,6 +193,12 @@ public class UserRecordServiceImpl implements UserRecordService {
         return this.userRecordRepository.countByPhoneAndType(phone, institutionNo, type, beginTime, endTime);
     }
 
+    @Override
+    public int countByInstitutionNoAndFlagAndConclusion(String institutionNo, String flag, String conclusion, String structureNo) {
+        return userRecordRepository.countByInstitutionNoAndFlagAndConclusion(institutionNo,flag,conclusion, structureNo);
+    }
+
+
     /**
      * 根据手机号查询用户测试记录总条数
      *

+ 1 - 1
src/main/java/com/rf/psychological/threadpool/ThreadTask.java

@@ -21,6 +21,6 @@ public class ThreadTask implements Runnable{
     }
     public void run() {
         //输出执行线程的名称
-        SendMessageUtil.planMessage(jsonObject);
+       // SendMessageUtil.planMessage(jsonObject);
     }
 }

+ 3 - 0
src/main/java/com/rf/psychological/user/dao/repository/UserRepository.java

@@ -201,4 +201,7 @@ public interface UserRepository extends BaseRepository<UserEntity, String> {
     List<UserEntity> findByStructureNo(String structureNo);
     @Query(value="select * from t_user_info where institution_no =:institutionNo and role_type =3 and phone !=:phone" ,nativeQuery = true)
     Page<UserEntity> findAdmin(@Param("institutionNo") String institutionNo, @Param("phone") String phone, Pageable pageable);
+
+    @Query(value="select count(1) from t_user_info where institution_no =:institutionNo and role_type =1 and structure_no like:structureNo" ,nativeQuery = true)
+    int countByStructureNo(@Param("institutionNo")String institutionNo, @Param("structureNo")String structureNo);
 }

+ 2 - 0
src/main/java/com/rf/psychological/user/service/UserService.java

@@ -228,4 +228,6 @@ public interface UserService {
     Page findUserByStructureNo(int pageNum, int pageSize, String institutionNo, String structureNo);
 
     Page<UserEntity> findAdmin(int pageNum, int pageSize, String institutionNo,String phone);
+
+    int countByStructureNo(String institutionNo, String structureNo);
 }

+ 5 - 0
src/main/java/com/rf/psychological/user/service/impl/UserServiceImpl.java

@@ -355,6 +355,11 @@ public class UserServiceImpl implements UserService {
         return userRepository.findAdmin(institutionNo,phone,PageRequestUtil.of(pageNum,pageSize));
     }
 
+    @Override
+    public int countByStructureNo(String institutionNo, String structureNo) {
+        return userRepository.countByStructureNo(institutionNo,structureNo);
+    }
+
 
     /**
      * 改变用户状态

+ 17 - 148
src/main/java/com/rf/psychological/utils/Constant.java

@@ -65,23 +65,6 @@ public class Constant {
      */
     public static final String QUESTION_TYPE_TWO ="2";
 
-    /**
-     * 公网版配置文件名称
-     */
-    public static final String PROFILE_PUBLIC = "public";
-
-
-    /**
-     * 游客固定用户id
-     */
-    public static final String PUBLIC_VISITOR_ID = "pub001-visitor";
-
-
-    /**
-     * 安装包名称
-     **/
-    public static final String APK_NAME = "app-release.apk";
-
     /**
      * 测试计划状态  测试状态:0--已关闭,1---手动关闭,2----未开始,3---进行中
      */
@@ -90,13 +73,6 @@ public class Constant {
     public static final int TEST_PLAN_STATUS_UNSTART = 2;
     public static final int TEST_PLAN_STATUS_RUNNING = 3;
 
-    /**fifteen
-     * 测试计划状态  测试状态:0--已关闭,1---手动关闭,2----未开始,3---进行中
-     */
-    public static final int NUMBER_FIVE = 5;
-
-    public static final int NUMBER_FIFTEEN = 15;
-
     /**
      * 生理信号内容
      * 类型:1为脉搏;2为心电;3为脑电
@@ -117,56 +93,27 @@ public class Constant {
     public static final String USER_STATUS_UNAUDITED = "1";
     public static final String USER_STATUS_NORMAL = "2";
 
-    /**
-     * 短信相关
-     */
-    /**
-     *JM
-     */
-    /*public static int appId = 1400555402;   //短信应用SDK AppID 1400开头
-    public static String appKey = "197596018c4565ad023c2b145f4069a1";   //短信应用SDK AppKey
-    public static String smsSign = "北京决明科技";    //签名 NOTE: 这里的签名"腾讯云"只是一个示例,真实的签名需要在短信控制台中申请,另外签名参数使用的是`签名内容`,而不是`签名ID`
-    public static int templateId = 1064633; //短信模板ID,需要在短信应用中申请 NOTE: 这里的模板ID`7839`只是一个示例,真实的模板ID需要在短信控制台中申请*/
-    /**
-     *HD
-     */
-    public static int appId = 1400863104;
-    public static String appKey = "ff6f89586c9d9adb0fc201536bfe3de9";
-    public static String smsSign = "河南红朵科技";
-    public static int templateId = 1966205;
+
 
     /** 默认分组的名称  **/
     public static final String DEFAULT_GROUP_NAME = "默认分组";
-    /** 朴拙设备唯一标识  **/
-    //public static final String DEFAULT_PZ_UUID = "1cccbc5d7ec1496693ee0d00550033a2211f579fe3c6bf5db2213b813dad31b3";
-    public static final String DEFAULT_PZ_UUID = "a50cc73bb252958435bd5a7645eecfec";
-    public static final String DEFAULT_REGISTRY_PATH = "SOFTWARE\\Microsoft\\Cryptography";
-    public static final String DEFAULT_REGISTRY_KEY = "MachineGuid";
+
 
     /**
      * 默认密码
      */
     public static final String DEFAULT_PASSWORD = "123456";
-/**测试类型 匹茨堡睡眠质量指数**/
-//public static final String QUEST_TYPE_PSQI="PSQI";
-/**测试类型 心境状态量表POMS**/
-//public static final String QUEST_TYPE_POMS = "POMS";
+
     /**
      * 测试类型症状自评量表(SCL-90)
      **/
     public static final String QUEST_TYPE_SCL = "SCL";
-    /**
-     * 艾森克人格量表
-     **/
-    public static final String QUEST_TYPE_ASK = "ASK";
+
     /**
      * 汉化版美国航空航天局任务负荷指数量表
      **/
     public static final String QUEST_TYPE_AVAI = "AVIA";
-    /**
-     * 社会支持评定量表
-     **/
-    public static final String QUEST_TYPE_SUPP = "SUPP";
+
     /**
      * 抑郁焦虑压力量表
      **/
@@ -175,14 +122,6 @@ public class Constant {
      * 正性负性情绪量表
      **/
     public static final String QUEST_TYPE_MOOD = "MOOD";
-    /**
-     * 状态-特质焦虑量表
-     **/
-    public static final String QUEST_TYPE_STATUS = "STATUS";
-    /**
-     * 生活事件量表
-     **/
-    public static final String QUEST_TYPE_LIFE = "LIFE";
     /**
      * 瑞文智力测试
      **/
@@ -191,10 +130,7 @@ public class Constant {
      * Go/No-go冲动抑制测试
      **/
     public static final String QUEST_TYPE_GO_NO_GO = "GO_NO-GO";
-    /**
-     * Go/No-go冲动抑制测试(成瘾版)
-     **/
-    public static final String QUEST_TYPE_GO_NO_GO_ADDICTION = "GO_NO-GO_ADDICTION";
+
     /**
      * 工作记忆能力测试(字母记忆)
      **/
@@ -207,14 +143,7 @@ public class Constant {
      * 精神运动警觉度测试
      **/
     public static final String QUEST_TYPE_ALERTNESS = "ALERTNESS";
-    /**
-     * 精神运动警觉度测试(儿童版)
-     **/
-    public static final String QUEST_TYPE_ALERTNESS_CHILD = "ALERTNESS_CHILD";
-    /**
-     * 精神运动警觉度测试(成瘾版)
-     **/
-    public static final String QUEST_TYPE_ALERTNESS_ADDICTION = "ALERTNESS_ADDICTION";
+
     /**
      * 游戏4
      **/
@@ -231,15 +160,7 @@ public class Constant {
      * 形状知觉测试(自上而下)
      **/
     public static final String QUEST_TYPE_SHAPE = "SHAPE";
-    /**
-     * 形状知觉测试(随机)
-     **/
-    public static final String QUEST_TYPE_SHAPE_RANDOM = "SHAPE_RANDOM";
 
-    /**
-     * 形状知觉测试儿童版
-     */
-    public static final String QUEST_TYPE_SHAPE_CHILD = "SHAPE_CHILD";
     /**
      * 游戏2
      **/
@@ -256,10 +177,7 @@ public class Constant {
      * 运动知觉测试
      **/
     public static final String QUEST_TYPE_MOVEMENT = "MOVEMENT";
-    /**
-     * 运动知觉测试儿童版
-     **/
-    public static final String QUEST_TYPE_MOVEMENT_CHILD = "MOVEMENT_CHILD";
+
     /**
      * 注意力网络测试
      **/
@@ -276,10 +194,7 @@ public class Constant {
      * 注意力网络测试(儿童版)
      **/
     public static final String QUEST_TYPE_ANT_FISH = "ANTFISH";
-    /**
-     * 注意力网络测试(儿童版)V2
-     **/
-    public static final String QUEST_TYPE_ANT_FISH_V2 = "ANTFISH_V2";
+
     /**
      * 画钟测试
      **/
@@ -288,74 +203,32 @@ public class Constant {
      * 蒙特利尔认知评估量表(MoCA)
      **/
     public static final String QUEST_TYPE_MOCA = "MOCA";
-    /**
-     * 蒙特利尔认知评估量表-(定制版)
-     **/
-    public static final String QUEST_TYPE_MOCAV3 = "MOCAV3";
-    /**
-     * 蒙特利尔认知评估量表V4
-     **/
-    public static final String QUEST_TYPE_MOCAV4 = "MOCAV4";
-    /**
-     * 蒙特利尔认知评估量表V2
-     **/
-    public static final String QUEST_TYPE_MOCA_v2 = "MOCA_v2";
+
     /**
      * 简易精神状态测试
      **/
     public static final String QUEST_TYPE_MMSE = "MMSE";
-    /**
-     * 简易精神状态测试-(定制版)
-     **/
-    public static final String QUEST_TYPE_MMSEV3 = "MMSEV3";
-    /**
-     * 简易精神状态测试V2
-     **/
-    public static final String QUEST_TYPE_MMSE_V2 = "MMSE_V2";
+
     /**
      * 听觉测试
      **/
     public static final String QUEST_TYPE_BIC = "BIC";
-    /**
-     * 听觉测试(开发版)
-     **/
-    public static final String QUEST_TYPE_BIC_V2 = "BIC_V2";
+
     /**
      * 综合记忆能力测试(旧版)
      **/
     public static final String QUEST_TYPE_RTC = "RTC";
-    /**
-     * 综合记忆能力测试
-     **/
-    public static final String QUEST_TYPE_RTC_CHILD = "RTC_CHILD";
+
     /**
      * 工作记忆能力测试(空间记忆)
      **/
     public static final String QUEST_TYPE_MEMORYT = "MemoryTest";
-    /**
-     * 工作记忆能力测试(空间记忆)2
-     **/
-    public static final String QUEST_TYPE_MEMORYT2 = "MemoryTestChildren";
-    /**
-     * 工作记忆能力测试(空间记忆)3
-     **/
-    public static final String QUEST_TYPE_MEMORYTV3 = "MemoryTestV3";
+
     /**
      * 目标追踪测试
      **/
     public static final String QUEST_TYPE_GTCT = "GTCT";
-    /**
-     * 目标追踪测试
-     */
-    public static final String QUEST_TYPE_GTCT_CHILD = "CHILD";
-    /**
-     * 多目标追踪(儿童版)
-     */
-    public static final String QUEST_TYPE_MTT_CHILD = "MTT_CHILD";
-    /**
-     * 多目标追踪(训练版)
-     */
-    public static final String QUEST_TYPE_MTT = "MTT";
+
 
     /**
      * Go/No-go冲动抑制测试(高级版)
@@ -492,8 +365,7 @@ public class Constant {
 
     public static final String SHEET_NAME_GO_NO_GO2 = "Go_No-go冲动抑制测试(高级版)";
     public static final String SHEET_NAME_ALERTNESS = "精神运动警觉度测试";
-    public static final String SHEET_NAME_ALERTNESS_CHILD = "精神运动警觉度测试(儿童版)";
-    public static final String SHEET_NAME_ALERTNESS_ADDICTION = "精神运动警觉度测试(成瘾版)";
+
     public static final String SHEET_NAME_ALERTNESS_YATAI = "游戏4";
     public static final String SHEET_NAME_ADDITION = "连续加法测试";
     public static final String SHEET_NAME_CATTELL = "卡氏十六种人格因素量表";
@@ -555,10 +427,7 @@ public class Constant {
 
 
 /** 基础常量 工作记忆能力测试 **/
-    /**
-     * 每种任务的组块数
-     **/
-    public static int GROUP_COUNT = 6;
+
     /**
      * 每个组块的字母个数
      **/

+ 31 - 32
src/main/java/com/rf/psychological/utils/SendMessageUtil.java

@@ -72,37 +72,37 @@ public class SendMessageUtil {
     /**
      * 测试计划短信提醒
      */
-    public static void planMessage(JSONObject resultJson) {
-        try {
-            // 数组具体的元素个数和模板中变量个数必须一致
-            // 比如你模板中需要填写验证码和有效时间,{1},{2}
-            // 那你这里的参数就应该填两个
-            //String[] params = {strTemp , "5"};
-            String[] params = {resultJson.getString("userName"),DateUtil.getDateStr(resultJson.getDate("beginTime"),DateUtil.DEFAULT_DATE),DateUtil.getDateStr(resultJson.getDate("endTime"),DateUtil.DEFAULT_DATE)};
-            SmsSingleSender ssender = new SmsSingleSender(Constant.appId, Constant.appKey);
-
-            // 签名参数未提供或者为空时,会使用默认签名发送短信
-            SmsSingleSenderResult result = ssender.sendWithParam("86", resultJson.getString("phone"), 1401718, params, Constant.smsSign, "", "");
-            JSONObject jsonObject = JSONObject.parseObject(result.toString());
-            String errorMsg = jsonObject.getString("errmsg");
-            if(errorMsg.equals("OK")){
-                log.info(resultJson.getString("phone")+"发送完成");
-            }else {
-                log.info(Utils.unicodeDecode(errorMsg));
-            }
-            System.out.println(resultJson.getString("phone")+"-result = " + result);
-
-        } catch (HTTPException e1) {
-            // HTTP响应码错误
-            e1.printStackTrace();
-        } catch (JSONException e2) {
-            // json解析错误
-            e2.printStackTrace();
-        } catch (IOException e3) {
-            // 网络IO错误
-            e3.printStackTrace();
-        }
-    }
+//    public static void planMessage(JSONObject resultJson) {
+//        try {
+//            // 数组具体的元素个数和模板中变量个数必须一致
+//            // 比如你模板中需要填写验证码和有效时间,{1},{2}
+//            // 那你这里的参数就应该填两个
+//            //String[] params = {strTemp , "5"};
+//            String[] params = {resultJson.getString("userName"),DateUtil.getDateStr(resultJson.getDate("beginTime"),DateUtil.DEFAULT_DATE),DateUtil.getDateStr(resultJson.getDate("endTime"),DateUtil.DEFAULT_DATE)};
+//            SmsSingleSender ssender = new SmsSingleSender(Constant.appId, Constant.appKey);
+//
+//            // 签名参数未提供或者为空时,会使用默认签名发送短信
+//            SmsSingleSenderResult result = ssender.sendWithParam("86", resultJson.getString("phone"), 1401718, params, Constant.smsSign, "", "");
+//            JSONObject jsonObject = JSONObject.parseObject(result.toString());
+//            String errorMsg = jsonObject.getString("errmsg");
+//            if(errorMsg.equals("OK")){
+//                log.info(resultJson.getString("phone")+"发送完成");
+//            }else {
+//                log.info(Utils.unicodeDecode(errorMsg));
+//            }
+//            System.out.println(resultJson.getString("phone")+"-result = " + result);
+//
+//        } catch (HTTPException e1) {
+//            // HTTP响应码错误
+//            e1.printStackTrace();
+//        } catch (JSONException e2) {
+//            // json解析错误
+//            e2.printStackTrace();
+//        } catch (IOException e3) {
+//            // 网络IO错误
+//            e3.printStackTrace();
+//        }
+//    }
 
     public static void main(String[] args) {
         JSONObject jsonObject = new JSONObject();
@@ -111,7 +111,6 @@ public class SendMessageUtil {
         jsonObject.put("beginTime","20202020");
         jsonObject.put("endTime","20202020");
 
-        planMessage(jsonObject);
     }
 
 }