hurixing 1 year ago
parent
commit
323a87fab3

+ 45 - 0
hcp-app/src/main/java/com/yingyangfly/app/controller/UploadFileController.java

@@ -12,7 +12,9 @@ import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  *
@@ -59,6 +61,49 @@ public class UploadFileController {
     }
 
 
+    /**
+     * 通用上传
+     * file 是文件
+     * dirName 是文件夹
+     */
+    @Log(title = "文件上传",operatorType = OperatorType.MOBILE)
+    @PostMapping("/uploadList")
+    @ApiOperation("文件上传")
+    public ResultResponse uploadList(@RequestParam("files") MultipartFile [] files, @RequestParam("dirName") String dirName) {
+        if (files == null || files.length == 0) {
+            return ResultResponse.fail("文件不能为空");
+        }
+
+        Map<String, String> fileUrls = new HashMap<>();
+        for (int i = 0; i < files.length; i++) {
+            MultipartFile file = files[i];
+            if (file.isEmpty()) {
+                return ResultResponse.fail("第 " + (i + 1) + " 个文件为空");
+            }
+
+            String fileName = file.getOriginalFilename();
+            if (fileName == null) {
+                return ResultResponse.fail("第 " + (i + 1) + " 个文件名为空");
+            }
+
+            // 获取文件后缀
+            String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
+            // 检查文件类型是否允许
+            if (!ALLOWED_FILE_TYPES.contains(fileExtension)) {
+                return ResultResponse.fail("第 " + (i + 1) + " 个文件类型不允许: " + fileExtension);
+            }
+
+            // 上传文件并获取地址
+            String uploadUrl = fileClient.upload(file, dirName);
+            String key = fileName.substring(0, fileName.lastIndexOf("."));
+
+            fileUrls.put(key, uploadUrl); // 使用文件名作为键
+        }
+
+        return ResultResponse.success(fileUrls);
+    }
+
+
     @GetMapping("/hertz/audio")
     public ResultResponse getHertzAudioUrl(){
         return ResultResponse.success("https://yaorongoss.yaorongmedical.com/dabeizhou_40hz.mp3");

+ 3 - 0
hcp-core/src/main/java/com/yingyangfly/core/domain/LearningPackage.java

@@ -98,6 +98,9 @@ public class LearningPackage implements Serializable {
         if("D".equals(getTimeType())){
            return 365;
         }
+        if ("E".equals(getTimeType())){
+            return 7;
+        }
         return 0;
     }
 

+ 7 - 0
hcp-core/src/main/java/com/yingyangfly/core/domain/ReviewRecord.java

@@ -1,5 +1,6 @@
 package com.yingyangfly.core.domain;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import lombok.Data;
 
 import java.util.Date;
@@ -34,4 +35,10 @@ public class ReviewRecord {
 
     private String orgName;
 
+    @TableField(exist = false)
+    private String viewType;
+
+    @TableField(exist = false)
+    private String type;
+
 }

+ 3 - 0
hcp-core/src/main/java/com/yingyangfly/core/domain/ReviewTask.java

@@ -40,4 +40,7 @@ public class ReviewTask extends BaseEntity {
     @TableField(exist = false)
     List<String> scaleNameList;
 
+    @TableField(exist = false)
+    private Integer totalPoints;
+
 }

+ 64 - 0
hcp-core/src/main/java/com/yingyangfly/core/dto/AppUserDto.java

@@ -0,0 +1,64 @@
+package com.yingyangfly.core.dto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.yingyangfly.core.util.Sm4JacksonSerialize;
+import lombok.Data;
+
+@Data
+public class AppUserDto {
+
+    private Long id;
+
+    private String name;
+
+    private Integer age;
+
+    @JsonSerialize(using = Sm4JacksonSerialize.class)
+    private String mobile;
+
+    @JsonSerialize(using = Sm4JacksonSerialize.class)
+    private String idCard;
+
+    private String birthDate;
+
+    private String diagnoseResult;
+
+    private String  education;
+
+    private Long equipmentPledge;
+
+    @TableField(exist = false)
+    private String equipmentPledgeYUAN;
+
+    private String gender;
+
+    private String geneticDiseases;
+
+
+
+    private String medicalCurrentTypes;
+
+    private String medicalHisTypes;
+
+    private Long    doctorId;
+    private String doctorName;
+
+    private Long   hospitalDepartment;
+    @TableField(exist = false)
+    private String    hospitalDepartmentName;
+
+    private String padNo;
+
+    private String mentorRemark;
+    //指导人电话
+    private String mentorMobile;
+
+    private String mentor;
+
+    private String occupation;
+
+    private String tags;
+
+    private String patientSource;
+}

+ 4 - 0
hcp-core/src/main/java/com/yingyangfly/core/mapper/ReviewRecordMapper.java

@@ -3,8 +3,12 @@ package com.yingyangfly.core.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.yingyangfly.core.domain.ReviewRecord;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 
 @Mapper
 public interface ReviewRecordMapper extends BaseMapper<ReviewRecord> {
 
+    @Select("SELECT COALESCE(SUM(score), 0) AS totalPoints FROM review_record WHERE review_task_id = #{reviewTaskId}")
+    Integer getTotalPointsByReviewTaskId(@Param("reviewTaskId") String reviewTaskId);
 }

+ 4 - 4
hcp-core/src/main/java/com/yingyangfly/core/recommend/RecommendFacade.java

@@ -388,12 +388,12 @@ public class RecommendFacade {
         // 用户认知障碍 标签
         List<String> tagLsis = Arrays.stream(tags.split(",")).collect(Collectors.toList());
         // 获取游戏难度
-        String difficultyLevel = difficultyLevel(appUser);
+//        String difficultyLevel = difficultyLevel(appUser);
         // 获取游戏
         for (String tag : tagLsis) {
             LambdaQueryWrapper<Game> gameLambdaQueryWrapper = new LambdaQueryWrapper<>();
             gameLambdaQueryWrapper.eq(Game::getGameType,tag);
-            gameLambdaQueryWrapper.eq(Game::getGameDifficulty,difficultyLevel);
+//            gameLambdaQueryWrapper.eq(Game::getGameDifficulty,difficultyLevel);
             List<Game> list = gameService.list(gameLambdaQueryWrapper);
             // 大于等于4时去掉上次推荐的游戏
             if (list.size() >= 4){
@@ -444,11 +444,11 @@ public class RecommendFacade {
         List<Game> gameList = new ArrayList<>();
         List<String> tagList = Arrays.stream(tags.split(",")).collect(Collectors.toList());
         // 获取游戏难度
-        String difficultyLevel = difficultyLevel(appUser);
+//        String difficultyLevel = difficultyLevel(appUser);
 
         // 获取所以游戏 并按认知域进行划分
         LambdaQueryWrapper<Game> gameLambdaQueryWrapper = new LambdaQueryWrapper<>();
-        gameLambdaQueryWrapper.eq(Game::getGameDifficulty,difficultyLevel);
+//        gameLambdaQueryWrapper.eq(Game::getGameDifficulty,difficultyLevel);
         List<Game> games = gameService.list(gameLambdaQueryWrapper);
         Map<String, List<Game>> typeToGameMap = games.stream().collect(Collectors.groupingBy(Game::getGameType));
 

+ 2 - 0
hcp-core/src/main/java/com/yingyangfly/core/service/ReviewService.java

@@ -24,5 +24,7 @@ public interface ReviewService extends IService<Review> {
     Map<String, Object> findReviewResult(ReviewRecord reviewRecord);
 
     List<Map<String, Object>> findReviewResultDetail(ReviewRecord reviewRecord);
+
+    Map<String,Object> printReviewResultDetail(ReviewRecord reviewRecord);
 }
 

+ 1 - 1
hcp-core/src/main/java/com/yingyangfly/core/service/impl/AppUserService.java

@@ -640,7 +640,7 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
             redisClient.set("hcp:mobile:" + mobile, random, 300);
             return ResultResponse.success(true);
         } else {
-            return ResultResponse.fail("发送异常");
+            return ResultResponse.fail("请不要频繁发送验证码");
         }
 
     }

+ 87 - 0
hcp-core/src/main/java/com/yingyangfly/core/service/impl/ReviewServiceImpl.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.yingyangfly.common.utils.DateUtils;
 import com.yingyangfly.core.domain.*;
 import com.yingyangfly.core.dto.AppCurrentLoginUser;
+import com.yingyangfly.core.dto.CurrentLoginUser;
 import com.yingyangfly.core.enums.GameTypeEnums;
 import com.yingyangfly.core.mapper.AppUserMapper;
 import com.yingyangfly.core.mapper.ReviewMapper;
@@ -18,7 +19,9 @@ import com.yingyangfly.core.service.GameTaskService;
 import com.yingyangfly.core.service.ReviewService;
 import com.yingyangfly.core.util.DateUtil;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.jacoco.agent.rt.internal_035b120.core.internal.flow.IFrame;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.authentication.BadCredentialsException;
 import org.springframework.stereotype.Service;
@@ -316,6 +319,90 @@ public class ReviewServiceImpl extends ServiceImpl<ReviewMapper, Review> impleme
         return returnList;
     }
 
+    @Override
+    public Map<String, Object> printReviewResultDetail(ReviewRecord reviewRecord) {
+        Map<String,Object> map =  new HashMap<>();
+
+        LambdaQueryWrapper<ReviewTask> taskLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        taskLambdaQueryWrapper.eq(ReviewTask::getUserId,reviewRecord.getUserId());
+        taskLambdaQueryWrapper.eq(ReviewTask::getType,reviewRecord.getType());
+        taskLambdaQueryWrapper.isNotNull(ReviewTask::getReviewTime);
+        taskLambdaQueryWrapper.eq(ReviewTask::getStatus ,"1");
+        taskLambdaQueryWrapper.orderByDesc(ReviewTask::getReviewTime);
+        taskLambdaQueryWrapper.last("LIMIT 7");
+        List<ReviewTask> reviewTasks = reviewTaskMapper.selectList(taskLambdaQueryWrapper);
+        for (ReviewTask reviewTask : reviewTasks) {
+            Integer totalPointsByReviewTaskId = 0;
+            if (reviewRecord.getType().equals("MMSE")){
+                totalPointsByReviewTaskId = reviewRecordMapper.getTotalPointsByReviewTaskId(String.valueOf(reviewTask.getId()));
+            }else {
+                LambdaQueryWrapper<ReviewRecord> recordLambdaQueryWrapper = new LambdaQueryWrapper<>();
+                recordLambdaQueryWrapper.eq(ReviewRecord::getReviewTaskId,String.valueOf(reviewTask.getId()));
+                List<ReviewRecord> reviewRecords = reviewRecordMapper.selectList(recordLambdaQueryWrapper);
+                totalPointsByReviewTaskId = getI(reviewRecords);
+            }
+            reviewTask.setTotalPoints(totalPointsByReviewTaskId);
+        }
+        map.put("reviewTasks",reviewTasks);
+
+        LambdaQueryWrapper<ReviewRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+        lambdaQueryWrapper.eq(ReviewRecord::getReviewTaskId,reviewRecord.getReviewTaskId());
+        List<ReviewRecord> reviewRecordList = reviewRecordMapper.selectList(lambdaQueryWrapper);
+        Map<Long,Integer> reviewIdScoreMap = new HashMap<>();
+        // 得分
+        Integer totalPoints = 0;
+        for (ReviewRecord reviewRecord1 : reviewRecordList) {
+            Review review = reviewMapper.selectById(reviewRecord1.getReviewId());
+            reviewRecord1.setViewType(review.getViewType());
+            reviewRecord1.setType(review.getType());
+            if (ObjectUtils.isNotEmpty(reviewRecord1.getScore())){
+                totalPoints = totalPoints+Integer.parseInt(reviewRecord1.getScore());
+                reviewIdScoreMap.put(reviewRecord1.getReviewId(),Integer.parseInt(reviewRecord1.getScore()));
+            }
+            if (reviewRecord.getType().equals("MMSE")){
+                if (reviewRecord1.getReviewId()==30L){
+                    if (ObjectUtils.isNotEmpty(reviewRecord1.getReviewAnswer())){
+                        map.put("url1",reviewRecord1.getReviewAnswer());
+                    }
+                }
+            }else {
+                if (reviewRecord1.getReviewId()==33L){
+                    if (ObjectUtils.isNotEmpty(reviewRecord1.getReviewAnswer())){
+                        map.put("url1",reviewRecord1.getReviewAnswer());
+                    }
+                }
+                if (reviewRecord1.getReviewId()==38L){
+                    if (ObjectUtils.isNotEmpty(reviewRecord1.getReviewAnswer())){
+                        map.put("url2",reviewRecord1.getReviewAnswer());
+                    }
+                }
+            }
+        }
+        map.put("reviewIdScoreMap",reviewIdScoreMap);
+        map.put("reviewRecordList",reviewRecordList);
+        // 认知域 得分
+        Map<String, Integer> scoreSumByViewType = reviewRecordList.stream()
+                .collect(Collectors.groupingBy(
+                        ReviewRecord::getViewType, // 按 viewType 分组
+                        Collectors.summingInt(record -> Integer.parseInt(record.getScore())) // 将 score 转换为 int 并求和
+                ));
+
+        map.put("scoreSumByViewType",scoreSumByViewType);
+
+        // 总得分
+        if (reviewRecord.getType().equals("MMSE")){
+            map.put("totalPoints",totalPoints);
+        }else {
+            map.put("totalPoints",getI(reviewRecordList));
+        }
+
+
+        CurrentLoginUser currentUser = tokenUtil.getCurrentUser();
+        // 所属医院
+        map.put("orgName",currentUser.getOrgName());
+        return map;
+    }
+
     /**
      * 获取每一条数据得分
      * @param reviewRecords

+ 3 - 3
hcp-core/src/main/java/com/yingyangfly/core/util/SmgUtil.java

@@ -32,9 +32,9 @@ public class SmgUtil {
         return new Client(config);
     }
 
-//    public static void main(String[] args) {
-//        sendCheckCode("18973335480","SMS_470580061","125874");
-//    }
+    public static void main(String[] args) {
+        sendCheckCode("16673327580","SMS_470580061","125874");
+    }
 
     public static Boolean sendCheckCode(String mobile, String templateCode, String random) {
         try {

+ 3 - 0
hcp-core/src/main/java/com/yingyangfly/core/vo/LearningPackageVo.java

@@ -85,6 +85,9 @@ public class LearningPackageVo implements Serializable {
         if("D".equals(getTimeType())){
             return 365;
         }
+        if ("E".equals(getTimeType())){
+            return 7;
+        }
         return 0;
     }
 

+ 107 - 0
hcp-large-screen/src/main/java/com/yingyangfly/large/screen/controller/UploadFileController.java

@@ -0,0 +1,107 @@
+package com.yingyangfly.large.screen.controller;
+
+import com.yingyangfly.common.dto.ResultResponse;
+import com.yingyangfly.core.annotation.Log;
+import com.yingyangfly.core.enums.OperatorType;
+import com.yingyangfly.file.api.FileClient;
+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.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ * @author jiangqian
+ * @date 2023/5/14 0014 14:30
+ */
+@RestController
+@RequestMapping("/common")
+@Api(tags = "通用接口")
+@Slf4j
+public class UploadFileController {
+
+    @Autowired
+    private FileClient fileClient;
+
+    // 允许上传的文件类型
+    private static final List<String> ALLOWED_FILE_TYPES = Arrays.asList("png", "jpg", "jpeg", "doc", "xls", "ppt", "mp4", "pdf");
+
+
+    /**
+     * 通用上传
+     * file 是文件
+     * dirName 是文件夹
+     */
+    @Log(title = "文件上传",operatorType = OperatorType.MOBILE)
+    @PostMapping("/upload")
+    @ApiOperation("文件上传")
+    public ResultResponse upload(@RequestParam("file") MultipartFile file, @RequestParam("dirName") String dirName) {
+        if (file.isEmpty()) {
+            return ResultResponse.fail("文件不能为空");
+        }
+        String fileName = file.getOriginalFilename();
+        if (fileName == null) {
+            return ResultResponse.fail("文件名不能为空");
+        }
+        // 获取文件后缀
+        String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
+        // 检查文件类型是否允许
+        if (!ALLOWED_FILE_TYPES.contains(fileExtension)) {
+            return ResultResponse.fail("不允许的文件类型: " + fileExtension);
+        }
+        String upload = fileClient.upload(file, dirName);
+        return ResultResponse.success(upload);
+    }
+
+
+    /**
+     * 通用上传
+     * file 是文件
+     * dirName 是文件夹
+     */
+    @Log(title = "文件上传",operatorType = OperatorType.MOBILE)
+    @PostMapping("/uploadList")
+    @ApiOperation("文件上传")
+    public ResultResponse uploadList(@RequestParam("files") MultipartFile [] files, @RequestParam("dirName") String dirName) {
+        if (files == null || files.length == 0) {
+            return ResultResponse.fail("文件不能为空");
+        }
+
+        Map<String, String> fileUrls = new HashMap<>();
+        for (int i = 0; i < files.length; i++) {
+            MultipartFile file = files[i];
+            if (file.isEmpty()) {
+                return ResultResponse.fail("第 " + (i + 1) + " 个文件为空");
+            }
+
+            String fileName = file.getOriginalFilename();
+            if (fileName == null) {
+                return ResultResponse.fail("第 " + (i + 1) + " 个文件名为空");
+            }
+
+            // 获取文件后缀
+            String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
+            // 检查文件类型是否允许
+            if (!ALLOWED_FILE_TYPES.contains(fileExtension)) {
+                return ResultResponse.fail("第 " + (i + 1) + " 个文件类型不允许: " + fileExtension);
+            }
+
+            // 上传文件并获取地址
+            String uploadUrl = fileClient.upload(file, dirName);
+            String key = fileName.substring(0, fileName.lastIndexOf("."));
+
+            fileUrls.put(key, uploadUrl); // 使用文件名作为键
+        }
+
+        return ResultResponse.success(fileUrls);
+    }
+
+
+}

+ 4 - 2
hcp-platform/src/main/java/com/yingyangfly/platform/controller/PatientController.java

@@ -59,14 +59,16 @@ public class PatientController {
     @Log(title = "新增患者信息")
     @PostMapping("/save")
     @TraceLog
-    public ResultResponse save(@RequestBody AppUser appUser){
+    public ResultResponse save(@RequestBody AppUserDto appUserDto){
+        AppUser appUser = EntityConverter.convertToTarget(appUserDto, AppUser.class);
         return appUserService.saveAppUser(appUser);
     }
 
     @Log(title = "修改患者")
     @PostMapping("/edit")
     @TraceLog
-    public ResultResponse edit(@RequestBody AppUser appUser){
+    public ResultResponse edit(@RequestBody AppUserDto appUserDto){
+        AppUser appUser = EntityConverter.convertToTarget(appUserDto, AppUser.class);
         return appUserService.saveAppUser(appUser);
     }
 

+ 12 - 0
hcp-platform/src/main/java/com/yingyangfly/platform/controller/ReviewTaskController.java

@@ -91,4 +91,16 @@ public class ReviewTaskController {
         return ResultResponse.success(list);
     }
 
+
+    /**
+     * 查询测评 详情 打印
+     */
+    @Log(title = "测评打印")
+    @TraceLog
+    @PostMapping(value = "/printReviewResultDetail")
+    public ResultResponse printReviewResultDetail(@RequestBody ReviewRecord reviewRecord){
+        Map<String, Object> map = reviewService.printReviewResultDetail(reviewRecord);
+        return ResultResponse.success(map);
+    }
+
 }

+ 1 - 0
hcp-platform/src/main/resources/application-dev.yml

@@ -118,6 +118,7 @@ security:
       - /callback/**
       - /im/callback/**
       - /pay/callback/**/m**
+      - /system/dict/data/selectByDictType
 
 query-daily-trai: http://60.205.122.15/h5-training-daily/index.html
 

+ 1 - 0
hcp-platform/src/main/resources/application-prod.yml

@@ -114,6 +114,7 @@ security:
       - /callback/**
       - /im/callback/**
       - /pay/callback/**/m**
+      - /system/dict/data/selectByDictType
 
 query-daily-trai: https://yaorong.yaorongmedical.com/h5-training-daily/index.html