瀏覽代碼

添加用户健康数据检测 修改添加用户信息缺失头像功能

xgb 2 周之前
父節點
當前提交
7d323633ed

+ 103 - 0
fs-company-app/src/main/java/com/fs/app/controller/FsUserHealthDataController.java

@@ -0,0 +1,103 @@
+package com.fs.app.controller;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.his.domain.FsUserHealthData;
+import com.fs.his.service.IFsUserHealthDataService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 用户身体检测数据Controller
+ * 
+ * @author fs
+ * @date 2025-08-27
+ */
+@RestController
+@RequestMapping("/shop/data")
+public class FsUserHealthDataController extends BaseController
+{
+    @Autowired
+    private IFsUserHealthDataService fsUserHealthDataService;
+
+    /**
+     * 查询用户身体检测数据列表
+     */
+    @PreAuthorize("@ss.hasPermi('shop:data:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(FsUserHealthData fsUserHealthData)
+    {
+        startPage();
+        List<FsUserHealthData> list = fsUserHealthDataService.selectFsUserHealthDataList(fsUserHealthData);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出用户身体检测数据列表
+     */
+    @PreAuthorize("@ss.hasPermi('shop:data:export')")
+    @Log(title = "用户身体检测数据", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(FsUserHealthData fsUserHealthData)
+    {
+        List<FsUserHealthData> list = fsUserHealthDataService.selectFsUserHealthDataList(fsUserHealthData);
+        ExcelUtil<FsUserHealthData> util = new ExcelUtil<FsUserHealthData>(FsUserHealthData.class);
+        return util.exportExcel(list, "用户身体检测数据数据");
+    }
+
+    /**
+     * 获取用户身体检测数据详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('shop:data:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") String id)
+    {
+        return AjaxResult.success(fsUserHealthDataService.selectFsUserHealthDataById(id));
+    }
+
+    /**
+     * 新增用户身体检测数据
+     */
+    @PreAuthorize("@ss.hasPermi('shop:data:add')")
+    @Log(title = "用户身体检测数据", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody FsUserHealthData fsUserHealthData)
+    {
+        return toAjax(fsUserHealthDataService.insertFsUserHealthData(fsUserHealthData));
+    }
+
+    /**
+     * 修改用户身体检测数据
+     */
+    @PreAuthorize("@ss.hasPermi('shop:data:edit')")
+    @Log(title = "用户身体检测数据", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody FsUserHealthData fsUserHealthData)
+    {
+        return toAjax(fsUserHealthDataService.updateFsUserHealthData(fsUserHealthData));
+    }
+
+    /**
+     * 删除用户身体检测数据
+     */
+    @PreAuthorize("@ss.hasPermi('shop:data:remove')")
+    @Log(title = "用户身体检测数据", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable String[] ids)
+    {
+        return toAjax(fsUserHealthDataService.deleteFsUserHealthDataByIds(ids));
+    }
+}

+ 72 - 0
fs-company-app/src/main/java/com/fs/app/controller/FsUserHealthProfileController.java

@@ -0,0 +1,72 @@
+package com.fs.app.controller;
+
+import com.fs.app.annotation.Login;
+import com.fs.common.core.domain.R;
+import com.fs.his.domain.FsUserHealthProfile;
+import com.fs.his.service.IFsUserHealthProfileService;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 用户健康档案Controller
+ *
+ * @author fs
+ * @date 2025-08-27
+ */
+@RestController
+@RequestMapping("/app/fs/health/profile")
+public class FsUserHealthProfileController extends AppBaseController {
+    @Autowired
+    private IFsUserHealthProfileService fsUserHealthProfileService;
+
+
+    /**
+     * 获取用户健康档案详细信息
+     */
+    @Login
+    @GetMapping(value = "/info")
+    @ApiOperation("获取用户健康档案详细信息")
+    public R getInfo(@RequestParam("userId") Long userId) {
+        FsUserHealthProfile profile = fsUserHealthProfileService.selectFsUserHealthProfileByUserId(userId);
+        return R.ok().put("data", profile);
+    }
+
+    /**
+     * 新增用户健康档案
+     */
+    @Login
+    @PostMapping("/add")
+    @ApiOperation("新增用户健康档案")
+    public R add(@RequestBody FsUserHealthProfile fsUserHealthProfile) {
+        if (fsUserHealthProfileService.insertFsUserHealthProfile(fsUserHealthProfile) <= 0) {
+            return R.error("新增用户健康档案失败");
+        }
+        return R.ok();
+    }
+
+    /**
+     * 修改用户健康档案
+     */
+    @Login
+    @PostMapping("/update")
+    @ApiOperation("修改用户健康档案")
+    public R edit(@RequestBody FsUserHealthProfile fsUserHealthProfile) {
+        if (fsUserHealthProfileService.updateFsUserHealthProfile(fsUserHealthProfile) <= 0) {
+            return R.error("用户健康档案修改失败");
+        }
+        return R.ok();
+    }
+
+    /**
+     * 删除用户健康档案
+     */
+    @Login
+    @GetMapping("/delete")
+    public R remove(@RequestParam Long userId) {
+        if (fsUserHealthProfileService.deleteFsUserHealthProfileByUserId(userId) <= 0) {
+            return R.error("用户健康档案删除失败");
+        }
+        return R.ok();
+    }
+}

+ 29 - 27
fs-company-app/src/main/java/com/fs/app/controller/FsUserInfoController.java

@@ -1,10 +1,8 @@
 package com.fs.app.controller;
 
 import com.fs.app.annotation.Login;
-import com.fs.common.core.controller.BaseController;
-import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
-import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.utils.StringUtils;
 import com.fs.his.domain.FsUser;
 import com.fs.his.domain.FsUserInfo;
 import com.fs.his.service.IFsUserInfoService;
@@ -12,7 +10,6 @@ import com.fs.his.service.IFsUserService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.ApiOperation;
-import lombok.val;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
@@ -21,14 +18,13 @@ import java.util.List;
 
 /**
  * 用户信息Controller
- * 
+ *
  * @author fs
  * @date 2025-08-25
  */
 @RestController
 @RequestMapping("/app/fs/userinfo")
-public class FsUserInfoController extends AppBaseController
-{
+public class FsUserInfoController extends AppBaseController {
     @Autowired
     private IFsUserInfoService fsUserInfoService;
 
@@ -42,10 +38,9 @@ public class FsUserInfoController extends AppBaseController
     @GetMapping("/list")
     @ApiOperation("获取用户列表信息")
     public R list(@RequestParam("companyUserId") Long companyUserId,
-                              @RequestParam(required = false, defaultValue = "1") Integer pageNum,
-                              @RequestParam(required = false, defaultValue = "10") Integer pageSize)
-    {
-        if(companyUserId==null){
+                  @RequestParam(required = false, defaultValue = "1") Integer pageNum,
+                  @RequestParam(required = false, defaultValue = "10") Integer pageSize) {
+        if (companyUserId == null) {
             companyUserId = getCompanyUserId();
         }
         PageHelper.startPage(pageNum, pageSize);
@@ -54,17 +49,15 @@ public class FsUserInfoController extends AppBaseController
     }
 
 
-
     /**
      * 获取用户信息详细信息
      */
     @Login
     @GetMapping(value = "/info")
     @ApiOperation("获取用户详情信息")
-    public R getInfo(@RequestParam("userId") Long userId)
-    {
+    public R getInfo(@RequestParam("userId") Long userId) {
         FsUserInfo fsUserInfo = fsUserInfoService.selectFsUserInfoById(userId);
-        return R.ok().put("data",fsUserInfo);
+        return R.ok().put("data", fsUserInfo);
     }
 
     /**
@@ -74,27 +67,28 @@ public class FsUserInfoController extends AppBaseController
     @PostMapping("/add")
     @ApiOperation("新增用户信息")
     @Transactional
-    public R add(@RequestBody FsUserInfo fsUserInfo)
-    {
+    public R add(@RequestBody FsUserInfo fsUserInfo) {
         // 获取companyUserId
         Long companyUserId = getCompanyUserId();
-        if(companyUserId!=null){
+        if (companyUserId != null) {
             fsUserInfo.setCompanyUserId(companyUserId);
         }
 
         FsUser fsUser = new FsUser();
         fsUser.setCompanyUserId(companyUserId);
         // 后期需要登记 登记后更新的时候需要一起修改
+        // 头像
+        fsUser.setAvatar(fsUserInfo.getAvatar());
 //        fsUser.setPhone(fsUserInfo.getPhone());
 //        fsUser.setUsername(fsUserInfo.getUsername());
         // 登记fsUser表
-        if(fsUserService.insertFsUser(fsUser)<=0){
+        if (fsUserService.insertFsUser(fsUser) <= 0) {
             return R.error("用户信息登记原表失败");
         }
         // 登记同一个userId
         fsUserInfo.setUserId(fsUser.getUserId());
         // 登记fsUserInfo表
-        if(fsUserInfoService.insertFsUserInfo(fsUserInfo)<=0){
+        if (fsUserInfoService.insertFsUserInfo(fsUserInfo) <= 0) {
             return R.error("用户信息登记失败");
         }
         return R.ok();
@@ -106,11 +100,20 @@ public class FsUserInfoController extends AppBaseController
     @Login
     @PostMapping("/update")
     @ApiOperation("修改用户信息")
-    public R edit(@RequestBody FsUserInfo fsUserInfo)
-    {
-        if(fsUserInfoService.updateFsUserInfo(fsUserInfo)<=0){
+    @Transactional
+    public R edit(@RequestBody FsUserInfo fsUserInfo) {
+        if (fsUserInfoService.updateFsUserInfo(fsUserInfo) <= 0) {
             return R.error("用户信息修改失败");
         }
+        // 若头像字段不为空 需要更新fsUser表
+        if (!StringUtils.isEmpty(fsUserInfo.getAvatar())) {
+            FsUser fsUser = new FsUser();
+            fsUser.setUserId(fsUserInfo.getUserId());
+            fsUser.setAvatar(fsUserInfo.getAvatar());
+            if (fsUserService.updateFsUser(fsUser) <= 0) {
+                return R.error("用户信息修改原表失败");
+            }
+        }
         return R.ok();
     }
 
@@ -118,13 +121,12 @@ public class FsUserInfoController extends AppBaseController
      * 删除用户信息
      */
     @Login
-	@GetMapping("/delete")
+    @GetMapping("/delete")
     @ApiOperation("删除用户信息")
     @Transactional
-    public R remove(@RequestParam("userId") Long userId)
-    {
+    public R remove(@RequestParam("userId") Long userId) {
         // 更新fsUser表状态
-        if(fsUserService.deleteFsUserByUserId(userId)<=0){
+        if (fsUserService.deleteFsUserByUserId(userId) <= 0) {
             return R.error("用户信息删除原表失败");
         }
         return R.ok();

+ 57 - 0
fs-service/src/main/java/com/fs/his/domain/FsUserHealthData.java

@@ -0,0 +1,57 @@
+package com.fs.his.domain;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fs.common.annotation.Excel;
+import lombok.Data;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 用户身体检测数据对象 fs_user_health_data
+ *
+ * @author fs
+ * @date 2025-08-27
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class FsUserHealthData extends BaseEntity{
+
+    /** 自增主键 */
+    private String id;
+
+    /** 用户ID */
+    @Excel(name = "用户ID")
+    private String userId;
+
+    /** 测量类型(0-腰围,1-臀围,2-血糖,3-血压,4-尿酸) */
+    @Excel(name = "测量类型", readConverterExp = "0=-腰围,1-臀围,2-血糖,3-血压,4-尿酸")
+    private Long measurementType;
+
+    /** 数值1(测量值/低峰值) */
+    @Excel(name = "数值1", readConverterExp = "测=量值/低峰值")
+    private BigDecimal value1;
+
+    /** 数值2(高峰值,仅血压需要两个值,其他类型可NULL) */
+    @Excel(name = "数值2", readConverterExp = "高=峰值,仅血压需要两个值,其他类型可NULL")
+    private BigDecimal value2;
+
+    /** 测量日期 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "测量日期", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date measurementDate;
+
+    /** 测量时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "测量时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date measurementTime;
+
+    /** 记录创建时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "记录创建时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date createdAt;
+
+
+}

+ 79 - 0
fs-service/src/main/java/com/fs/his/domain/FsUserHealthProfile.java

@@ -0,0 +1,79 @@
+package com.fs.his.domain;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fs.common.annotation.Excel;
+import lombok.Data;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 用户健康档案对象 fs_user_health_profile
+ *
+ * @author fs
+ * @date 2025-08-27
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class FsUserHealthProfile extends BaseEntity{
+
+    /** 用户ID(主键) */
+    private Long userId;
+
+    /** 身高(单位:厘米) */
+    private BigDecimal height;
+
+    /** 体重(单位:千克) */
+    private BigDecimal weight;
+
+    /** 腰围(单位:厘米) */
+    private BigDecimal waistCircumference;
+
+    /** 臀围(单位:厘米) */
+    private BigDecimal hipCircumference;
+
+    /** 高血糖(无-0,轻微-1,严重-2) */
+    private Long hyperglycemia;
+
+    /** 高血糖测量值(单位:mmol/L) */
+    private BigDecimal hyperglycemiaValue;
+
+    /** 高血压(无-0,轻微-1,严重-2) */
+    private Long hypertension;
+
+    /** 收缩压(高压) */
+    private BigDecimal systolicPressure;
+
+    /** 舒张压(低压) */
+    private BigDecimal diastolicPressure;
+
+    /** 高血脂(无-0,轻微-1,严重-2) */
+    private Long hyperlipidemia;
+
+    /** 高尿酸(无-0,轻微-1,严重-2) */
+    private Long hyperuricemia;
+
+    /** 高尿酸测量值(单位:μmol/L) */
+    private BigDecimal hyperuricemiaValue;
+
+    /** 高体重(正常-0,偏瘦-1,偏重-2) */
+    private Long bodyWeightStatus;
+
+    /** 其他病史 */
+    private String otherMedicalHistory;
+
+    /** 症状史 */
+    private String symptomHistory;
+
+    /** 创建时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date createdTime;
+
+    /** 更新时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date updatedTime;
+
+
+}

+ 5 - 0
fs-service/src/main/java/com/fs/his/domain/FsUserInfo.java

@@ -33,6 +33,11 @@ public class FsUserInfo extends BaseEntity {
      */
     private String username;
 
+    /**
+     * 头像
+     */
+    private String avatar;
+
     /**
      * 性别(0:男, 1:女, 2:未知)
      */

+ 61 - 0
fs-service/src/main/java/com/fs/his/mapper/FsUserHealthDataMapper.java

@@ -0,0 +1,61 @@
+package com.fs.his.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fs.his.domain.FsUserHealthData;
+
+/**
+ * 用户身体检测数据Mapper接口
+ * 
+ * @author fs
+ * @date 2025-08-27
+ */
+public interface FsUserHealthDataMapper extends BaseMapper<FsUserHealthData>{
+    /**
+     * 查询用户身体检测数据
+     * 
+     * @param id 用户身体检测数据主键
+     * @return 用户身体检测数据
+     */
+    FsUserHealthData selectFsUserHealthDataById(String id);
+
+    /**
+     * 查询用户身体检测数据列表
+     * 
+     * @param fsUserHealthData 用户身体检测数据
+     * @return 用户身体检测数据集合
+     */
+    List<FsUserHealthData> selectFsUserHealthDataList(FsUserHealthData fsUserHealthData);
+
+    /**
+     * 新增用户身体检测数据
+     * 
+     * @param fsUserHealthData 用户身体检测数据
+     * @return 结果
+     */
+    int insertFsUserHealthData(FsUserHealthData fsUserHealthData);
+
+    /**
+     * 修改用户身体检测数据
+     * 
+     * @param fsUserHealthData 用户身体检测数据
+     * @return 结果
+     */
+    int updateFsUserHealthData(FsUserHealthData fsUserHealthData);
+
+    /**
+     * 删除用户身体检测数据
+     * 
+     * @param id 用户身体检测数据主键
+     * @return 结果
+     */
+    int deleteFsUserHealthDataById(String id);
+
+    /**
+     * 批量删除用户身体检测数据
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteFsUserHealthDataByIds(String[] ids);
+}

+ 46 - 0
fs-service/src/main/java/com/fs/his/mapper/FsUserHealthProfileMapper.java

@@ -0,0 +1,46 @@
+package com.fs.his.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fs.his.domain.FsUserHealthProfile;
+
+/**
+ * 用户健康档案Mapper接口
+ * 
+ * @author fs
+ * @date 2025-08-27
+ */
+public interface FsUserHealthProfileMapper extends BaseMapper<FsUserHealthProfile>{
+    /**
+     * 查询用户健康档案
+     * 
+     * @param userId 用户健康档案主键
+     * @return 用户健康档案
+     */
+    FsUserHealthProfile selectFsUserHealthProfileByUserId(Long userId);
+
+    /**
+     * 新增用户健康档案
+     * 
+     * @param fsUserHealthProfile 用户健康档案
+     * @return 结果
+     */
+    int insertFsUserHealthProfile(FsUserHealthProfile fsUserHealthProfile);
+
+    /**
+     * 修改用户健康档案
+     * 
+     * @param fsUserHealthProfile 用户健康档案
+     * @return 结果
+     */
+    int updateFsUserHealthProfile(FsUserHealthProfile fsUserHealthProfile);
+
+    /**
+     * 删除用户健康档案
+     * 
+     * @param userId 用户健康档案主键
+     * @return 结果
+     */
+    int deleteFsUserHealthProfileByUserId(Long userId);
+
+}

+ 65 - 0
fs-service/src/main/java/com/fs/his/service/IFsUserHealthDataService.java

@@ -0,0 +1,65 @@
+package com.fs.his.service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fs.his.domain.FsUserHealthData;
+
+/**
+ * 用户身体检测数据Service接口
+ * 
+ * @author fs
+ * @date 2025-08-27
+ */
+public interface IFsUserHealthDataService extends IService<FsUserHealthData>{
+    /**
+     * 查询用户身体检测数据
+     * 
+     * @param id 用户身体检测数据主键
+     * @return 用户身体检测数据
+     */
+    FsUserHealthData selectFsUserHealthDataById(String id);
+
+    /**
+     * 查询用户身体检测数据列表
+     * 
+     * @param fsUserHealthData 用户身体检测数据
+     * @return 用户身体检测数据集合
+     */
+    List<FsUserHealthData> selectFsUserHealthDataList(FsUserHealthData fsUserHealthData);
+
+    /**
+     * 新增用户身体检测数据
+     * 
+     * @param fsUserHealthData 用户身体检测数据
+     * @return 结果
+     */
+    int insertFsUserHealthData(FsUserHealthData fsUserHealthData);
+
+    /**
+     * 修改用户身体检测数据
+     * 
+     * @param fsUserHealthData 用户身体检测数据
+     * @return 结果
+     */
+    int updateFsUserHealthData(FsUserHealthData fsUserHealthData);
+
+    /**
+     * 批量删除用户身体检测数据
+     * 
+     * @param ids 需要删除的用户身体检测数据主键集合
+     * @return 结果
+     */
+    int deleteFsUserHealthDataByIds(String[] ids);
+
+    /**
+     * 删除用户身体检测数据信息
+     * 
+     * @param id 用户身体检测数据主键
+     * @return 结果
+     */
+    int deleteFsUserHealthDataById(String id);
+
+    Map<String,Object> parseHealthIndicator();
+}

+ 45 - 0
fs-service/src/main/java/com/fs/his/service/IFsUserHealthProfileService.java

@@ -0,0 +1,45 @@
+package com.fs.his.service;
+
+import java.util.List;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fs.his.domain.FsUserHealthProfile;
+
+/**
+ * 用户健康档案Service接口
+ * 
+ * @author fs
+ * @date 2025-08-27
+ */
+public interface IFsUserHealthProfileService extends IService<FsUserHealthProfile>{
+    /**
+     * 查询用户健康档案
+     * 
+     * @param userId 用户健康档案主键
+     * @return 用户健康档案
+     */
+    FsUserHealthProfile selectFsUserHealthProfileByUserId(Long userId);
+
+    /**
+     * 新增用户健康档案
+     * 
+     * @param fsUserHealthProfile 用户健康档案
+     * @return 结果
+     */
+    int insertFsUserHealthProfile(FsUserHealthProfile fsUserHealthProfile);
+
+    /**
+     * 修改用户健康档案
+     * 
+     * @param fsUserHealthProfile 用户健康档案
+     * @return 结果
+     */
+    int updateFsUserHealthProfile(FsUserHealthProfile fsUserHealthProfile);
+
+    /**
+     * 删除用户健康档案信息
+     * 
+     * @param userId 用户健康档案主键
+     * @return 结果
+     */
+    int deleteFsUserHealthProfileByUserId(Long userId);
+}

+ 130 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsUserHealthDataServiceImpl.java

@@ -0,0 +1,130 @@
+package com.fs.his.service.impl;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fs.common.constant.Constants;
+import com.fs.common.core.redis.RedisCache;
+import com.fs.common.utils.StringUtils;
+import lombok.val;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.fs.his.mapper.FsUserHealthDataMapper;
+import com.fs.his.domain.FsUserHealthData;
+import com.fs.his.service.IFsUserHealthDataService;
+
+/**
+ * 用户身体检测数据Service业务层处理
+ * 
+ * @author fs
+ * @date 2025-08-27
+ */
+@Service
+public class FsUserHealthDataServiceImpl extends ServiceImpl<FsUserHealthDataMapper, FsUserHealthData> implements IFsUserHealthDataService {
+
+
+    @Autowired
+    private RedisCache redisCache;
+
+    private static final String HEALTH_INDICATOR_KEY = "his.healthIndexConfig:";
+    /**
+     * 查询用户身体检测数据
+     * 
+     * @param id 用户身体检测数据主键
+     * @return 用户身体检测数据
+     */
+    @Override
+    public FsUserHealthData selectFsUserHealthDataById(String id)
+    {
+        return baseMapper.selectFsUserHealthDataById(id);
+    }
+
+    /**
+     * 查询用户身体检测数据列表
+     * 
+     * @param fsUserHealthData 用户身体检测数据
+     * @return 用户身体检测数据
+     */
+    @Override
+    public List<FsUserHealthData> selectFsUserHealthDataList(FsUserHealthData fsUserHealthData)
+    {
+        return baseMapper.selectFsUserHealthDataList(fsUserHealthData);
+    }
+
+    /**
+     * 新增用户身体检测数据
+     * 
+     * @param fsUserHealthData 用户身体检测数据
+     * @return 结果
+     */
+    @Override
+    public int insertFsUserHealthData(FsUserHealthData fsUserHealthData)
+    {
+        return baseMapper.insertFsUserHealthData(fsUserHealthData);
+    }
+
+    /**
+     * 修改用户身体检测数据
+     * 
+     * @param fsUserHealthData 用户身体检测数据
+     * @return 结果
+     */
+    @Override
+    public int updateFsUserHealthData(FsUserHealthData fsUserHealthData)
+    {
+        return baseMapper.updateFsUserHealthData(fsUserHealthData);
+    }
+
+    /**
+     * 批量删除用户身体检测数据
+     * 
+     * @param ids 需要删除的用户身体检测数据主键
+     * @return 结果
+     */
+    @Override
+    public int deleteFsUserHealthDataByIds(String[] ids)
+    {
+        return baseMapper.deleteFsUserHealthDataByIds(ids);
+    }
+
+    /**
+     * 删除用户身体检测数据信息
+     * 
+     * @param id 用户身体检测数据主键
+     * @return 结果
+     */
+    @Override
+    public int deleteFsUserHealthDataById(String id)
+    {
+        return baseMapper.deleteFsUserHealthDataById(id);
+    }
+
+    /**
+     * @Description: 解析健康指标
+     * @Param:  []
+     * @Return: java.util.Map<java.lang.String,java.lang.Object>
+     * @Author xgb
+     * @Date 2025/8/28 9:10
+     */
+    @Override
+    public Map<String, Object> parseHealthIndicator() {
+        String str = redisCache.getCacheObject(Constants.SYS_CONFIG_KEY + HEALTH_INDICATOR_KEY);
+        // str JSON串转 map
+        if(StringUtils.isEmpty(str)){
+            throw new RuntimeException("健康指标配置不存在,请联系管理人员");
+        }
+
+        // 解析健康指标JSON
+// {"bloodGlucose":{"fasting":{"normal":"1212.111111"},"post1Hour":{"normal":""},"post2Hour":{"normal":"2121"},"severity":[{"level":"normal","range":"","description":"12"},{"level":"mild","range":"121","description":"2121"},{"level":"severe","range":"212","description":"212"}]},"bloodPressure":{"protection":{"systolic":"","diastolic":""},"severity":[{"level":"normal","type":"systolic","range":"121","description":"121"},{"level":"mild","type":"systolic","range":"1212","description":"2121"},{"level":"severe","type":"systolic","range":"1212","description":"2121"},{"level":"normal","type":"diastolic","range":"121","description":"2121"},{"level":"mild","type":"diastolic","range":"212","description":"121"},{"level":"severe","type":"diastolic","range":"212","description":"121"}]},"uricAcid":{"activeGender":"male","male":[{"level":"normal","range":"<420","description":""},{"level":"poor","range":"420~480","description":""},{"level":"highRisk","range":">480","description":""}],"female":[{"level":"normal","range":"<360","description":""},{"level":"poor","range":"360~420","description":""},{"level":"highRisk","range":">420","description":""}]},"bmi":{"severity":[{"level":"normal","range":"18.5~23.9","description":""},{"level":"mild","range":"<18.5","description":""},{"level":"severe","range":"≥24.0","description":""}]}}
+
+        Map<String, Object> map = JSON.parseObject(str, Map.class);
+        // 校验健康指标配置
+
+
+
+        return null;
+    }
+}

+ 68 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsUserHealthProfileServiceImpl.java

@@ -0,0 +1,68 @@
+package com.fs.his.service.impl;
+
+import java.util.List;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.fs.his.mapper.FsUserHealthProfileMapper;
+import com.fs.his.domain.FsUserHealthProfile;
+import com.fs.his.service.IFsUserHealthProfileService;
+
+/**
+ * 用户健康档案Service业务层处理
+ * 
+ * @author fs
+ * @date 2025-08-27
+ */
+@Service
+public class FsUserHealthProfileServiceImpl extends ServiceImpl<FsUserHealthProfileMapper, FsUserHealthProfile> implements IFsUserHealthProfileService {
+
+    /**
+     * 查询用户健康档案
+     * 
+     * @param userId 用户健康档案主键
+     * @return 用户健康档案
+     */
+    @Override
+    public FsUserHealthProfile selectFsUserHealthProfileByUserId(Long userId)
+    {
+        return baseMapper.selectFsUserHealthProfileByUserId(userId);
+    }
+
+    /**
+     * 新增用户健康档案
+     * 
+     * @param fsUserHealthProfile 用户健康档案
+     * @return 结果
+     */
+    @Override
+    public int insertFsUserHealthProfile(FsUserHealthProfile fsUserHealthProfile)
+    {
+        return baseMapper.insertFsUserHealthProfile(fsUserHealthProfile);
+    }
+
+    /**
+     * 修改用户健康档案
+     * 
+     * @param fsUserHealthProfile 用户健康档案
+     * @return 结果
+     */
+    @Override
+    public int updateFsUserHealthProfile(FsUserHealthProfile fsUserHealthProfile)
+    {
+        return baseMapper.updateFsUserHealthProfile(fsUserHealthProfile);
+    }
+
+
+    /**
+     * 删除用户健康档案信息
+     * 
+     * @param userId 用户健康档案主键
+     * @return 结果
+     */
+    @Override
+    public int deleteFsUserHealthProfileByUserId(Long userId)
+    {
+        return baseMapper.deleteFsUserHealthProfileByUserId(userId);
+    }
+}

+ 86 - 0
fs-service/src/main/resources/mapper/his/FsUserHealthDataMapper.xml

@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fs.his.mapper.FsUserHealthDataMapper">
+    
+    <resultMap type="FsUserHealthData" id="FsUserHealthDataResult">
+        <result property="id"    column="id"    />
+        <result property="userId"    column="user_id"    />
+        <result property="measurementType"    column="measurement_type"    />
+        <result property="value1"    column="value1"    />
+        <result property="value2"    column="value2"    />
+        <result property="measurementDate"    column="measurement_date"    />
+        <result property="measurementTime"    column="measurement_time"    />
+        <result property="createdAt"    column="created_at"    />
+    </resultMap>
+
+    <sql id="selectFsUserHealthDataVo">
+        select id, user_id, measurement_type, value1, value2, measurement_date, measurement_time, created_at from fs_user_health_data
+    </sql>
+
+    <select id="selectFsUserHealthDataList" parameterType="FsUserHealthData" resultMap="FsUserHealthDataResult">
+        <include refid="selectFsUserHealthDataVo"/>
+        <where>  
+            <if test="userId != null  and userId != ''"> and user_id = #{userId}</if>
+            <if test="measurementType != null "> and measurement_type = #{measurementType}</if>
+            <if test="value1 != null "> and value1 = #{value1}</if>
+            <if test="value2 != null "> and value2 = #{value2}</if>
+            <if test="measurementDate != null "> and measurement_date = #{measurementDate}</if>
+            <if test="measurementTime != null "> and measurement_time = #{measurementTime}</if>
+            <if test="createdAt != null "> and created_at = #{createdAt}</if>
+        </where>
+    </select>
+    
+    <select id="selectFsUserHealthDataById" parameterType="String" resultMap="FsUserHealthDataResult">
+        <include refid="selectFsUserHealthDataVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertFsUserHealthData" parameterType="FsUserHealthData" useGeneratedKeys="true" keyProperty="id">
+        insert into fs_user_health_data
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="userId != null and userId != ''">user_id,</if>
+            <if test="measurementType != null">measurement_type,</if>
+            <if test="value1 != null">value1,</if>
+            <if test="value2 != null">value2,</if>
+            <if test="measurementDate != null">measurement_date,</if>
+            <if test="measurementTime != null">measurement_time,</if>
+            <if test="createdAt != null">created_at,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="userId != null and userId != ''">#{userId},</if>
+            <if test="measurementType != null">#{measurementType},</if>
+            <if test="value1 != null">#{value1},</if>
+            <if test="value2 != null">#{value2},</if>
+            <if test="measurementDate != null">#{measurementDate},</if>
+            <if test="measurementTime != null">#{measurementTime},</if>
+            <if test="createdAt != null">#{createdAt},</if>
+         </trim>
+    </insert>
+
+    <update id="updateFsUserHealthData" parameterType="FsUserHealthData">
+        update fs_user_health_data
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="userId != null and userId != ''">user_id = #{userId},</if>
+            <if test="measurementType != null">measurement_type = #{measurementType},</if>
+            <if test="value1 != null">value1 = #{value1},</if>
+            <if test="value2 != null">value2 = #{value2},</if>
+            <if test="measurementDate != null">measurement_date = #{measurementDate},</if>
+            <if test="measurementTime != null">measurement_time = #{measurementTime},</if>
+            <if test="createdAt != null">created_at = #{createdAt},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteFsUserHealthDataById" parameterType="String">
+        delete from fs_user_health_data where id = #{id}
+    </delete>
+
+    <delete id="deleteFsUserHealthDataByIds" parameterType="String">
+        delete from fs_user_health_data where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 132 - 0
fs-service/src/main/resources/mapper/his/FsUserHealthProfileMapper.xml

@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fs.his.mapper.FsUserHealthProfileMapper">
+    
+    <resultMap type="FsUserHealthProfile" id="FsUserHealthProfileResult">
+        <result property="userId"    column="user_id"    />
+        <result property="height"    column="height"    />
+        <result property="weight"    column="weight"    />
+        <result property="waistCircumference"    column="waist_circumference"    />
+        <result property="hipCircumference"    column="hip_circumference"    />
+        <result property="hyperglycemia"    column="hyperglycemia"    />
+        <result property="hyperglycemiaValue"    column="hyperglycemia_value"    />
+        <result property="hypertension"    column="hypertension"    />
+        <result property="systolicPressure"    column="systolic_pressure"    />
+        <result property="diastolicPressure"    column="diastolic_pressure"    />
+        <result property="hyperlipidemia"    column="hyperlipidemia"    />
+        <result property="hyperuricemia"    column="hyperuricemia"    />
+        <result property="hyperuricemiaValue"    column="hyperuricemia_value"    />
+        <result property="bodyWeightStatus"    column="body_weight_status"    />
+        <result property="otherMedicalHistory"    column="other_medical_history"    />
+        <result property="symptomHistory"    column="symptom_history"    />
+        <result property="createdTime"    column="created_time"    />
+        <result property="updatedTime"    column="updated_time"    />
+    </resultMap>
+
+    <sql id="selectFsUserHealthProfileVo">
+        select user_id, height, weight, waist_circumference, hip_circumference, hyperglycemia, hyperglycemia_value, hypertension, systolic_pressure, diastolic_pressure, hyperlipidemia, hyperuricemia, hyperuricemia_value, body_weight_status, other_medical_history, symptom_history, created_time, updated_time from fs_user_health_profile
+    </sql>
+
+    <select id="selectFsUserHealthProfileList" parameterType="FsUserHealthProfile" resultMap="FsUserHealthProfileResult">
+        <include refid="selectFsUserHealthProfileVo"/>
+        <where>  
+            <if test="height != null "> and height = #{height}</if>
+            <if test="weight != null "> and weight = #{weight}</if>
+            <if test="waistCircumference != null "> and waist_circumference = #{waistCircumference}</if>
+            <if test="hipCircumference != null "> and hip_circumference = #{hipCircumference}</if>
+            <if test="hyperglycemia != null "> and hyperglycemia = #{hyperglycemia}</if>
+            <if test="hyperglycemiaValue != null "> and hyperglycemia_value = #{hyperglycemiaValue}</if>
+            <if test="hypertension != null "> and hypertension = #{hypertension}</if>
+            <if test="systolicPressure != null "> and systolic_pressure = #{systolicPressure}</if>
+            <if test="diastolicPressure != null "> and diastolic_pressure = #{diastolicPressure}</if>
+            <if test="hyperlipidemia != null "> and hyperlipidemia = #{hyperlipidemia}</if>
+            <if test="hyperuricemia != null "> and hyperuricemia = #{hyperuricemia}</if>
+            <if test="hyperuricemiaValue != null "> and hyperuricemia_value = #{hyperuricemiaValue}</if>
+            <if test="bodyWeightStatus != null "> and body_weight_status = #{bodyWeightStatus}</if>
+            <if test="otherMedicalHistory != null  and otherMedicalHistory != ''"> and other_medical_history = #{otherMedicalHistory}</if>
+            <if test="symptomHistory != null  and symptomHistory != ''"> and symptom_history = #{symptomHistory}</if>
+            <if test="createdTime != null "> and created_time = #{createdTime}</if>
+            <if test="updatedTime != null "> and updated_time = #{updatedTime}</if>
+        </where>
+    </select>
+    
+    <select id="selectFsUserHealthProfileByUserId" resultMap="FsUserHealthProfileResult">
+        <include refid="selectFsUserHealthProfileVo"/>
+        where user_id = #{userId}
+    </select>
+        
+    <insert id="insertFsUserHealthProfile" parameterType="FsUserHealthProfile">
+        insert into fs_user_health_profile
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="userId != null">user_id,</if>
+            <if test="height != null">height,</if>
+            <if test="weight != null">weight,</if>
+            <if test="waistCircumference != null">waist_circumference,</if>
+            <if test="hipCircumference != null">hip_circumference,</if>
+            <if test="hyperglycemia != null">hyperglycemia,</if>
+            <if test="hyperglycemiaValue != null">hyperglycemia_value,</if>
+            <if test="hypertension != null">hypertension,</if>
+            <if test="systolicPressure != null">systolic_pressure,</if>
+            <if test="diastolicPressure != null">diastolic_pressure,</if>
+            <if test="hyperlipidemia != null">hyperlipidemia,</if>
+            <if test="hyperuricemia != null">hyperuricemia,</if>
+            <if test="hyperuricemiaValue != null">hyperuricemia_value,</if>
+            <if test="bodyWeightStatus != null">body_weight_status,</if>
+            <if test="otherMedicalHistory != null">other_medical_history,</if>
+            <if test="symptomHistory != null">symptom_history,</if>
+            <if test="createdTime != null">created_time,</if>
+            <if test="updatedTime != null">updated_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="userId != null">#{userId},</if>
+            <if test="height != null">#{height},</if>
+            <if test="weight != null">#{weight},</if>
+            <if test="waistCircumference != null">#{waistCircumference},</if>
+            <if test="hipCircumference != null">#{hipCircumference},</if>
+            <if test="hyperglycemia != null">#{hyperglycemia},</if>
+            <if test="hyperglycemiaValue != null">#{hyperglycemiaValue},</if>
+            <if test="hypertension != null">#{hypertension},</if>
+            <if test="systolicPressure != null">#{systolicPressure},</if>
+            <if test="diastolicPressure != null">#{diastolicPressure},</if>
+            <if test="hyperlipidemia != null">#{hyperlipidemia},</if>
+            <if test="hyperuricemia != null">#{hyperuricemia},</if>
+            <if test="hyperuricemiaValue != null">#{hyperuricemiaValue},</if>
+            <if test="bodyWeightStatus != null">#{bodyWeightStatus},</if>
+            <if test="otherMedicalHistory != null">#{otherMedicalHistory},</if>
+            <if test="symptomHistory != null">#{symptomHistory},</if>
+            <if test="createdTime != null">#{createdTime},</if>
+            <if test="updatedTime != null">#{updatedTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateFsUserHealthProfile" parameterType="FsUserHealthProfile">
+        update fs_user_health_profile
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="height != null">height = #{height},</if>
+            <if test="weight != null">weight = #{weight},</if>
+            <if test="waistCircumference != null">waist_circumference = #{waistCircumference},</if>
+            <if test="hipCircumference != null">hip_circumference = #{hipCircumference},</if>
+            <if test="hyperglycemia != null">hyperglycemia = #{hyperglycemia},</if>
+            <if test="hyperglycemiaValue != null">hyperglycemia_value = #{hyperglycemiaValue},</if>
+            <if test="hypertension != null">hypertension = #{hypertension},</if>
+            <if test="systolicPressure != null">systolic_pressure = #{systolicPressure},</if>
+            <if test="diastolicPressure != null">diastolic_pressure = #{diastolicPressure},</if>
+            <if test="hyperlipidemia != null">hyperlipidemia = #{hyperlipidemia},</if>
+            <if test="hyperuricemia != null">hyperuricemia = #{hyperuricemia},</if>
+            <if test="hyperuricemiaValue != null">hyperuricemia_value = #{hyperuricemiaValue},</if>
+            <if test="bodyWeightStatus != null">body_weight_status = #{bodyWeightStatus},</if>
+            <if test="otherMedicalHistory != null">other_medical_history = #{otherMedicalHistory},</if>
+            <if test="symptomHistory != null">symptom_history = #{symptomHistory},</if>
+            <if test="createdTime != null">created_time = #{createdTime},</if>
+            <if test="updatedTime != null">updated_time = #{updatedTime},</if>
+        </trim>
+        where user_id = #{userId}
+    </update>
+
+    <delete id="deleteFsUserHealthProfileByUserId">
+        delete from fs_user_health_profile where user_id = #{userId}
+    </delete>
+
+</mapper>

+ 5 - 2
fs-service/src/main/resources/mapper/his/FsUserInfoMapper.xml

@@ -8,6 +8,7 @@
         <result property="userId" column="user_id"/>
         <result property="companyUserId" column="company_user_id"/>
         <result property="username" column="username"/>
+        <result property="avatar" column="avatar"/>
         <result property="sex" column="sex"/>
         <result property="birthdate" column="birthdate"/>
         <result property="phone" column="phone"/>
@@ -111,7 +112,8 @@
                 info.concerns,
                 info.problems_to_solve,
                 info.health_suggestions,
-                info.create_time
+                info.create_time,
+                fs.avatar
             from fs_user_info info
                 left join fs_user fs on info.user_id = fs.user_id
             where info.company_user_id = #{companyUserId} and fs.is_del=0
@@ -150,7 +152,8 @@
                 info.concerns,
                 info.problems_to_solve,
                 info.health_suggestions,
-                info.create_time
+                info.create_time,
+                fs.avatar
          from fs_user_info info
          left join fs_user fs on info.user_id = fs.user_id
          where info.user_id = #{userId} and fs.is_del=0