Ver Fonte

add
增加泵数据

18339543638 há 4 meses atrás
pai
commit
b85b521f9f

+ 3 - 6
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/app/controller/ALiYunController.java

@@ -7,10 +7,7 @@ import cn.tr.module.smart.common.service.ALiYunService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import java.util.*;
 
@@ -30,8 +27,8 @@ public class ALiYunController {
 
     @PostMapping("/recognize")
     @ApiOperation(value = "识别患者图片信息",notes = "权限: 无")
-    public CommonResult<List<WxDoctorClinicRoomThumbnailVO>> recognizeImage(@RequestParam MultipartFile file) throws Exception {
-        return CommonResult.success(aliYunService.recognizeImage(file));
+    public CommonResult<List<WxDoctorClinicRoomThumbnailVO>> recognizeImage(@RequestBody byte[] bytes) throws Exception {
+        return CommonResult.success(aliYunService.recognizeImage(bytes));
     }
 
 }

+ 1 - 1
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/common/service/ALiYunService.java

@@ -16,5 +16,5 @@ import java.util.Map;
  */
 public interface ALiYunService {
 
-    List<WxDoctorClinicRoomThumbnailVO> recognizeImage(MultipartFile file) throws Exception;
+    List<WxDoctorClinicRoomThumbnailVO> recognizeImage(byte[] file) throws Exception;
 }

+ 5 - 4
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/common/service/impl/ALiYunServiceImpl.java

@@ -15,6 +15,7 @@ import com.alibaba.dashscope.app.Application;
 import com.alibaba.dashscope.app.ApplicationParam;
 import com.alibaba.dashscope.app.ApplicationResult;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -67,7 +68,7 @@ public class ALiYunServiceImpl implements ALiYunService {
     }
 
     @Override
-    public List<WxDoctorClinicRoomThumbnailVO> recognizeImage(MultipartFile file) throws Exception {
+    public List<WxDoctorClinicRoomThumbnailVO> recognizeImage(byte[] bytes) throws Exception {
         List<WxDoctorClinicRoomThumbnailVO> result = new ArrayList<>();
         List<BizDeptPO> deptList = deptRepository.selectList(new LambdaQueryWrapper<>());
 
@@ -87,13 +88,13 @@ public class ALiYunServiceImpl implements ALiYunService {
                             .collect(Collectors.toList())));
         }
 
-
+        String imageName="aiImage/"+ IdWorker.getIdStr()+".png";
         String imageUrl;
         SysStorageRecordDTO uploadResult = fileService.upload(
                 null,
                 null,
-                file.getOriginalFilename(),
-                file.getBytes(),
+                imageName,
+                bytes,
                 null);
 
         imageUrl = uploadResult.getAbsolutePath();