소스 검색

feat(慧视健康): 慧视健康上传照片视频接口

matianxiang 2 달 전
부모
커밋
5a66956aaf

+ 109 - 0
eitc-admin/src/main/java/com/eitc/web/controller/saomiaoyi/SaoMiaoYiController.java

@@ -0,0 +1,109 @@
1
+package com.eitc.web.controller.saomiaoyi;
2
+
3
+import com.alibaba.fastjson2.JSONObject;
4
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5
+import com.eitc.common.config.EitcConfig;
6
+import com.eitc.common.core.domain.AjaxResult;
7
+import com.eitc.common.utils.InterfaceVerificationUtil;
8
+import com.eitc.common.utils.file.FileUploadUtils;
9
+import com.eitc.framework.config.ServerConfig;
10
+import com.eitc.patient.domain.ImageRecord;
11
+import com.eitc.patient.service.IImageRecordService;
12
+import io.swagger.annotations.ApiOperation;
13
+import org.apache.commons.lang3.StringUtils;
14
+import org.springframework.beans.factory.annotation.Value;
15
+import org.springframework.web.bind.annotation.DeleteMapping;
16
+import org.springframework.web.bind.annotation.GetMapping;
17
+import org.springframework.web.bind.annotation.PostMapping;
18
+import org.springframework.web.bind.annotation.RequestMapping;
19
+import org.springframework.web.bind.annotation.RestController;
20
+import org.springframework.web.client.RestTemplate;
21
+import org.springframework.web.multipart.MultipartFile;
22
+
23
+import javax.annotation.Resource;
24
+import java.util.ArrayList;
25
+import java.util.Arrays;
26
+import java.util.HashMap;
27
+import java.util.List;
28
+
29
+/**
30
+ * SaoMiaoYiController
31
+ *
32
+ * @author mtx
33
+ * @date: 2024/09/11 14:37
34
+ */
35
+@RestController
36
+@RequestMapping("/pc/api/scanner")
37
+public class SaoMiaoYiController {
38
+
39
+    @Resource
40
+    private RestTemplate restTemplate;
41
+    @Value("${Total.ip}")
42
+    private String fileUrl;
43
+    @Resource
44
+    private IImageRecordService imageRecordService;
45
+    @Resource
46
+    private ServerConfig serverConfig;
47
+
48
+    /**
49
+     * 慧视口腔-诊所列表
50
+     *
51
+     */
52
+    @GetMapping(value = "/clinicList")
53
+    @ApiOperation("慧视健康-诊所列表")
54
+    public JSONObject clinicList() {
55
+        // 这个是为了防止恶意请求来做的参数增加
56
+        String saSignStr = InterfaceVerificationUtil.getSaSignStr(new HashMap<>());
57
+        String url = fileUrl + "api/sys/clinict/appGetClinictList?" + saSignStr;
58
+        String object = restTemplate.getForObject(url, String.class);
59
+        return JSONObject.parseObject(object);
60
+    }
61
+
62
+
63
+    @PostMapping("/uploads")
64
+    @ApiOperation("上传影像")
65
+    public AjaxResult uploadFiles(String identificationCard, List<MultipartFile> files) {
66
+        if (StringUtils.isBlank(identificationCard)) {
67
+            return AjaxResult.warn("请输入身份证号");
68
+        }
69
+        try {
70
+            List<ImageRecord> list = new ArrayList<>();
71
+            // 上传文件路径
72
+            String filePath = EitcConfig.getUploadPath();
73
+            // 上传并返回新文件名称
74
+            for (MultipartFile file : files) {
75
+                // 上传并返回新文件名称
76
+                String fileName = FileUploadUtils.upload(filePath, file);
77
+                ImageRecord imageRecord = new ImageRecord();
78
+                imageRecord.setImageUrl(fileName);
79
+                String url = serverConfig.getUrl() + fileName;
80
+                imageRecord.setFullImageUrl(url);
81
+                imageRecord.setIdentificationCard(identificationCard);
82
+                list.add(imageRecord);
83
+            }
84
+            return toAjax(imageRecordService.saveBatch(list));
85
+        } catch (Exception e) {
86
+            return AjaxResult.error(e.getMessage());
87
+        }
88
+    }
89
+
90
+    @GetMapping("/list")
91
+    @ApiOperation("查询影像")
92
+    public AjaxResult list(ImageRecord imageRecord) {
93
+        List<ImageRecord> list = imageRecordService.list(Wrappers.<ImageRecord>lambdaQuery()
94
+                .eq(StringUtils.isNotBlank(imageRecord.getIdentificationCard()), ImageRecord::getIdentificationCard, imageRecord.getIdentificationCard()));
95
+        return AjaxResult.success(list);
96
+    }
97
+
98
+    @DeleteMapping("/remove")
99
+    @ApiOperation("删除影像")
100
+    public AjaxResult remove(String ids) {
101
+        List<String> idList = Arrays.asList(ids.split(","));
102
+        return toAjax(imageRecordService.removeBatchByIds(idList));
103
+    }
104
+
105
+    private AjaxResult toAjax(boolean result) {
106
+        return result ? AjaxResult.success() : AjaxResult.error();
107
+    }
108
+
109
+}

+ 0 - 14
eitc-patient-app/src/main/java/com/eitc/patient/controller/ApiAppController.java

@@ -85,20 +85,6 @@ public class ApiAppController extends BaseController {
85 85
     }
86 86
 
87 87
     /**
88
-     * 慧视口腔-诊所列表
89
-     *
90
-     */
91
-    @GetMapping(value = "/clinicListByHuiShiKouQiang")
92
-    @ApiOperation("慧视口腔-诊所列表")
93
-    public JSONObject clinicListByHuiShiKouQiang() {
94
-        // 这个是为了防止恶意请求来做的参数增加
95
-        String saSignStr = InterfaceVerificationUtil.getSaSignStr(new HashMap<>());
96
-        String url = fileUrl + "api/sys/clinict/appGetClinictList?" + saSignStr;
97
-        String object = restTemplate.getForObject(url, String.class);
98
-        return JSONObject.parseObject(object);
99
-    }
100
-
101
-    /**
102 88
      * 新增门诊信息
103 89
      */
104 90
     @Log(title = "新增门诊信息", businessType = BusinessType.INSERT)

+ 35 - 0
eitc-patient-base/src/main/java/com/eitc/patient/domain/ImageRecord.java

@@ -0,0 +1,35 @@
1
+package com.eitc.patient.domain;
2
+
3
+import com.baomidou.mybatisplus.annotation.TableField;
4
+import com.baomidou.mybatisplus.annotation.TableName;
5
+import com.eitc.common.core.domain.EitcBaseEntity;
6
+import io.swagger.annotations.ApiModel;
7
+import io.swagger.annotations.ApiModelProperty;
8
+import lombok.Data;
9
+import lombok.EqualsAndHashCode;
10
+
11
+/**
12
+ * ImageRecord
13
+ *
14
+ * @author mtx
15
+ * @date: 2024-09-12 13:59:30
16
+ */
17
+@EqualsAndHashCode(callSuper = true)
18
+@Data
19
+@ApiModel("影像记录")
20
+@TableName("erm_image_record")
21
+public class ImageRecord extends EitcBaseEntity {
22
+
23
+    @TableField(value = "identification_card")
24
+    @ApiModelProperty(value = "身份证号", name = "identificationCard")
25
+    private String identificationCard;
26
+
27
+    @TableField(value = "image_url")
28
+    @ApiModelProperty(value = "影像路径", name = "imageUrl")
29
+    private String imageUrl;
30
+
31
+    @TableField(value = "full_image_url")
32
+    @ApiModelProperty(value = "影像全路径", name = "fullImageUrl")
33
+    private String fullImageUrl;
34
+
35
+}

+ 15 - 0
eitc-patient-base/src/main/java/com/eitc/patient/mapper/ImageRecordMapper.java

@@ -0,0 +1,15 @@
1
+package com.eitc.patient.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.eitc.patient.domain.ImageRecord;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * ImageRecordMapper
9
+ *
10
+ * @author mtx
11
+ * @date: 2024/06/11 17:39
12
+ */
13
+@Mapper
14
+public interface ImageRecordMapper extends BaseMapper<ImageRecord> {
15
+}

+ 16 - 0
eitc-patient-base/src/main/java/com/eitc/patient/service/IImageRecordService.java

@@ -0,0 +1,16 @@
1
+package com.eitc.patient.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.eitc.patient.domain.ImageRecord;
5
+import org.springframework.stereotype.Service;
6
+
7
+/**
8
+ * IImageRecordService
9
+ *
10
+ * @author mtx
11
+ * @date: 2024/06/11 17:37
12
+ */
13
+@Service
14
+public interface IImageRecordService extends IService<ImageRecord> {
15
+
16
+}

+ 17 - 0
eitc-patient-base/src/main/java/com/eitc/patient/service/impl/ImageRecordServiceImpl.java

@@ -0,0 +1,17 @@
1
+package com.eitc.patient.service.impl;
2
+
3
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
+import com.eitc.patient.domain.ImageRecord;
5
+import com.eitc.patient.mapper.ImageRecordMapper;
6
+import com.eitc.patient.service.IImageRecordService;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * ImageRecordServiceImpl
11
+ *
12
+ * @author mtx
13
+ * @date: 2024/06/11 17:37
14
+ */
15
+@Service
16
+public class ImageRecordServiceImpl extends ServiceImpl<ImageRecordMapper, ImageRecord> implements IImageRecordService {
17
+}