浏览代码

用户管理、穴位管理、艾灸手法管理、设备和用户设备管理、方案管理

李宇 7 月之前
父节点
当前提交
1c7a0eaf66
共有 94 个文件被更改,包括 9429 次插入 和 1002 次删除
  1. 133 373
      logs/aijiuyi-admin-dev.log
  2. 二进制
      logs/aijiuyi-admin-dev.log.2026-04-08.0.gz
  3. 1 1
      openspec/backend/pom.xml
  4. 1 1
      openspec/backend/src/main/java/com/aijiuyi/admin/AijiuyiAdminApplication.java
  5. 49 1
      openspec/backend/src/main/java/com/aijiuyi/admin/common/constant/ResultCode.java
  6. 114 0
      openspec/backend/src/main/java/com/aijiuyi/admin/controller/AcupointController.java
  7. 186 0
      openspec/backend/src/main/java/com/aijiuyi/admin/controller/DeviceController.java
  8. 101 0
      openspec/backend/src/main/java/com/aijiuyi/admin/controller/MoxibustionTechniqueController.java
  9. 154 0
      openspec/backend/src/main/java/com/aijiuyi/admin/controller/PlanController.java
  10. 48 0
      openspec/backend/src/main/java/com/aijiuyi/admin/controller/UserAcupointController.java
  11. 47 5
      openspec/backend/src/main/java/com/aijiuyi/admin/controller/UserDeviceController.java
  12. 51 0
      openspec/backend/src/main/java/com/aijiuyi/admin/controller/UserPlanController.java
  13. 62 28
      openspec/backend/src/main/java/com/aijiuyi/admin/controller/UserProfileController.java
  14. 28 0
      openspec/backend/src/main/java/com/aijiuyi/admin/controller/dto/AcupointQueryDTO.java
  15. 31 0
      openspec/backend/src/main/java/com/aijiuyi/admin/controller/dto/DeviceQueryDTO.java
  16. 39 0
      openspec/backend/src/main/java/com/aijiuyi/admin/controller/dto/DeviceSaveDTO.java
  17. 25 0
      openspec/backend/src/main/java/com/aijiuyi/admin/controller/dto/MoxibustionTechniqueQueryDTO.java
  18. 37 0
      openspec/backend/src/main/java/com/aijiuyi/admin/controller/dto/PlanQueryDTO.java
  19. 58 0
      openspec/backend/src/main/java/com/aijiuyi/admin/controller/dto/PlanSaveDTO.java
  20. 22 4
      openspec/backend/src/main/java/com/aijiuyi/admin/controller/dto/UserProfileDTO.java
  21. 34 0
      openspec/backend/src/main/java/com/aijiuyi/admin/controller/dto/UserProfileQueryDTO.java
  22. 87 0
      openspec/backend/src/main/java/com/aijiuyi/admin/entity/Acupoint.java
  23. 70 0
      openspec/backend/src/main/java/com/aijiuyi/admin/entity/Device.java
  24. 31 0
      openspec/backend/src/main/java/com/aijiuyi/admin/entity/DeviceUserVO.java
  25. 90 0
      openspec/backend/src/main/java/com/aijiuyi/admin/entity/MoxibustionTechnique.java
  26. 90 0
      openspec/backend/src/main/java/com/aijiuyi/admin/entity/Plan.java
  27. 64 0
      openspec/backend/src/main/java/com/aijiuyi/admin/entity/PlanStep.java
  28. 56 0
      openspec/backend/src/main/java/com/aijiuyi/admin/entity/UserAcupoint.java
  29. 14 1
      openspec/backend/src/main/java/com/aijiuyi/admin/entity/UserDevice.java
  30. 61 0
      openspec/backend/src/main/java/com/aijiuyi/admin/entity/UserPlan.java
  31. 24 1
      openspec/backend/src/main/java/com/aijiuyi/admin/entity/UserProfile.java
  32. 12 0
      openspec/backend/src/main/java/com/aijiuyi/admin/mapper/AcupointMapper.java
  33. 36 0
      openspec/backend/src/main/java/com/aijiuyi/admin/mapper/DeviceMapper.java
  34. 12 0
      openspec/backend/src/main/java/com/aijiuyi/admin/mapper/MoxibustionTechniqueMapper.java
  35. 12 0
      openspec/backend/src/main/java/com/aijiuyi/admin/mapper/PlanMapper.java
  36. 12 0
      openspec/backend/src/main/java/com/aijiuyi/admin/mapper/PlanStepMapper.java
  37. 38 0
      openspec/backend/src/main/java/com/aijiuyi/admin/mapper/UserAcupointMapper.java
  38. 12 0
      openspec/backend/src/main/java/com/aijiuyi/admin/mapper/UserPlanMapper.java
  39. 14 0
      openspec/backend/src/main/java/com/aijiuyi/admin/mapper/UserProfileMapper.java
  40. 57 0
      openspec/backend/src/main/java/com/aijiuyi/admin/service/AcupointService.java
  41. 99 0
      openspec/backend/src/main/java/com/aijiuyi/admin/service/DeviceService.java
  42. 50 0
      openspec/backend/src/main/java/com/aijiuyi/admin/service/MoxibustionTechniqueService.java
  43. 96 0
      openspec/backend/src/main/java/com/aijiuyi/admin/service/PlanService.java
  44. 37 0
      openspec/backend/src/main/java/com/aijiuyi/admin/service/UserAcupointService.java
  45. 25 0
      openspec/backend/src/main/java/com/aijiuyi/admin/service/UserDeviceService.java
  46. 29 0
      openspec/backend/src/main/java/com/aijiuyi/admin/service/UserPlanService.java
  47. 29 6
      openspec/backend/src/main/java/com/aijiuyi/admin/service/UserProfileService.java
  48. 160 0
      openspec/backend/src/main/java/com/aijiuyi/admin/service/impl/AcupointServiceImpl.java
  49. 397 0
      openspec/backend/src/main/java/com/aijiuyi/admin/service/impl/DeviceServiceImpl.java
  50. 135 0
      openspec/backend/src/main/java/com/aijiuyi/admin/service/impl/MoxibustionTechniqueServiceImpl.java
  51. 277 0
      openspec/backend/src/main/java/com/aijiuyi/admin/service/impl/PlanServiceImpl.java
  52. 320 0
      openspec/backend/src/main/java/com/aijiuyi/admin/service/impl/UserAcupointServiceImpl.java
  53. 74 0
      openspec/backend/src/main/java/com/aijiuyi/admin/service/impl/UserDeviceServiceImpl.java
  54. 51 0
      openspec/backend/src/main/java/com/aijiuyi/admin/service/impl/UserPlanServiceImpl.java
  55. 193 29
      openspec/backend/src/main/java/com/aijiuyi/admin/service/impl/UserProfileServiceImpl.java
  56. 5 0
      openspec/backend/src/main/resources/mapper/AcupointMapper.xml
  57. 81 0
      openspec/backend/src/main/resources/mapper/DeviceMapper.xml
  58. 11 0
      openspec/backend/src/main/resources/mapper/MoxibustionTechniqueMapper.xml
  59. 5 0
      openspec/backend/src/main/resources/mapper/PlanMapper.xml
  60. 5 0
      openspec/backend/src/main/resources/mapper/PlanStepMapper.xml
  61. 27 0
      openspec/backend/src/main/resources/mapper/UserAcupointMapper.xml
  62. 5 0
      openspec/backend/src/main/resources/mapper/UserPlanMapper.xml
  63. 58 0
      openspec/backend/src/main/resources/mapper/UserProfileMapper.xml
  64. 227 18
      openspec/backend/src/main/resources/sql/init.sql
  65. 3 0
      openspec/frontend/.vite/deps/package.json
  66. 62 0
      openspec/frontend/src/api/acupoint.js
  67. 120 0
      openspec/frontend/src/api/device.js
  68. 12 0
      openspec/frontend/src/api/index.js
  69. 54 0
      openspec/frontend/src/api/moxibustion.js
  70. 97 0
      openspec/frontend/src/api/plan.js
  71. 112 52
      openspec/frontend/src/api/user.js
  72. 2 1
      openspec/frontend/src/layout/index.vue
  73. 39 3
      openspec/frontend/src/router/index.js
  74. 573 0
      openspec/frontend/src/views/acupoint/index.vue
  75. 582 0
      openspec/frontend/src/views/device/index.vue
  76. 332 0
      openspec/frontend/src/views/device/users.vue
  77. 1 1
      openspec/frontend/src/views/login/index.vue
  78. 514 0
      openspec/frontend/src/views/moxibustion/index.vue
  79. 686 0
      openspec/frontend/src/views/plan/index.vue
  80. 3 1
      openspec/frontend/src/views/user/app-user/index.vue
  81. 225 83
      openspec/frontend/src/views/user/device/index.vue
  82. 220 0
      openspec/frontend/src/views/user/plan/index.vue
  83. 372 82
      openspec/frontend/src/views/user/profile/index.vue
  84. 236 0
      openspec/方案管理和用户方案管理.md
  85. 12 0
      openspec/日志管理.md
  86. 42 0
      openspec/用户穴位管理.md
  87. 73 0
      openspec/用户管理.md
  88. 17 0
      openspec/用户设备管理.md
  89. 70 0
      openspec/穴位管理.md
  90. 31 0
      openspec/艾灸手法管理.md
  91. 2 1
      openspec/规范说明.md
  92. 93 0
      openspec/设备管理和用户设备管理.md
  93. 426 310
      需求工作区/需求设计文档/智能穴位定位系统设计文档.md
  94. 9 0
      需求工作区/需求设计文档/用户管理

文件差异内容过多而无法显示
+ 133 - 373
logs/aijiuyi-admin-dev.log


二进制
logs/aijiuyi-admin-dev.log.2026-04-08.0.gz


+ 1 - 1
openspec/backend/pom.xml

@@ -9,7 +9,7 @@
     <version>1.0.0</version>
     <packaging>jar</packaging>
     <name>aijiuyi-admin</name>
-    <description>爱久医管理后台</description>
+    <description>艾灸椅管理后台</description>
 
     <parent>
         <groupId>org.springframework.boot</groupId>

+ 1 - 1
openspec/backend/src/main/java/com/aijiuyi/admin/AijiuyiAdminApplication.java

@@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.scheduling.annotation.EnableAsync;
 
 /**
- * 爱久医管理后台启动类
+ * 艾灸椅管理后台启动类
  */
 @SpringBootApplication
 @MapperScan("com.aijiuyi.admin.mapper")

+ 49 - 1
openspec/backend/src/main/java/com/aijiuyi/admin/common/constant/ResultCode.java

@@ -48,12 +48,60 @@ public enum ResultCode {
     PROFILE_NOT_FOUND(1200, "子用户不存在"),
     /** 子用户数量超出限制 */
     PROFILE_LIMIT_EXCEEDED(1201, "子用户数量已达上限"),
+    /** 子用户手机号已存在 */
+    PHONE_PROFILE_EXISTS(1202, "该手机号已存在"),
+    /** 指宽数值超出性别对应范围 */
+    FINGER_WIDTH_RANGE_ERROR(1203, "指宽数值超出该性别允许范围"),
 
     // ======================== 设备相关 1300-1399 ========================
     /** 设备不存在 */
     DEVICE_NOT_FOUND(1300, "设备不存在"),
     /** 设备已被绑定 */
-    DEVICE_ALREADY_BOUND(1301, "设备已被其他用户绑定");
+    DEVICE_ALREADY_BOUND(1301, "设备已被其他用户绑定"),
+    /** 设备编号已存在 */
+    DEVICE_CODE_EXISTS(1302, "设备编号已存在"),
+    /** 设备序列号已存在 */
+    DEVICE_SERIAL_EXISTS(1303, "设备序列号已存在"),
+    /** 用户已绑定该设备 */
+    DEVICE_USER_ALREADY_BOUND(1304, "该用户已绑定此设备"),
+
+    // ======================== 穴位相关 1400-1499 ========================
+    /** 穴位不存在 */
+    ACUPOINT_NOT_FOUND(1400, "穴位不存在"),
+    /** 穴位编码已存在 */
+    ACUPOINT_CODE_EXISTS(1401, "穴位编码已存在"),
+    /** 穴位名称已存在 */
+    ACUPOINT_NAME_EXISTS(1402, "穴位名称已存在"),
+
+    // ======================== 用户穴位坐标相关 1500-1599 ========================
+    /** 用户穴位坐标记录不存在 */
+    USER_ACUPOINT_NOT_FOUND(1500, "用户穴位坐标记录不存在"),
+    /** 用户穴位坐标生成失败 */
+    USER_ACUPOINT_GENERATE_FAILED(1501, "用户穴位坐标生成失败"),
+
+    // ======================== 艾灸手法相关 1600-1699 ========================
+    /** 艾灸手法不存在 */
+    TECHNIQUE_NOT_FOUND(1600, "艾灸手法不存在"),
+    /** 手法编码已存在 */
+    TECHNIQUE_CODE_EXISTS(1601, "手法编码已存在"),
+    /** 手法名称已存在 */
+    TECHNIQUE_NAME_EXISTS(1602, "手法名称已存在"),
+
+    // ======================== 方案相关 1700-1799 ========================
+    /** 方案不存在 */
+    PLAN_NOT_FOUND(1700, "方案不存在"),
+    /** 方案编码已存在 */
+    PLAN_CODE_EXISTS(1701, "方案编码已存在"),
+    /** 方案名称已存在 */
+    PLAN_NAME_EXISTS(1702, "方案名称已存在"),
+    /** 已发布方案不可删除 */
+    PLAN_CANNOT_DELETE(1703, "已发布或下架方案不可删除"),
+    /** 方案步骤不存在 */
+    PLAN_STEP_NOT_FOUND(1704, "方案步骤不存在"),
+    /** 用户方案不存在 */
+    USER_PLAN_NOT_FOUND(1705, "用户方案不存在"),
+    /** 方案步骤至少保留1个 */
+    PLAN_STEP_MIN_ERROR(1706, "方案步骤至少保留1个");
 
     // ======================== 其他业务错误码在此区间之后继续添加 ========================
 

+ 114 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/controller/AcupointController.java

@@ -0,0 +1,114 @@
+package com.aijiuyi.admin.controller;
+
+import com.aijiuyi.admin.common.annotation.Log;
+import com.aijiuyi.admin.common.entity.Result;
+import com.aijiuyi.admin.common.enums.OperationType;
+import com.aijiuyi.admin.controller.dto.AcupointQueryDTO;
+import com.aijiuyi.admin.entity.Acupoint;
+import com.aijiuyi.admin.service.AcupointService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 穴位管理 Controller
+ * 提供穴位的增删改查、批量删除和批量导入接口
+ */
+@RestController
+@RequestMapping("/acupoint")
+public class AcupointController {
+
+    @Autowired
+    private AcupointService acupointService;
+
+    /**
+     * 分页查询穴位列表
+     *
+     * @param queryDTO 查询条件
+     * @return 分页结果
+     */
+    @GetMapping("/page")
+    @Log(value = "查询穴位列表", module = "穴位管理", operationType = OperationType.QUERY)
+    public Result<IPage<Acupoint>> page(AcupointQueryDTO queryDTO) {
+        return Result.success(acupointService.pageList(queryDTO));
+    }
+
+    /**
+     * 查询穴位详情
+     *
+     * @param id 穴位ID
+     * @return 穴位详情
+     */
+    @GetMapping("/{id}")
+    @Log(value = "查询穴位详情", module = "穴位管理", operationType = OperationType.QUERY)
+    public Result<Acupoint> getById(@PathVariable Long id) {
+        return Result.success(acupointService.getById(id));
+    }
+
+    /**
+     * 新增穴位
+     *
+     * @param acupoint 穴位信息
+     * @return 操作结果
+     */
+    @PostMapping
+    @Log(value = "新增穴位", module = "穴位管理", operationType = OperationType.INSERT)
+    public Result<Void> add(@RequestBody Acupoint acupoint) {
+        acupointService.addAcupoint(acupoint);
+        return Result.success();
+    }
+
+    /**
+     * 修改穴位信息
+     *
+     * @param acupoint 穴位信息
+     * @return 操作结果
+     */
+    @PutMapping
+    @Log(value = "修改穴位信息", module = "穴位管理", operationType = OperationType.UPDATE)
+    public Result<Void> update(@RequestBody Acupoint acupoint) {
+        acupointService.updateAcupoint(acupoint);
+        return Result.success();
+    }
+
+    /**
+     * 删除穴位(逻辑删除)
+     *
+     * @param id 穴位ID
+     * @return 操作结果
+     */
+    @DeleteMapping("/{id}")
+    @Log(value = "删除穴位", module = "穴位管理", operationType = OperationType.DELETE)
+    public Result<Void> delete(@PathVariable Long id) {
+        acupointService.deleteAcupoint(id);
+        return Result.success();
+    }
+
+    /**
+     * 批量删除穴位(逻辑删除,需二次确认)
+     *
+     * @param ids 穴位ID列表
+     * @return 操作结果
+     */
+    @DeleteMapping("/batch")
+    @Log(value = "批量删除穴位", module = "穴位管理", operationType = OperationType.DELETE)
+    public Result<Void> batchDelete(@RequestBody List<Long> ids) {
+        acupointService.batchDeleteAcupoint(ids);
+        return Result.success();
+    }
+
+    /**
+     * 批量导入穴位
+     *
+     * @param list 穴位信息列表
+     * @return 操作结果
+     */
+    @PostMapping("/import")
+    @Log(value = "批量导入穴位", module = "穴位管理", operationType = OperationType.INSERT)
+    public Result<Void> batchImport(@RequestBody List<Acupoint> list) {
+        acupointService.batchImport(list);
+        return Result.success();
+    }
+}

+ 186 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/controller/DeviceController.java

@@ -0,0 +1,186 @@
+package com.aijiuyi.admin.controller;
+
+import com.aijiuyi.admin.common.annotation.Log;
+import com.aijiuyi.admin.common.entity.Result;
+import com.aijiuyi.admin.common.enums.OperationType;
+import com.aijiuyi.admin.controller.dto.DeviceQueryDTO;
+import com.aijiuyi.admin.controller.dto.DeviceSaveDTO;
+import com.aijiuyi.admin.entity.Device;
+import com.aijiuyi.admin.entity.DeviceUserVO;
+import com.aijiuyi.admin.service.DeviceService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 设备管理 Controller
+ * 提供艾灸椅设备的增删改查、批量导入、以及设备绑定用户管理接口
+ */
+@RestController
+@RequestMapping("/device")
+public class DeviceController {
+
+    @Autowired
+    private DeviceService deviceService;
+
+    /**
+     * 分页查询设备列表(含绑定用户数和用户姓名)
+     *
+     * @param queryDTO 查询条件
+     * @return 分页结果
+     */
+    @GetMapping("/page")
+    @Log(value = "查询设备列表", module = "设备管理", operationType = OperationType.QUERY)
+    public Result<IPage<Device>> page(DeviceQueryDTO queryDTO) {
+        return Result.success(deviceService.pageList(queryDTO));
+    }
+
+    /**
+     * 查询设备详情
+     *
+     * @param id 设备ID
+     * @return 设备详情
+     */
+    @GetMapping("/{id}")
+    @Log(value = "查询设备详情", module = "设备管理", operationType = OperationType.QUERY)
+    public Result<Device> getById(@PathVariable Long id) {
+        return Result.success(deviceService.getById(id));
+    }
+
+    /**
+     * 新增设备(可同时绑定初始用户)
+     *
+     * @param dto 设备信息
+     * @return 操作结果
+     */
+    @PostMapping
+    @Log(value = "新增设备", module = "设备管理", operationType = OperationType.INSERT)
+    public Result<Void> add(@RequestBody DeviceSaveDTO dto) {
+        deviceService.addDevice(dto);
+        return Result.success();
+    }
+
+    /**
+     * 修改设备信息
+     *
+     * @param dto 设备信息
+     * @return 操作结果
+     */
+    @PutMapping
+    @Log(value = "修改设备信息", module = "设备管理", operationType = OperationType.UPDATE)
+    public Result<Void> update(@RequestBody DeviceSaveDTO dto) {
+        deviceService.updateDevice(dto);
+        return Result.success();
+    }
+
+    /**
+     * 删除设备(逻辑删除)
+     *
+     * @param id 设备ID
+     * @return 操作结果
+     */
+    @DeleteMapping("/{id}")
+    @Log(value = "删除设备", module = "设备管理", operationType = OperationType.DELETE)
+    public Result<Void> delete(@PathVariable Long id) {
+        deviceService.deleteDevice(id);
+        return Result.success();
+    }
+
+    /**
+     * 批量删除设备(逻辑删除,需二次确认)
+     *
+     * @param ids 设备ID列表
+     * @return 操作结果
+     */
+    @DeleteMapping("/batch")
+    @Log(value = "批量删除设备", module = "设备管理", operationType = OperationType.DELETE)
+    public Result<Void> batchDelete(@RequestBody List<Long> ids) {
+        deviceService.batchDeleteDevices(ids);
+        return Result.success();
+    }
+
+    /**
+     * 批量导入设备
+     *
+     * @param list 设备信息列表
+     * @return 操作结果
+     */
+    @PostMapping("/import")
+    @Log(value = "批量导入设备", module = "设备管理", operationType = OperationType.INSERT)
+    public Result<Void> batchImport(@RequestBody List<Device> list) {
+        deviceService.batchImport(list);
+        return Result.success();
+    }
+
+    // ======================== 设备用户管理 ========================
+
+    /**
+     * 查询设备绑定的用户列表
+     *
+     * @param deviceId 设备ID
+     * @return 绑定用户列表
+     */
+    @GetMapping("/{deviceId}/users")
+    @Log(value = "查询设备绑定用户列表", module = "设备管理", operationType = OperationType.QUERY)
+    public Result<List<DeviceUserVO>> getDeviceUsers(@PathVariable Long deviceId) {
+        return Result.success(deviceService.getDeviceUsers(deviceId));
+    }
+
+    /**
+     * 为设备添加绑定用户
+     *
+     * @param deviceId  设备ID
+     * @param profileId 用户档案ID(user_profile.id)
+     * @return 操作结果
+     */
+    @PostMapping("/{deviceId}/users/{profileId}")
+    @Log(value = "添加设备绑定用户", module = "设备管理", operationType = OperationType.INSERT)
+    public Result<Void> addDeviceUser(@PathVariable Long deviceId, @PathVariable Long profileId) {
+        deviceService.addDeviceUser(deviceId, profileId);
+        return Result.success();
+    }
+
+    /**
+     * 解绑设备用户
+     *
+     * @param deviceId  设备ID
+     * @param profileId 用户档案ID
+     * @return 操作结果
+     */
+    @DeleteMapping("/{deviceId}/users/{profileId}")
+    @Log(value = "解绑设备用户", module = "设备管理", operationType = OperationType.DELETE)
+    public Result<Void> removeDeviceUser(@PathVariable Long deviceId, @PathVariable Long profileId) {
+        deviceService.removeDeviceUser(deviceId, profileId);
+        return Result.success();
+    }
+
+    /**
+     * 设为主用户(同一设备下只有一个主用户)
+     *
+     * @param deviceId  设备ID
+     * @param profileId 用户档案ID
+     * @return 操作结果
+     */
+    @PutMapping("/{deviceId}/users/{profileId}/primary")
+    @Log(value = "设置设备主用户", module = "设备管理", operationType = OperationType.UPDATE)
+    public Result<Void> setDeviceUserPrimary(@PathVariable Long deviceId, @PathVariable Long profileId) {
+        deviceService.setDeviceUserPrimary(deviceId, profileId);
+        return Result.success();
+    }
+
+    /**
+     * 批量解绑设备用户
+     *
+     * @param deviceId 设备ID
+     * @param bindIds  绑定记录ID列表(user_device.id)
+     * @return 操作结果
+     */
+    @DeleteMapping("/{deviceId}/users/batch")
+    @Log(value = "批量解绑设备用户", module = "设备管理", operationType = OperationType.DELETE)
+    public Result<Void> batchRemoveDeviceUsers(@PathVariable Long deviceId, @RequestBody List<Long> bindIds) {
+        deviceService.batchRemoveDeviceUsers(deviceId, bindIds);
+        return Result.success();
+    }
+}

+ 101 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/controller/MoxibustionTechniqueController.java

@@ -0,0 +1,101 @@
+package com.aijiuyi.admin.controller;
+
+import com.aijiuyi.admin.common.annotation.Log;
+import com.aijiuyi.admin.common.entity.Result;
+import com.aijiuyi.admin.common.enums.OperationType;
+import com.aijiuyi.admin.controller.dto.MoxibustionTechniqueQueryDTO;
+import com.aijiuyi.admin.entity.MoxibustionTechnique;
+import com.aijiuyi.admin.service.MoxibustionTechniqueService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 艾灸手法管理 Controller
+ * 提供手法的增删改查、批量删除接口
+ */
+@RestController
+@RequestMapping("/moxibustion-technique")
+public class MoxibustionTechniqueController {
+
+    @Autowired
+    private MoxibustionTechniqueService techniqueService;
+
+    /**
+     * 分页查询艾灸手法列表
+     *
+     * @param queryDTO 查询条件
+     * @return 分页结果
+     */
+    @GetMapping("/page")
+    @Log(value = "查询艾灸手法列表", module = "艾灸手法管理", operationType = OperationType.QUERY)
+    public Result<IPage<MoxibustionTechnique>> page(MoxibustionTechniqueQueryDTO queryDTO) {
+        return Result.success(techniqueService.pageList(queryDTO));
+    }
+
+    /**
+     * 查询艾灸手法详情
+     *
+     * @param id 手法ID
+     * @return 手法详情
+     */
+    @GetMapping("/{id}")
+    @Log(value = "查询艾灸手法详情", module = "艾灸手法管理", operationType = OperationType.QUERY)
+    public Result<MoxibustionTechnique> getById(@PathVariable Long id) {
+        return Result.success(techniqueService.getById(id));
+    }
+
+    /**
+     * 新增艾灸手法
+     *
+     * @param technique 手法信息
+     * @return 操作结果
+     */
+    @PostMapping
+    @Log(value = "新增艾灸手法", module = "艾灸手法管理", operationType = OperationType.INSERT)
+    public Result<Void> add(@RequestBody MoxibustionTechnique technique) {
+        techniqueService.addTechnique(technique);
+        return Result.success();
+    }
+
+    /**
+     * 修改艾灸手法信息
+     *
+     * @param technique 手法信息
+     * @return 操作结果
+     */
+    @PutMapping
+    @Log(value = "修改艾灸手法", module = "艾灸手法管理", operationType = OperationType.UPDATE)
+    public Result<Void> update(@RequestBody MoxibustionTechnique technique) {
+        techniqueService.updateTechnique(technique);
+        return Result.success();
+    }
+
+    /**
+     * 删除艾灸手法(逻辑删除)
+     *
+     * @param id 手法ID
+     * @return 操作结果
+     */
+    @DeleteMapping("/{id}")
+    @Log(value = "删除艾灸手法", module = "艾灸手法管理", operationType = OperationType.DELETE)
+    public Result<Void> delete(@PathVariable Long id) {
+        techniqueService.deleteTechnique(id);
+        return Result.success();
+    }
+
+    /**
+     * 批量删除艾灸手法(逻辑删除)
+     *
+     * @param ids 手法ID列表
+     * @return 操作结果
+     */
+    @DeleteMapping("/batch")
+    @Log(value = "批量删除艾灸手法", module = "艾灸手法管理", operationType = OperationType.DELETE)
+    public Result<Void> batchDelete(@RequestBody List<Long> ids) {
+        techniqueService.batchDeleteTechnique(ids);
+        return Result.success();
+    }
+}

+ 154 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/controller/PlanController.java

@@ -0,0 +1,154 @@
+package com.aijiuyi.admin.controller;
+
+import com.aijiuyi.admin.common.annotation.Log;
+import com.aijiuyi.admin.common.entity.Result;
+import com.aijiuyi.admin.common.enums.OperationType;
+import com.aijiuyi.admin.controller.dto.PlanQueryDTO;
+import com.aijiuyi.admin.controller.dto.PlanSaveDTO;
+import com.aijiuyi.admin.entity.Plan;
+import com.aijiuyi.admin.service.PlanService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 方案管理 Controller
+ * 提供方案的新增、编辑、发布、下架、删除等接口
+ */
+@RestController
+@RequestMapping("/plan")
+public class PlanController {
+
+    @Autowired
+    private PlanService planService;
+
+    /**
+     * 分页查询方案列表
+     *
+     * @param queryDTO 查询条件
+     * @return 分页结果
+     */
+    @GetMapping("/page")
+    @Log(value = "查询方案列表", module = "方案管理", operationType = OperationType.QUERY)
+    public Result<IPage<Plan>> page(PlanQueryDTO queryDTO) {
+        return Result.success(planService.pageList(queryDTO));
+    }
+
+    /**
+     * 查询方案详情(含步骤列表)
+     *
+     * @param id 方案ID
+     * @return 方案详情
+     */
+    @GetMapping("/{id}")
+    @Log(value = "查询方案详情", module = "方案管理", operationType = OperationType.QUERY)
+    public Result<PlanSaveDTO> getById(@PathVariable Long id) {
+        return Result.success(planService.getDetail(id));
+    }
+
+    /**
+     * 新增方案(保存为草稿)
+     *
+     * @param dto 方案信息(含步骤)
+     * @return 操作结果
+     */
+    @PostMapping
+    @Log(value = "新增方案", module = "方案管理", operationType = OperationType.INSERT)
+    public Result<Void> add(@RequestBody PlanSaveDTO dto) {
+        planService.addPlan(dto);
+        return Result.success();
+    }
+
+    /**
+     * 修改方案信息(含步骤)
+     *
+     * @param dto 方案信息(含步骤)
+     * @return 操作结果
+     */
+    @PutMapping
+    @Log(value = "修改方案信息", module = "方案管理", operationType = OperationType.UPDATE)
+    public Result<Void> update(@RequestBody PlanSaveDTO dto) {
+        planService.updatePlan(dto);
+        return Result.success();
+    }
+
+    /**
+     * 删除方案(逻辑删除,仅草稿可删)
+     *
+     * @param id 方案ID
+     * @return 操作结果
+     */
+    @DeleteMapping("/{id}")
+    @Log(value = "删除方案", module = "方案管理", operationType = OperationType.DELETE)
+    public Result<Void> delete(@PathVariable Long id) {
+        planService.deletePlan(id);
+        return Result.success();
+    }
+
+    /**
+     * 批量删除方案(仅草稿可删,需二次确认)
+     *
+     * @param ids 方案ID列表
+     * @return 操作结果
+     */
+    @DeleteMapping("/batch")
+    @Log(value = "批量删除方案", module = "方案管理", operationType = OperationType.DELETE)
+    public Result<Void> batchDelete(@RequestBody List<Long> ids) {
+        planService.batchDeletePlan(ids);
+        return Result.success();
+    }
+
+    /**
+     * 发布方案(草稿 → 已发布)
+     *
+     * @param id 方案ID
+     * @return 操作结果
+     */
+    @PutMapping("/{id}/publish")
+    @Log(value = "发布方案", module = "方案管理", operationType = OperationType.UPDATE)
+    public Result<Void> publish(@PathVariable Long id) {
+        planService.publishPlan(id);
+        return Result.success();
+    }
+
+    /**
+     * 批量发布方案
+     *
+     * @param ids 方案ID列表
+     * @return 操作结果
+     */
+    @PutMapping("/batch/publish")
+    @Log(value = "批量发布方案", module = "方案管理", operationType = OperationType.UPDATE)
+    public Result<Void> batchPublish(@RequestBody List<Long> ids) {
+        planService.batchPublishPlan(ids);
+        return Result.success();
+    }
+
+    /**
+     * 下架方案(已发布 → 已下架)
+     *
+     * @param id 方案ID
+     * @return 操作结果
+     */
+    @PutMapping("/{id}/offshelf")
+    @Log(value = "下架方案", module = "方案管理", operationType = OperationType.UPDATE)
+    public Result<Void> offshelf(@PathVariable Long id) {
+        planService.offshelfPlan(id);
+        return Result.success();
+    }
+
+    /**
+     * 批量下架方案
+     *
+     * @param ids 方案ID列表
+     * @return 操作结果
+     */
+    @PutMapping("/batch/offshelf")
+    @Log(value = "批量下架方案", module = "方案管理", operationType = OperationType.UPDATE)
+    public Result<Void> batchOffshelf(@RequestBody List<Long> ids) {
+        planService.batchOffshelfPlan(ids);
+        return Result.success();
+    }
+}

+ 48 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/controller/UserAcupointController.java

@@ -0,0 +1,48 @@
+package com.aijiuyi.admin.controller;
+
+import com.aijiuyi.admin.common.annotation.Log;
+import com.aijiuyi.admin.common.entity.Result;
+import com.aijiuyi.admin.common.enums.OperationType;
+import com.aijiuyi.admin.entity.UserAcupoint;
+import com.aijiuyi.admin.service.UserAcupointService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 用户穴位坐标 Controller(管理员后台)
+ * 提供手动触发生成、查询穴位坐标接口
+ */
+@RestController
+@RequestMapping("/user/acupoint")
+public class UserAcupointController {
+
+    @Autowired
+    private UserAcupointService userAcupointService;
+
+    /**
+     * 手动为指定子用户生成(或重新生成)穴位坐标表
+     *
+     * @param profileId 子用户ID(user_profile.id)
+     * @return 操作结果
+     */
+    @PostMapping("/{profileId}/generate")
+    @Log(value = "生成用户穴位坐标", module = "用户穴位管理", operationType = OperationType.INSERT)
+    public Result<Void> generate(@PathVariable Long profileId) {
+        userAcupointService.generateForUser(profileId);
+        return Result.success();
+    }
+
+    /**
+     * 查询指定子用户的穴位坐标列表
+     *
+     * @param profileId 子用户ID
+     * @return 穴位坐标列表
+     */
+    @GetMapping("/{profileId}/list")
+    @Log(value = "查询用户穴位坐标列表", module = "用户穴位管理", operationType = OperationType.QUERY)
+    public Result<List<UserAcupoint>> list(@PathVariable Long profileId) {
+        return Result.success(userAcupointService.listByUser(profileId));
+    }
+}

+ 47 - 5
openspec/backend/src/main/java/com/aijiuyi/admin/controller/UserDeviceController.java

@@ -10,9 +10,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 /**
  * 用户设备管理 Controller(管理员后台)
- * 提供设备绑定记录的查询、解绑、删除接口
+ * 提供设备绑定记录的查询、新增、解绑、设为主设备、批量解绑接口
  */
 @RestController
 @RequestMapping("/user/device")
@@ -28,7 +30,7 @@ public class UserDeviceController {
      * @return 分页结果
      */
     @GetMapping("/page")
-    @Log(value = "查询设备列表", module = "用户管理", operationType = OperationType.QUERY)
+    @Log(value = "查询设备列表", module = "设备管理", operationType = OperationType.QUERY)
     public Result<IPage<UserDevice>> page(UserDeviceQueryDTO queryDTO) {
         return Result.success(userDeviceService.pageList(queryDTO));
     }
@@ -40,11 +42,24 @@ public class UserDeviceController {
      * @return 设备详情
      */
     @GetMapping("/{id}")
-    @Log(value = "查询设备详情", module = "用户管理", operationType = OperationType.QUERY)
+    @Log(value = "查询设备详情", module = "设备管理", operationType = OperationType.QUERY)
     public Result<UserDevice> getById(@PathVariable Long id) {
         return Result.success(userDeviceService.getById(id));
     }
 
+    /**
+     * 绑定设备(新增绑定记录)
+     *
+     * @param device 设备信息(userId为子用户ID,deviceCode为设备编号)
+     * @return 操作结果
+     */
+    @PostMapping
+    @Log(value = "绑定设备", module = "设备管理", operationType = OperationType.INSERT)
+    public Result<Void> bind(@RequestBody UserDevice device) {
+        userDeviceService.bindDevice(device);
+        return Result.success();
+    }
+
     /**
      * 解绑设备(设置状态为已解绑)
      *
@@ -52,12 +67,39 @@ public class UserDeviceController {
      * @return 操作结果
      */
     @PutMapping("/{id}/unbind")
-    @Log(value = "解绑设备", module = "用户管理", operationType = OperationType.UPDATE)
+    @Log(value = "解绑设备", module = "设备管理", operationType = OperationType.UPDATE)
     public Result<Void> unbind(@PathVariable Long id) {
         userDeviceService.unbindDevice(id);
         return Result.success();
     }
 
+    /**
+     * 设置主设备(同一用户下只能有一个主设备)
+     *
+     * @param id     设备记录ID
+     * @param userId 所属子用户ID
+     * @return 操作结果
+     */
+    @PutMapping("/{id}/primary")
+    @Log(value = "设置主设备", module = "设备管理", operationType = OperationType.UPDATE)
+    public Result<Void> setPrimary(@PathVariable Long id, @RequestParam Long userId) {
+        userDeviceService.setPrimaryDevice(id, userId);
+        return Result.success();
+    }
+
+    /**
+     * 批量解绑设备
+     *
+     * @param ids 设备记录ID列表
+     * @return 操作结果
+     */
+    @PutMapping("/batch-unbind")
+    @Log(value = "批量解绑设备", module = "设备管理", operationType = OperationType.UPDATE)
+    public Result<Void> batchUnbind(@RequestBody List<Long> ids) {
+        userDeviceService.batchUnbindDevices(ids);
+        return Result.success();
+    }
+
     /**
      * 删除设备记录
      *
@@ -65,7 +107,7 @@ public class UserDeviceController {
      * @return 操作结果
      */
     @DeleteMapping("/{id}")
-    @Log(value = "删除设备记录", module = "用户管理", operationType = OperationType.DELETE)
+    @Log(value = "删除设备记录", module = "设备管理", operationType = OperationType.DELETE)
     public Result<Void> delete(@PathVariable Long id) {
         userDeviceService.deleteDevice(id);
         return Result.success();

+ 51 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/controller/UserPlanController.java

@@ -0,0 +1,51 @@
+package com.aijiuyi.admin.controller;
+
+import com.aijiuyi.admin.common.annotation.Log;
+import com.aijiuyi.admin.common.entity.Result;
+import com.aijiuyi.admin.common.enums.OperationType;
+import com.aijiuyi.admin.entity.UserPlan;
+import com.aijiuyi.admin.service.UserPlanService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 用户方案 Controller
+ * 提供查询指定子用户的方案列表及详情接口
+ */
+@RestController
+@RequestMapping("/user-plan")
+public class UserPlanController {
+
+    @Autowired
+    private UserPlanService userPlanService;
+
+    /**
+     * 分页查询指定子用户的方案列表
+     *
+     * @param userId   子用户ID
+     * @param pageNum  当前页码(默认1)
+     * @param pageSize 每页条数(默认10)
+     * @return 分页结果
+     */
+    @GetMapping("/page")
+    @Log(value = "查询用户方案列表", module = "用户方案管理", operationType = OperationType.QUERY)
+    public Result<IPage<UserPlan>> page(
+            @RequestParam Long userId,
+            @RequestParam(defaultValue = "1") Integer pageNum,
+            @RequestParam(defaultValue = "10") Integer pageSize) {
+        return Result.success(userPlanService.pageByUserId(userId, pageNum, pageSize));
+    }
+
+    /**
+     * 查询用户方案详情
+     *
+     * @param id 用户方案ID
+     * @return 用户方案详情
+     */
+    @GetMapping("/{id}")
+    @Log(value = "查询用户方案详情", module = "用户方案管理", operationType = OperationType.QUERY)
+    public Result<UserPlan> getById(@PathVariable Long id) {
+        return Result.success(userPlanService.getDetail(id));
+    }
+}

+ 62 - 28
openspec/backend/src/main/java/com/aijiuyi/admin/controller/UserProfileController.java

@@ -4,6 +4,7 @@ import com.aijiuyi.admin.common.annotation.Log;
 import com.aijiuyi.admin.common.entity.Result;
 import com.aijiuyi.admin.common.enums.OperationType;
 import com.aijiuyi.admin.controller.dto.UserProfileDTO;
+import com.aijiuyi.admin.controller.dto.UserProfileQueryDTO;
 import com.aijiuyi.admin.entity.UserProfile;
 import com.aijiuyi.admin.service.UserProfileService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -11,10 +12,11 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
+import java.util.List;
 
 /**
- * 子用户管理 Controller(管理员后台)
- * 提供子用户信息的增删改查接口
+ * 用户管理 Controller(管理员后台)
+ * 提供用户档案的增删改查、批量删除、批量导入接口
  */
 @RestController
 @RequestMapping("/user/profile")
@@ -24,72 +26,104 @@ public class UserProfileController {
     private UserProfileService userProfileService;
 
     /**
-     * 分页查询子用户列表
+     * 分页查询用户列表(联表获取设备编号)
      *
-     * @param userId   所属用户ID(可选)
-     * @param name     姓名(模糊搜索,可选)
-     * @param pageNum  当前页码
-     * @param pageSize 每页条数
+     * @param queryDTO 查询条件(关键字/设备编号/性别/注册时间范围/穴位表状态)
      * @return 分页结果
      */
     @GetMapping("/page")
-    @Log(value = "查询子用户列表", module = "用户管理", operationType = OperationType.QUERY)
-    public Result<IPage<UserProfile>> page(
-            @RequestParam(required = false) Long userId,
-            @RequestParam(required = false) String name,
-            @RequestParam(defaultValue = "1") Integer pageNum,
-            @RequestParam(defaultValue = "10") Integer pageSize) {
-        return Result.success(userProfileService.pageList(userId, name, pageNum, pageSize));
+    @Log(value = "查询用户列表", module = "用户管理", operationType = OperationType.QUERY)
+    public Result<IPage<UserProfile>> page(UserProfileQueryDTO queryDTO) {
+        return Result.success(userProfileService.pageList(queryDTO));
     }
 
     /**
-     * 查询子用户详情
+     * 查询用户详情
      *
-     * @param id 子用户ID
-     * @return 子用户详情
+     * @param id 用户ID
+     * @return 用户详情
      */
     @GetMapping("/{id}")
-    @Log(value = "查询子用户详情", module = "用户管理", operationType = OperationType.QUERY)
+    @Log(value = "查询用户详情", module = "用户管理", operationType = OperationType.QUERY)
     public Result<UserProfile> getById(@PathVariable Long id) {
         return Result.success(userProfileService.getById(id));
     }
 
     /**
-     * 新增子用户
+     * 新增用户
      *
-     * @param dto 子用户信息
+     * @param dto 用户信息
      * @return 操作结果
      */
     @PostMapping
-    @Log(value = "新增子用户", module = "用户管理", operationType = OperationType.INSERT)
+    @Log(value = "新增用户", module = "用户管理", operationType = OperationType.INSERT)
     public Result<Void> add(@RequestBody @Valid UserProfileDTO dto) {
         userProfileService.addProfile(dto);
         return Result.success();
     }
 
     /**
-     * 修改子用户
+     * 修改用户
      *
-     * @param dto 子用户信息
+     * @param dto 用户信息
      * @return 操作结果
      */
     @PutMapping
-    @Log(value = "修改子用户", module = "用户管理", operationType = OperationType.UPDATE)
-    public Result<Void> update(@RequestBody UserProfileDTO dto) {
+    @Log(value = "修改用户", module = "用户管理", operationType = OperationType.UPDATE)
+    public Result<Void> update(@RequestBody @Valid UserProfileDTO dto) {
         userProfileService.updateProfile(dto);
         return Result.success();
     }
 
     /**
-     * 删除子用户
+     * 删除用户
      *
-     * @param id 子用户ID
+     * @param id 用户ID
      * @return 操作结果
      */
     @DeleteMapping("/{id}")
-    @Log(value = "删除子用户", module = "用户管理", operationType = OperationType.DELETE)
+    @Log(value = "删除用户", module = "用户管理", operationType = OperationType.DELETE)
     public Result<Void> delete(@PathVariable Long id) {
         userProfileService.deleteProfile(id);
         return Result.success();
     }
+
+    /**
+     * 批量删除用户
+     *
+     * @param ids 用户ID列表
+     * @return 操作结果
+     */
+    @DeleteMapping("/batch")
+    @Log(value = "批量删除用户", module = "用户管理", operationType = OperationType.DELETE)
+    public Result<Void> batchDelete(@RequestBody List<Long> ids) {
+        userProfileService.batchDelete(ids);
+        return Result.success();
+    }
+
+    /**
+     * 批量导入用户
+     *
+     * @param list 用户信息列表
+     * @return 操作结果
+     */
+    @PostMapping("/import")
+    @Log(value = "批量导入用户", module = "用户管理", operationType = OperationType.INSERT)
+    public Result<Void> batchImport(@RequestBody List<UserProfileDTO> list) {
+        userProfileService.batchImport(list);
+        return Result.success();
+    }
+
+    /**
+     * 查询用户档案选项列表(用于设备绑定用户下拉选择)
+     *
+     * @param keyword 搜索关键字(姓名或手机号,选填)
+     * @return 用户列表(id/name/phone/gender)
+     */
+    @GetMapping("/options")
+    @Log(value = "查询用户选项列表", module = "用户管理", operationType = OperationType.QUERY)
+    public Result<List<UserProfile>> options(@RequestParam(required = false) String keyword) {
+        return Result.success(userProfileService.listOptions(keyword));
+    }
 }
+

+ 28 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/controller/dto/AcupointQueryDTO.java

@@ -0,0 +1,28 @@
+package com.aijiuyi.admin.controller.dto;
+
+import lombok.Data;
+
+/**
+ * 穴位查询条件 DTO
+ */
+@Data
+public class AcupointQueryDTO {
+
+    /** 穴位名称(模糊搜索) */
+    private String name;
+
+    /** 所属经络 */
+    private String meridian;
+
+    /** 定位方式:1=相对定位,2=绝对定位 */
+    private Integer locationType;
+
+    /** 状态:1=活跃,0=待完善 */
+    private Integer status;
+
+    /** 当前页码,默认第1页 */
+    private Integer pageNum = 1;
+
+    /** 每页条数,默认10条 */
+    private Integer pageSize = 10;
+}

+ 31 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/controller/dto/DeviceQueryDTO.java

@@ -0,0 +1,31 @@
+package com.aijiuyi.admin.controller.dto;
+
+import lombok.Data;
+
+/**
+ * 设备管理列表查询请求 DTO
+ */
+@Data
+public class DeviceQueryDTO {
+
+    /** 设备编号(模糊搜索) */
+    private String deviceCode;
+
+    /** 设备名称(模糊搜索) */
+    private String deviceName;
+
+    /** 绑定用户姓名(模糊搜索,匹配该设备下任意绑定用户) */
+    private String boundUserName;
+
+    /** 在线状态:1=在线,0=离线,null=全部 */
+    private Integer onlineStatus;
+
+    /** 固件版本(精确匹配,null=全部) */
+    private String firmwareVersion;
+
+    /** 当前页码(从1开始) */
+    private Integer pageNum = 1;
+
+    /** 每页条数 */
+    private Integer pageSize = 10;
+}

+ 39 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/controller/dto/DeviceSaveDTO.java

@@ -0,0 +1,39 @@
+package com.aijiuyi.admin.controller.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 设备新增/编辑请求 DTO
+ */
+@Data
+public class DeviceSaveDTO {
+
+    /** 主键ID(新增时为 null,编辑时必填) */
+    private Long id;
+
+    /** 设备编号(唯一,新增必填,编辑时不可修改) */
+    private String deviceCode;
+
+    /** 设备名称(必填,最长100字符) */
+    private String deviceName;
+
+    /** 设备型号(必填,AJY-2026 / AJY-2025) */
+    private String deviceModel;
+
+    /** 设备序列号(唯一,必填,最长50字符) */
+    private String serialNo;
+
+    /** 固件版本(必填,如:v1.2.0) */
+    private String firmwareVersion;
+
+    /** 备注(选填,最长200字符) */
+    private String remark;
+
+    /**
+     * 绑定用户ID列表(user_profile.id,选填)
+     * 新增:绑定初始用户;编辑:与当前绑定用户做差集合并(null 表示不变更绑定关系,空列表表示清空所有绑定)
+     */
+    private List<Long> userIds;
+}

+ 25 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/controller/dto/MoxibustionTechniqueQueryDTO.java

@@ -0,0 +1,25 @@
+package com.aijiuyi.admin.controller.dto;
+
+import lombok.Data;
+
+/**
+ * 艾灸手法查询条件 DTO
+ */
+@Data
+public class MoxibustionTechniqueQueryDTO {
+
+    /** 手法名称(模糊搜索) */
+    private String name;
+
+    /** 运动模式(精确匹配) */
+    private String motionMode;
+
+    /** 状态:1=启用,0=禁用 */
+    private Integer status;
+
+    /** 当前页码,默认第1页 */
+    private Integer pageNum = 1;
+
+    /** 每页条数,默认10条 */
+    private Integer pageSize = 10;
+}

+ 37 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/controller/dto/PlanQueryDTO.java

@@ -0,0 +1,37 @@
+package com.aijiuyi.admin.controller.dto;
+
+import lombok.Data;
+
+/**
+ * 方案列表查询条件 DTO
+ */
+@Data
+public class PlanQueryDTO {
+
+    /** 方案名称(模糊搜索) */
+    private String name;
+
+    /** 模式类型:1=一键艾灸,2=专业模式,3=自定义模式,4=延年圣手 */
+    private Integer modeType;
+
+    /** 功效类型:驱寒/祛湿/祛风/化瘀/活血/化痰/养颜/扶阳 */
+    private String effectType;
+
+    /** 创作人名称(模糊搜索) */
+    private String authorName;
+
+    /** 状态:0=草稿,1=已发布,2=已下架 */
+    private Integer status;
+
+    /** 创建时间开始 */
+    private String createTimeStart;
+
+    /** 创建时间结束 */
+    private String createTimeEnd;
+
+    /** 当前页码,默认第1页 */
+    private Integer pageNum = 1;
+
+    /** 每页条数,默认10条 */
+    private Integer pageSize = 10;
+}

+ 58 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/controller/dto/PlanSaveDTO.java

@@ -0,0 +1,58 @@
+package com.aijiuyi.admin.controller.dto;
+
+import com.aijiuyi.admin.entity.PlanStep;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 方案新增/编辑 DTO(含步骤列表)
+ */
+@Data
+public class PlanSaveDTO {
+
+    /** 方案ID(编辑时传递,新增时为空) */
+    private Long id;
+
+    /** 方案编码(新增时由系统生成,编辑时不可修改) */
+    private String planCode;
+
+    /** 方案名称(最长100字符) */
+    private String name;
+
+    /** 模式类型:1=一键艾灸,2=专业模式,3=自定义模式,4=延年圣手 */
+    private Integer modeType;
+
+    /** 功效类型:驱寒/祛湿/祛风/化瘀/活血/化痰/养颜/扶阳 */
+    private String effectType;
+
+    /** 适用症状(逗号分隔) */
+    private String symptoms;
+
+    /** 适用人群:0=不限,1=仅男,2=仅女 */
+    private Integer applicableGender;
+
+    /** 适用年龄最小值(岁) */
+    private Integer ageMin;
+
+    /** 适用年龄最大值(岁) */
+    private Integer ageMax;
+
+    /** 方案描述(最长200字符) */
+    private String description;
+
+    /** 创作人类型:1=管理员,2=普通用户,3=专家 */
+    private Integer authorType;
+
+    /** 创作人ID */
+    private Long authorId;
+
+    /** 创作人名称 */
+    private String authorName;
+
+    /** 状态:0=草稿,1=已发布,2=已下架(新增时默认草稿) */
+    private Integer status;
+
+    /** 治疗步骤列表 */
+    private List<PlanStep> steps;
+}

+ 22 - 4
openspec/backend/src/main/java/com/aijiuyi/admin/controller/dto/UserProfileDTO.java

@@ -4,6 +4,7 @@ import lombok.Data;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
 import java.math.BigDecimal;
 
 /**
@@ -16,7 +17,6 @@ public class UserProfileDTO {
     private Long id;
 
     /** 所属应用用户ID(新增时必填) */
-    @NotNull(message = "所属用户ID不能为空")
     private Long userId;
 
     /** 姓名(必填) */
@@ -24,17 +24,35 @@ public class UserProfileDTO {
     private String name;
 
     /** 性别:1=男,2=女 */
+    @NotNull(message = "性别不能为空")
     private Integer gender;
 
-    /** 年龄 */
+    /** 年龄(必填,1-120) */
+    @NotNull(message = "年龄不能为空")
     private Integer age;
 
-    /** 肩宽(cm) */
+    /** 手机号(必填,11位格式) */
+    @NotBlank(message = "手机号不能为空")
+    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
+    private String phone;
+
+    /** 肩宽(cm,必填) */
+    @NotNull(message = "肩宽不能为空")
     private BigDecimal shoulderWidth;
 
-    /** 身长(cm) */
+    /** 身长(cm,必填) */
+    @NotNull(message = "身长不能为空")
     private BigDecimal bodyHeight;
 
+    /** 1寸指宽(cm,选填) */
+    private BigDecimal fingerWidth1;
+
+    /** 1.5寸指宽(cm,选填) */
+    private BigDecimal fingerWidth15;
+
+    /** 3寸指宽(cm,选填) */
+    private BigDecimal fingerWidth3;
+
     /** 用户穴位表ID */
     private Long acupointTableId;
 }

+ 34 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/controller/dto/UserProfileQueryDTO.java

@@ -0,0 +1,34 @@
+package com.aijiuyi.admin.controller.dto;
+
+import lombok.Data;
+
+/**
+ * 子用户列表查询条件 DTO
+ */
+@Data
+public class UserProfileQueryDTO {
+
+    /** 姓名或手机号(模糊搜索) */
+    private String keyword;
+
+    /** 设备编号(模糊搜索) */
+    private String deviceCode;
+
+    /** 性别:1=男,2=女,不传则查全部 */
+    private Integer gender;
+
+    /** 注册时间开始(格式:yyyy-MM-dd HH:mm:ss) */
+    private String startTime;
+
+    /** 注册时间结束(格式:yyyy-MM-dd HH:mm:ss) */
+    private String endTime;
+
+    /** 穴位表状态:1=已生成,0=未生成,不传则查全部 */
+    private Integer acupointStatus;
+
+    /** 当前页码,默认第1页 */
+    private Integer pageNum = 1;
+
+    /** 每页条数,默认10条 */
+    private Integer pageSize = 10;
+}

+ 87 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/entity/Acupoint.java

@@ -0,0 +1,87 @@
+package com.aijiuyi.admin.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * 穴位信息实体
+ * 对应数据库 acupoint 表
+ */
+@Data
+@TableName("acupoint")
+public class Acupoint {
+
+    /** 主键ID */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /** 穴位编码(唯一标识,如 dazhui) */
+    private String acupointCode;
+
+    /** 穴位名称(如:大椎穴) */
+    private String name;
+
+    /** 所属经络(如:督脉、足太阳膀胱经) */
+    private String meridian;
+
+    /**
+     * 功效描述(逗号分隔,如:驱寒,祛湿)
+     * 可选值:驱寒/祛湿/祛风/化瘀/活血/化痰/养颜/扶阳
+     */
+    private String effects;
+
+    /**
+     * 定位方式:1=相对定位,2=绝对定位
+     */
+    private Integer locationType;
+
+    /** 相对大椎穴纵向偏移(寸) */
+    private BigDecimal longitudeOffset;
+
+    /** 相对大椎穴横向偏移(寸,双侧穴位填写) */
+    private BigDecimal lateralOffset;
+
+    /**
+     * 侧别:1=中心,2=左侧,3=右侧,4=双侧
+     */
+    private Integer side;
+
+    /**
+     * 指寸类型:1=一寸,2=1.5寸,3=三寸
+     */
+    private Integer fingerWidthType;
+
+    /** 绝对坐标X(mm) */
+    private BigDecimal absX;
+
+    /** 绝对坐标Y(mm) */
+    private BigDecimal absY;
+
+    /** 绝对坐标Z(mm) */
+    private BigDecimal absZ;
+
+    /**
+     * 适用性别:0=不限,1=仅男,2=仅女
+     */
+    private Integer gender;
+
+    /**
+     * 状态:1=活跃,0=待完善
+     */
+    private Integer status;
+
+    /** 逻辑删除:0=未删除,1=已删除 */
+    @TableLogic
+    private Integer deleted;
+
+    /** 创建时间(自动填充) */
+    @TableField(fill = FieldFill.INSERT)
+    private LocalDateTime createTime;
+
+    /** 更新时间(自动填充) */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private LocalDateTime updateTime;
+}

+ 70 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/entity/Device.java

@@ -0,0 +1,70 @@
+package com.aijiuyi.admin.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * 艾灸椅设备实体
+ * 对应数据库 device 表
+ */
+@Data
+@TableName("device")
+public class Device {
+
+    /** 主键ID */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /** 设备编号(唯一,如:AJY001) */
+    private String deviceCode;
+
+    /** 设备名称(如:艾灸椅-001) */
+    private String deviceName;
+
+    /** 设备型号(AJY-2026 / AJY-2025) */
+    private String deviceModel;
+
+    /** 设备序列号(唯一) */
+    private String serialNo;
+
+    /** 固件版本(如:v1.2.0) */
+    private String firmwareVersion;
+
+    /** 在线状态:1=在线,0=离线 */
+    private Integer onlineStatus;
+
+    /** 最后在线时间 */
+    private LocalDateTime lastOnlineTime;
+
+    /** 备注 */
+    private String remark;
+
+    /** 逻辑删除:0=未删除,1=已删除 */
+    @TableLogic
+    private Integer deleted;
+
+    /** 创建时间(自动填充) */
+    @TableField(fill = FieldFill.INSERT)
+    private LocalDateTime createTime;
+
+    /** 更新时间(自动填充) */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private LocalDateTime updateTime;
+
+    // ======================== 非数据库字段(联表查询填充)========================
+
+    /** 绑定用户数量(联表聚合) */
+    @TableField(exist = false)
+    private Integer boundUserCount;
+
+    /** 绑定用户姓名列表(联表聚合,顿号分隔) */
+    @TableField(exist = false)
+    private String boundUserNames;
+
+    /** 绑定的用户ID列表(新增/编辑表单使用) */
+    @TableField(exist = false)
+    private List<Long> userIds;
+}

+ 31 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/entity/DeviceUserVO.java

@@ -0,0 +1,31 @@
+package com.aijiuyi.admin.entity;
+
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+ * 设备绑定用户视图对象
+ * 用于设备用户管理页面,联表查询 user_device + user_profile 的结果
+ */
+@Data
+public class DeviceUserVO {
+
+    /** 绑定记录ID(user_device.id) */
+    private Long bindId;
+
+    /** 用户档案ID(user_profile.id) */
+    private Long userId;
+
+    /** 用户姓名 */
+    private String userName;
+
+    /** 用户手机号 */
+    private String phone;
+
+    /** 绑定时间 */
+    private LocalDateTime bindTime;
+
+    /** 是否主用户:1=是,0=否 */
+    private Integer isPrimary;
+}

+ 90 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/entity/MoxibustionTechnique.java

@@ -0,0 +1,90 @@
+package com.aijiuyi.admin.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * 艾灸手法实体
+ * 对应数据库 moxibustion_technique 表
+ */
+@Data
+@TableName("moxibustion_technique")
+public class MoxibustionTechnique {
+
+    /** 主键ID */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 手法编码(唯一标识,如 oneclick)
+     */
+    private String techniqueCode;
+
+    /**
+     * 手法名称(如:一键艾灸)
+     */
+    private String name;
+
+    /**
+     * 运动模式:
+     * default=默认工艺,fixed=固定不动,updown=上下移动,circular=圆周运动,dotted=点状移动
+     */
+    private String motionMode;
+
+    /**
+     * 温度范围最小值(°C,35-50)
+     */
+    private BigDecimal tempMin;
+
+    /**
+     * 温度范围最大值(°C,35-50)
+     */
+    private BigDecimal tempMax;
+
+    /**
+     * 时间范围最小值(分钟,1-30)
+     */
+    private Integer timeMin;
+
+    /**
+     * 时间范围最大值(分钟,1-30)
+     */
+    private Integer timeMax;
+
+    /**
+     * 运动幅度(mm,1-20)
+     * 运动模式非"固定不动"时必填
+     */
+    private BigDecimal motionAmplitude;
+
+    /**
+     * 运动速度(mm/s,1-10)
+     * 运动模式非"固定不动"时必填
+     */
+    private BigDecimal motionSpeed;
+
+    /**
+     * 状态:1=启用,0=禁用
+     */
+    private Integer status;
+
+    /**
+     * 备注(最长200字符)
+     */
+    private String remark;
+
+    /** 逻辑删除:0=未删除,1=已删除 */
+    @TableLogic
+    private Integer deleted;
+
+    /** 创建时间(自动填充) */
+    @TableField(fill = FieldFill.INSERT)
+    private LocalDateTime createTime;
+
+    /** 更新时间(自动填充) */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private LocalDateTime updateTime;
+}

+ 90 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/entity/Plan.java

@@ -0,0 +1,90 @@
+package com.aijiuyi.admin.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * 方案实体
+ * 对应数据库 plan 表
+ */
+@Data
+@TableName("plan")
+public class Plan {
+
+    /** 主键ID */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /** 方案编码(唯一标识,如 S001) */
+    private String planCode;
+
+    /** 方案名称(最长100字符) */
+    private String name;
+
+    /**
+     * 模式类型:1=一键艾灸,2=专业模式,3=自定义模式,4=延年圣手
+     */
+    private Integer modeType;
+
+    /**
+     * 功效类型:驱寒/祛湿/祛风/化瘀/活血/化痰/养颜/扶阳
+     */
+    private String effectType;
+
+    /** 适用症状(逗号分隔:怕冷,感冒,咳嗽,...) */
+    private String symptoms;
+
+    /**
+     * 适用人群:0=不限,1=仅男,2=仅女
+     */
+    private Integer applicableGender;
+
+    /** 适用年龄最小值(岁) */
+    private Integer ageMin;
+
+    /** 适用年龄最大值(岁) */
+    private Integer ageMax;
+
+    /** 方案描述(最长200字符) */
+    private String description;
+
+    /**
+     * 创作人类型:1=管理员,2=普通用户,3=专家
+     */
+    private Integer authorType;
+
+    /** 创作人ID(对应 sys_user.id 或 app_user.id) */
+    private Long authorId;
+
+    /** 创作人名称(冗余存储,加速查询) */
+    private String authorName;
+
+    /**
+     * 状态:0=草稿,1=已发布,2=已下架
+     */
+    private Integer status;
+
+    /** 使用人数 */
+    private Integer useCount;
+
+    /** 平均评分 */
+    private BigDecimal avgRating;
+
+    /** 最后使用时间 */
+    private LocalDateTime lastUseTime;
+
+    /** 逻辑删除:0=未删除,1=已删除 */
+    @TableLogic
+    private Integer deleted;
+
+    /** 创建时间(自动填充) */
+    @TableField(fill = FieldFill.INSERT)
+    private LocalDateTime createTime;
+
+    /** 更新时间(自动填充) */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private LocalDateTime updateTime;
+}

+ 64 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/entity/PlanStep.java

@@ -0,0 +1,64 @@
+package com.aijiuyi.admin.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * 方案步骤实体
+ * 对应数据库 plan_step 表
+ */
+@Data
+@TableName("plan_step")
+public class PlanStep {
+
+    /** 主键ID */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /** 方案ID(关联 plan.id) */
+    private Long planId;
+
+    /** 步骤序号(从1开始) */
+    private Integer stepOrder;
+
+    /** 穴位ID(关联 acupoint.id) */
+    private Long acupointId;
+
+    /** 穴位名称(冗余存储) */
+    private String acupointName;
+
+    /**
+     * 侧别:1=中心,2=左侧,3=右侧,4=双侧
+     */
+    private Integer side;
+
+    /** 温度(°C,35-50) */
+    private BigDecimal temperature;
+
+    /** 时间(分钟,1-30) */
+    private Integer duration;
+
+    /** 艾灸手法ID(关联 moxibustion_technique.id) */
+    private Long techniqueId;
+
+    /** 艾灸手法名称(冗余存储) */
+    private String techniqueName;
+
+    /** 备注(最长100字符) */
+    private String remark;
+
+    /** 逻辑删除:0=未删除,1=已删除 */
+    @TableLogic
+    private Integer deleted;
+
+    /** 创建时间(自动填充) */
+    @TableField(fill = FieldFill.INSERT)
+    private LocalDateTime createTime;
+
+    /** 更新时间(自动填充) */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private LocalDateTime updateTime;
+}

+ 56 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/entity/UserAcupoint.java

@@ -0,0 +1,56 @@
+package com.aijiuyi.admin.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * 用户穴位坐标实体
+ * 对应数据库 user_acupoint 表
+ * 根据用户体型数据(指宽/肩宽/身长)与穴位定位参数计算生成
+ */
+@Data
+@TableName("user_acupoint")
+public class UserAcupoint {
+
+    /** 主键ID */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /** 子用户ID(关联 user_profile.id) */
+    private Long userId;
+
+    /** 穴位ID(关联 acupoint.id) */
+    private Long acupointId;
+
+    /** 穴位名称(冗余存储,加速查询) */
+    private String acupointName;
+
+    /**
+     * 侧别:center=中心,left=左侧,right=右侧
+     * 双侧穴位(acupoint.side=4)会生成两条记录(left+right)
+     */
+    private String acupointSide;
+
+    /** 相对大椎穴纵向偏移(寸) */
+    private BigDecimal cunValue;
+
+    /** 指寸类型:1寸/1.5寸/3寸 */
+    private String cunType;
+
+    /** 计算后的X坐标(mm,相对大椎穴中心,向右为正) */
+    private BigDecimal coordinateX;
+
+    /** 计算后的Y坐标(mm,相对大椎穴中心,向下为正) */
+    private BigDecimal coordinateY;
+
+    /** 首次生成时间(自动填充) */
+    @TableField(fill = FieldFill.INSERT)
+    private LocalDateTime createTime;
+
+    /** 最后更新时间(自动填充) */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private LocalDateTime updateTime;
+}

+ 14 - 1
openspec/backend/src/main/java/com/aijiuyi/admin/entity/UserDevice.java

@@ -17,7 +17,7 @@ public class UserDevice {
     @TableId(type = IdType.AUTO)
     private Long id;
 
-    /** 所属应用用户ID(关联 app_user.id) */
+    /** 所属子用户ID(关联 user_profile.id) */
     private Long userId;
 
     /** 设备唯一编码 */
@@ -26,12 +26,25 @@ public class UserDevice {
     /** 设备名称 */
     private String deviceName;
 
+    /** 设备型号 */
+    private String deviceModel;
+
+    /** 是否主设备:1=是,0=否 */
+    private Integer isPrimary;
+
+    /** 在线状态:1=在线,0=离线 */
+    private Integer onlineStatus;
+
     /** 绑定状态:1=已绑定,0=已解绑 */
     private Integer status;
 
     /** 绑定时间 */
     private LocalDateTime bindTime;
 
+    /** 逻辑删除:0=未删除,1=已删除 */
+    @TableLogic
+    private Integer deleted;
+
     /** 创建时间(自动填充) */
     @TableField(fill = FieldFill.INSERT)
     private LocalDateTime createTime;

+ 61 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/entity/UserPlan.java

@@ -0,0 +1,61 @@
+package com.aijiuyi.admin.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+ * 用户方案实体
+ * 对应数据库 user_plan 表
+ * 记录用户个性化工艺参数方案
+ */
+@Data
+@TableName("user_plan")
+public class UserPlan {
+
+    /** 主键ID */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /** 子用户ID(关联 user_profile.id) */
+    private Long userId;
+
+    /** 方案ID(关联 plan.id) */
+    private Long planId;
+
+    /** 方案编码(冗余存储) */
+    private String planCode;
+
+    /** 方案名称(冗余存储) */
+    private String planName;
+
+    /**
+     * 模式类型:1=一键艾灸,2=专业模式,3=自定义模式,4=延年圣手
+     */
+    private Integer modeType;
+
+    /** 创作人名称(冗余存储) */
+    private String authorName;
+
+    /** 步骤数量 */
+    private Integer stepCount;
+
+    /** 使用次数 */
+    private Integer useCount;
+
+    /** 个性化工艺步骤(JSON格式,含坐标/温度/时间等) */
+    private String stepsJson;
+
+    /** 逻辑删除:0=未删除,1=已删除 */
+    @TableLogic
+    private Integer deleted;
+
+    /** 订阅/生成时间(自动填充) */
+    @TableField(fill = FieldFill.INSERT)
+    private LocalDateTime createTime;
+
+    /** 更新时间(自动填充) */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private LocalDateTime updateTime;
+}

+ 24 - 1
openspec/backend/src/main/java/com/aijiuyi/admin/entity/UserProfile.java

@@ -30,15 +30,34 @@ public class UserProfile {
     /** 年龄 */
     private Integer age;
 
+    /** 手机号(11位,唯一) */
+    private String phone;
+
     /** 肩宽(cm) */
     private BigDecimal shoulderWidth;
 
-    /** 身长(cm) */
+    /** 身长(cm)(坐高) */
     private BigDecimal bodyHeight;
 
+    /** 1寸指宽(cm,选填,提高穴位精度) */
+    @TableField("finger_width_1")
+    private BigDecimal fingerWidth1;
+
+    /** 1.5寸指宽(cm,选填) */
+    @TableField("finger_width_15")
+    private BigDecimal fingerWidth15;
+
+    /** 3寸指宽(cm,选填) */
+    @TableField("finger_width_3")
+    private BigDecimal fingerWidth3;
+
     /** 用户穴位表ID */
     private Long acupointTableId;
 
+    /** 逻辑删除:0=未删除,1=已删除 */
+    @TableLogic
+    private Integer deleted;
+
     /** 创建时间(自动填充) */
     @TableField(fill = FieldFill.INSERT)
     private LocalDateTime createTime;
@@ -46,4 +65,8 @@ public class UserProfile {
     /** 更新时间(自动填充) */
     @TableField(fill = FieldFill.INSERT_UPDATE)
     private LocalDateTime updateTime;
+
+    /** 绑定设备编号(逗号分隔,非数据库字段,查询时JOIN填充) */
+    @TableField(exist = false)
+    private String deviceCodes;
 }

+ 12 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/mapper/AcupointMapper.java

@@ -0,0 +1,12 @@
+package com.aijiuyi.admin.mapper;
+
+import com.aijiuyi.admin.entity.Acupoint;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 穴位信息 Mapper 接口
+ */
+@Mapper
+public interface AcupointMapper extends BaseMapper<Acupoint> {
+}

+ 36 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/mapper/DeviceMapper.java

@@ -0,0 +1,36 @@
+package com.aijiuyi.admin.mapper;
+
+import com.aijiuyi.admin.controller.dto.DeviceQueryDTO;
+import com.aijiuyi.admin.entity.Device;
+import com.aijiuyi.admin.entity.DeviceUserVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 设备管理 Mapper
+ */
+@Mapper
+public interface DeviceMapper extends BaseMapper<Device> {
+
+    /**
+     * 分页查询设备列表(联表聚合绑定用户数和用户姓名)
+     *
+     * @param page     分页参数
+     * @param queryDTO 查询条件
+     * @return 分页结果
+     */
+    IPage<Device> pageWithUsers(Page<Device> page, @Param("q") DeviceQueryDTO queryDTO);
+
+    /**
+     * 根据设备编号查询绑定的用户列表
+     *
+     * @param deviceCode 设备编号
+     * @return 绑定用户列表
+     */
+    List<DeviceUserVO> getUsersByDeviceCode(@Param("deviceCode") String deviceCode);
+}

+ 12 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/mapper/MoxibustionTechniqueMapper.java

@@ -0,0 +1,12 @@
+package com.aijiuyi.admin.mapper;
+
+import com.aijiuyi.admin.entity.MoxibustionTechnique;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 艾灸手法 Mapper 接口
+ */
+@Mapper
+public interface MoxibustionTechniqueMapper extends BaseMapper<MoxibustionTechnique> {
+}

+ 12 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/mapper/PlanMapper.java

@@ -0,0 +1,12 @@
+package com.aijiuyi.admin.mapper;
+
+import com.aijiuyi.admin.entity.Plan;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 方案 Mapper 接口
+ */
+@Mapper
+public interface PlanMapper extends BaseMapper<Plan> {
+}

+ 12 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/mapper/PlanStepMapper.java

@@ -0,0 +1,12 @@
+package com.aijiuyi.admin.mapper;
+
+import com.aijiuyi.admin.entity.PlanStep;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 方案步骤 Mapper 接口
+ */
+@Mapper
+public interface PlanStepMapper extends BaseMapper<PlanStep> {
+}

+ 38 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/mapper/UserAcupointMapper.java

@@ -0,0 +1,38 @@
+package com.aijiuyi.admin.mapper;
+
+import com.aijiuyi.admin.entity.UserAcupoint;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 用户穴位坐标 Mapper
+ */
+@Mapper
+public interface UserAcupointMapper extends BaseMapper<UserAcupoint> {
+
+    /**
+     * 查询指定子用户的所有穴位坐标列表
+     *
+     * @param userId 子用户ID(user_profile.id)
+     * @return 穴位坐标列表
+     */
+    List<UserAcupoint> listByUserId(@Param("userId") Long userId);
+
+    /**
+     * 删除指定子用户的所有穴位坐标记录(物理删除,用于重新生成前清空)
+     *
+     * @param userId 子用户ID
+     */
+    void deleteByUserId(@Param("userId") Long userId);
+
+    /**
+     * 删除指定子用户下某穴位的坐标记录(物理删除,用于按穴位局部更新)
+     *
+     * @param userId     子用户ID
+     * @param acupointId 穴位ID
+     */
+    void deleteByUserIdAndAcupointId(@Param("userId") Long userId, @Param("acupointId") Long acupointId);
+}

+ 12 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/mapper/UserPlanMapper.java

@@ -0,0 +1,12 @@
+package com.aijiuyi.admin.mapper;
+
+import com.aijiuyi.admin.entity.UserPlan;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 用户方案 Mapper 接口
+ */
+@Mapper
+public interface UserPlanMapper extends BaseMapper<UserPlan> {
+}

+ 14 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/mapper/UserProfileMapper.java

@@ -1,12 +1,26 @@
 package com.aijiuyi.admin.mapper;
 
+import com.aijiuyi.admin.controller.dto.UserProfileQueryDTO;
 import com.aijiuyi.admin.entity.UserProfile;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 子用户信息 Mapper
  */
 @Mapper
 public interface UserProfileMapper extends BaseMapper<UserProfile> {
+
+    /**
+     * 分页查询子用户列表(联表获取绑定设备编号)
+     *
+     * @param page     分页对象
+     * @param queryDTO 查询条件
+     * @return 分页结果(含设备编号字段 deviceCodes)
+     */
+    IPage<UserProfile> pageWithDevices(Page<UserProfile> page, @Param("q") UserProfileQueryDTO queryDTO);
 }
+

+ 57 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/service/AcupointService.java

@@ -0,0 +1,57 @@
+package com.aijiuyi.admin.service;
+
+import com.aijiuyi.admin.controller.dto.AcupointQueryDTO;
+import com.aijiuyi.admin.entity.Acupoint;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 穴位管理 Service 接口
+ */
+public interface AcupointService extends IService<Acupoint> {
+
+    /**
+     * 分页查询穴位列表
+     *
+     * @param queryDTO 查询条件
+     * @return 分页结果
+     */
+    IPage<Acupoint> pageList(AcupointQueryDTO queryDTO);
+
+    /**
+     * 新增穴位
+     *
+     * @param acupoint 穴位信息
+     */
+    void addAcupoint(Acupoint acupoint);
+
+    /**
+     * 修改穴位信息
+     *
+     * @param acupoint 穴位信息
+     */
+    void updateAcupoint(Acupoint acupoint);
+
+    /**
+     * 删除穴位(逻辑删除)
+     *
+     * @param id 穴位ID
+     */
+    void deleteAcupoint(Long id);
+
+    /**
+     * 批量删除穴位(逻辑删除)
+     *
+     * @param ids 穴位ID列表
+     */
+    void batchDeleteAcupoint(List<Long> ids);
+
+    /**
+     * 批量导入穴位
+     *
+     * @param list 穴位信息列表
+     */
+    void batchImport(List<Acupoint> list);
+}

+ 99 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/service/DeviceService.java

@@ -0,0 +1,99 @@
+package com.aijiuyi.admin.service;
+
+import com.aijiuyi.admin.controller.dto.DeviceQueryDTO;
+import com.aijiuyi.admin.controller.dto.DeviceSaveDTO;
+import com.aijiuyi.admin.entity.Device;
+import com.aijiuyi.admin.entity.DeviceUserVO;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 设备管理 Service 接口
+ */
+public interface DeviceService extends IService<Device> {
+
+    /**
+     * 分页查询设备列表(联表聚合绑定用户信息)
+     *
+     * @param queryDTO 查询条件
+     * @return 分页结果
+     */
+    IPage<Device> pageList(DeviceQueryDTO queryDTO);
+
+    /**
+     * 新增设备(可同时绑定初始用户)
+     *
+     * @param dto 设备信息
+     */
+    void addDevice(DeviceSaveDTO dto);
+
+    /**
+     * 修改设备信息(可同步更新绑定用户)
+     *
+     * @param dto 设备信息
+     */
+    void updateDevice(DeviceSaveDTO dto);
+
+    /**
+     * 删除设备(逻辑删除,同步解绑所有用户)
+     *
+     * @param id 设备ID
+     */
+    void deleteDevice(Long id);
+
+    /**
+     * 批量删除设备(逻辑删除,同步解绑所有用户)
+     *
+     * @param ids 设备ID列表
+     */
+    void batchDeleteDevices(List<Long> ids);
+
+    /**
+     * 批量导入设备(跳过编号已存在的记录)
+     *
+     * @param list 设备信息列表
+     */
+    void batchImport(List<Device> list);
+
+    /**
+     * 查询设备绑定的用户列表
+     *
+     * @param deviceId 设备ID
+     * @return 绑定用户列表
+     */
+    List<DeviceUserVO> getDeviceUsers(Long deviceId);
+
+    /**
+     * 为设备添加绑定用户
+     *
+     * @param deviceId  设备ID
+     * @param profileId 用户档案ID(user_profile.id)
+     */
+    void addDeviceUser(Long deviceId, Long profileId);
+
+    /**
+     * 解绑设备用户
+     *
+     * @param deviceId  设备ID
+     * @param profileId 用户档案ID
+     */
+    void removeDeviceUser(Long deviceId, Long profileId);
+
+    /**
+     * 设为主用户(同一设备下只能有一个主用户)
+     *
+     * @param deviceId  设备ID
+     * @param profileId 用户档案ID
+     */
+    void setDeviceUserPrimary(Long deviceId, Long profileId);
+
+    /**
+     * 批量解绑设备用户
+     *
+     * @param deviceId 设备ID
+     * @param bindIds  绑定记录ID列表(user_device.id)
+     */
+    void batchRemoveDeviceUsers(Long deviceId, List<Long> bindIds);
+}

+ 50 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/service/MoxibustionTechniqueService.java

@@ -0,0 +1,50 @@
+package com.aijiuyi.admin.service;
+
+import com.aijiuyi.admin.controller.dto.MoxibustionTechniqueQueryDTO;
+import com.aijiuyi.admin.entity.MoxibustionTechnique;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 艾灸手法管理 Service 接口
+ */
+public interface MoxibustionTechniqueService extends IService<MoxibustionTechnique> {
+
+    /**
+     * 分页查询艾灸手法列表
+     *
+     * @param queryDTO 查询条件
+     * @return 分页结果
+     */
+    IPage<MoxibustionTechnique> pageList(MoxibustionTechniqueQueryDTO queryDTO);
+
+    /**
+     * 新增艾灸手法
+     *
+     * @param technique 手法信息
+     */
+    void addTechnique(MoxibustionTechnique technique);
+
+    /**
+     * 修改艾灸手法信息
+     *
+     * @param technique 手法信息
+     */
+    void updateTechnique(MoxibustionTechnique technique);
+
+    /**
+     * 删除艾灸手法(逻辑删除)
+     *
+     * @param id 手法ID
+     */
+    void deleteTechnique(Long id);
+
+    /**
+     * 批量删除艾灸手法(逻辑删除)
+     *
+     * @param ids 手法ID列表
+     */
+    void batchDeleteTechnique(List<Long> ids);
+}

+ 96 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/service/PlanService.java

@@ -0,0 +1,96 @@
+package com.aijiuyi.admin.service;
+
+import com.aijiuyi.admin.controller.dto.PlanQueryDTO;
+import com.aijiuyi.admin.controller.dto.PlanSaveDTO;
+import com.aijiuyi.admin.entity.Plan;
+import com.aijiuyi.admin.entity.PlanStep;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 方案管理 Service 接口
+ */
+public interface PlanService extends IService<Plan> {
+
+    /**
+     * 分页查询方案列表
+     *
+     * @param queryDTO 查询条件
+     * @return 分页结果
+     */
+    IPage<Plan> pageList(PlanQueryDTO queryDTO);
+
+    /**
+     * 查询方案详情(含步骤列表)
+     *
+     * @param id 方案ID
+     * @return 方案详情
+     */
+    PlanSaveDTO getDetail(Long id);
+
+    /**
+     * 新增方案(含步骤)
+     *
+     * @param dto 方案信息
+     */
+    void addPlan(PlanSaveDTO dto);
+
+    /**
+     * 修改方案(含步骤)
+     *
+     * @param dto 方案信息
+     */
+    void updatePlan(PlanSaveDTO dto);
+
+    /**
+     * 删除方案(逻辑删除,仅草稿状态可删)
+     *
+     * @param id 方案ID
+     */
+    void deletePlan(Long id);
+
+    /**
+     * 批量删除方案(仅草稿状态可删)
+     *
+     * @param ids 方案ID列表
+     */
+    void batchDeletePlan(List<Long> ids);
+
+    /**
+     * 发布方案(草稿 → 已发布)
+     *
+     * @param id 方案ID
+     */
+    void publishPlan(Long id);
+
+    /**
+     * 批量发布方案
+     *
+     * @param ids 方案ID列表
+     */
+    void batchPublishPlan(List<Long> ids);
+
+    /**
+     * 下架方案(已发布 → 已下架)
+     *
+     * @param id 方案ID
+     */
+    void offshelfPlan(Long id);
+
+    /**
+     * 批量下架方案
+     *
+     * @param ids 方案ID列表
+     */
+    void batchOffshelfPlan(List<Long> ids);
+
+    /**
+     * 查询方案步骤列表
+     *
+     * @param planId 方案ID
+     * @return 步骤列表
+     */
+    List<PlanStep> getStepsByPlanId(Long planId);
+}

+ 37 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/service/UserAcupointService.java

@@ -0,0 +1,37 @@
+package com.aijiuyi.admin.service;
+
+import com.aijiuyi.admin.entity.UserAcupoint;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 用户穴位坐标 Service 接口
+ * 提供穴位坐标生成、查询功能
+ */
+public interface UserAcupointService extends IService<UserAcupoint> {
+
+    /**
+     * 为指定子用户生成(或重新生成)全量穴位坐标
+     * 生成逻辑:先清除该用户所有旧记录,再根据当前全量活跃穴位重新计算并插入
+     *
+     * @param profileId 子用户ID(user_profile.id)
+     */
+    void generateForUser(Long profileId);
+
+    /**
+     * 当穴位管理新增一条穴位时,为所有子用户追加该穴位的坐标记录
+     * 如果该用户尚未生成过穴位表(user_profile.acupoint_table_id 为空),则跳过
+     *
+     * @param acupointId 新增的穴位ID
+     */
+    void generateForAllUsersByAcupoint(Long acupointId);
+
+    /**
+     * 查询指定子用户的穴位坐标列表
+     *
+     * @param profileId 子用户ID
+     * @return 穴位坐标列表
+     */
+    List<UserAcupoint> listByUser(Long profileId);
+}

+ 25 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/service/UserDeviceService.java

@@ -5,6 +5,8 @@ import com.aijiuyi.admin.entity.UserDevice;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * 用户设备绑定 Service
  */
@@ -18,6 +20,13 @@ public interface UserDeviceService extends IService<UserDevice> {
      */
     IPage<UserDevice> pageList(UserDeviceQueryDTO queryDTO);
 
+    /**
+     * 绑定设备
+     *
+     * @param device 设备信息
+     */
+    void bindDevice(UserDevice device);
+
     /**
      * 解绑设备
      *
@@ -31,4 +40,20 @@ public interface UserDeviceService extends IService<UserDevice> {
      * @param id 设备记录ID
      */
     void deleteDevice(Long id);
+
+    /**
+     * 设置主设备(同一用户下只有一个主设备)
+     *
+     * @param id     设备记录ID
+     * @param userId 所属子用户ID
+     */
+    void setPrimaryDevice(Long id, Long userId);
+
+    /**
+     * 批量解绑设备
+     *
+     * @param ids 设备记录ID列表
+     */
+    void batchUnbindDevices(List<Long> ids);
 }
+

+ 29 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/service/UserPlanService.java

@@ -0,0 +1,29 @@
+package com.aijiuyi.admin.service;
+
+import com.aijiuyi.admin.entity.UserPlan;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 用户方案 Service 接口
+ */
+public interface UserPlanService extends IService<UserPlan> {
+
+    /**
+     * 分页查询某子用户的方案列表
+     *
+     * @param userId   子用户ID
+     * @param pageNum  当前页码
+     * @param pageSize 每页条数
+     * @return 分页结果
+     */
+    IPage<UserPlan> pageByUserId(Long userId, Integer pageNum, Integer pageSize);
+
+    /**
+     * 查询用户方案详情
+     *
+     * @param id 用户方案ID
+     * @return 用户方案详情
+     */
+    UserPlan getDetail(Long id);
+}

+ 29 - 6
openspec/backend/src/main/java/com/aijiuyi/admin/service/UserProfileService.java

@@ -1,25 +1,25 @@
 package com.aijiuyi.admin.service;
 
 import com.aijiuyi.admin.controller.dto.UserProfileDTO;
+import com.aijiuyi.admin.controller.dto.UserProfileQueryDTO;
 import com.aijiuyi.admin.entity.UserProfile;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * 子用户信息 Service
  */
 public interface UserProfileService extends IService<UserProfile> {
 
     /**
-     * 分页查询子用户列表
+     * 分页查询子用户列表(联表获取设备编号)
      *
-     * @param userId   所属用户ID(可选,不传则查询所有)
-     * @param name     姓名(模糊搜索,可选)
-     * @param pageNum  当前页码
-     * @param pageSize 每页条数
+     * @param queryDTO 查询条件
      * @return 分页结果
      */
-    IPage<UserProfile> pageList(Long userId, String name, Integer pageNum, Integer pageSize);
+    IPage<UserProfile> pageList(UserProfileQueryDTO queryDTO);
 
     /**
      * 新增子用户
@@ -41,4 +41,27 @@ public interface UserProfileService extends IService<UserProfile> {
      * @param id 子用户ID
      */
     void deleteProfile(Long id);
+
+    /**
+     * 批量删除子用户
+     *
+     * @param ids 子用户ID列表
+     */
+    void batchDelete(List<Long> ids);
+
+    /**
+     * 批量导入子用户
+     *
+     * @param list 子用户信息列表
+     */
+    void batchImport(List<UserProfileDTO> list);
+
+    /**
+     * 查询用户档案列表(用于下拉选择,支持姓名/手机号模糊搜索,最多返回200条)
+     *
+     * @param keyword 搜索关键字(姓名或手机号,为空则返回全部)
+     * @return 用户档案列表
+     */
+    List<UserProfile> listOptions(String keyword);
 }
+

+ 160 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/service/impl/AcupointServiceImpl.java

@@ -0,0 +1,160 @@
+package com.aijiuyi.admin.service.impl;
+
+import com.aijiuyi.admin.common.constant.ResultCode;
+import com.aijiuyi.admin.common.exception.BusinessException;
+import com.aijiuyi.admin.common.util.LogUtil;
+import com.aijiuyi.admin.controller.dto.AcupointQueryDTO;
+import com.aijiuyi.admin.entity.Acupoint;
+import com.aijiuyi.admin.mapper.AcupointMapper;
+import com.aijiuyi.admin.service.AcupointService;
+import com.aijiuyi.admin.service.UserAcupointService;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+
+import java.util.List;
+
+/**
+ * 穴位管理 Service 实现类
+ */
+@Service
+public class AcupointServiceImpl extends ServiceImpl<AcupointMapper, Acupoint> implements AcupointService {
+
+    /** 用户穴位坐标服务(懒加载避免循环依赖) */
+    @Lazy
+    @Autowired
+    private UserAcupointService userAcupointService;
+
+    /**
+     * 分页查询穴位列表
+     *
+     * @param queryDTO 查询条件
+     * @return 分页结果
+     */
+    @Override
+    public IPage<Acupoint> pageList(AcupointQueryDTO queryDTO) {
+        Page<Acupoint> page = new Page<>(queryDTO.getPageNum(), queryDTO.getPageSize());
+        LambdaQueryWrapper<Acupoint> wrapper = new LambdaQueryWrapper<>();
+        wrapper.like(StringUtils.hasText(queryDTO.getName()), Acupoint::getName, queryDTO.getName())
+               .eq(StringUtils.hasText(queryDTO.getMeridian()), Acupoint::getMeridian, queryDTO.getMeridian())
+               .eq(queryDTO.getLocationType() != null, Acupoint::getLocationType, queryDTO.getLocationType())
+               .eq(queryDTO.getStatus() != null, Acupoint::getStatus, queryDTO.getStatus())
+               .orderByDesc(Acupoint::getCreateTime);
+        return page(page, wrapper);
+    }
+
+    /**
+     * 新增穴位,校验编码和名称唯一性
+     *
+     * @param acupoint 穴位信息
+     */
+    @Override
+    public void addAcupoint(Acupoint acupoint) {
+        // 穴位编码唯一性校验
+        long codeCount = lambdaQuery().eq(Acupoint::getAcupointCode, acupoint.getAcupointCode()).count();
+        if (codeCount > 0) {
+            throw new BusinessException(ResultCode.ACUPOINT_CODE_EXISTS);
+        }
+        // 穴位名称唯一性校验
+        long nameCount = lambdaQuery().eq(Acupoint::getName, acupoint.getName()).count();
+        if (nameCount > 0) {
+            throw new BusinessException(ResultCode.ACUPOINT_NAME_EXISTS);
+        }
+        save(acupoint);
+        LogUtil.info(AcupointServiceImpl.class, "新增穴位[{}],编码[{}]", acupoint.getName(), acupoint.getAcupointCode());
+        // 新增穴位后,异步为所有已生成穴位表的子用户追加该穴位坐标
+        try {
+            userAcupointService.generateForAllUsersByAcupoint(acupoint.getId());
+        } catch (Exception e) {
+            LogUtil.error(AcupointServiceImpl.class,
+                    "新增穴位[" + acupoint.getId() + "]触发用户坐标批量追加失败", e);
+        }
+    }
+
+    /**
+     * 修改穴位信息,校验穴位存在性及名称/编码唯一性
+     *
+     * @param acupoint 穴位信息
+     */
+    @Override
+    public void updateAcupoint(Acupoint acupoint) {
+        Acupoint exist = getById(acupoint.getId());
+        if (exist == null) {
+            throw new BusinessException(ResultCode.ACUPOINT_NOT_FOUND);
+        }
+        // 如果修改了编码,校验唯一性
+        if (StringUtils.hasText(acupoint.getAcupointCode())
+                && !acupoint.getAcupointCode().equals(exist.getAcupointCode())) {
+            long count = lambdaQuery().eq(Acupoint::getAcupointCode, acupoint.getAcupointCode()).count();
+            if (count > 0) {
+                throw new BusinessException(ResultCode.ACUPOINT_CODE_EXISTS);
+            }
+        }
+        // 如果修改了名称,校验唯一性
+        if (StringUtils.hasText(acupoint.getName())
+                && !acupoint.getName().equals(exist.getName())) {
+            long count = lambdaQuery().eq(Acupoint::getName, acupoint.getName()).count();
+            if (count > 0) {
+                throw new BusinessException(ResultCode.ACUPOINT_NAME_EXISTS);
+            }
+        }
+        updateById(acupoint);
+        LogUtil.info(AcupointServiceImpl.class, "修改穴位[{}]", acupoint.getId());
+    }
+
+    /**
+     * 删除穴位(逻辑删除)
+     *
+     * @param id 穴位ID
+     */
+    @Override
+    public void deleteAcupoint(Long id) {
+        Acupoint acupoint = getById(id);
+        if (acupoint == null) {
+            throw new BusinessException(ResultCode.ACUPOINT_NOT_FOUND);
+        }
+        removeById(id);
+        LogUtil.info(AcupointServiceImpl.class, "删除穴位[{}]", id);
+    }
+
+    /**
+     * 批量删除穴位(逻辑删除)
+     *
+     * @param ids 穴位ID列表
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void batchDeleteAcupoint(List<Long> ids) {
+        if (ids == null || ids.isEmpty()) {
+            throw new BusinessException(ResultCode.PARAM_ERROR);
+        }
+        removeByIds(ids);
+        LogUtil.info(AcupointServiceImpl.class, "批量删除穴位,共[{}]条", ids.size());
+    }
+
+    /**
+     * 批量导入穴位(跳过已存在编码)
+     *
+     * @param list 穴位信息列表
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void batchImport(List<Acupoint> list) {
+        if (list == null || list.isEmpty()) {
+            return;
+        }
+        for (Acupoint acupoint : list) {
+            long count = lambdaQuery().eq(Acupoint::getAcupointCode, acupoint.getAcupointCode()).count();
+            if (count == 0) {
+                save(acupoint);
+            }
+        }
+        LogUtil.info(AcupointServiceImpl.class, "批量导入穴位[{}]条", list.size());
+    }
+}

+ 397 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/service/impl/DeviceServiceImpl.java

@@ -0,0 +1,397 @@
+package com.aijiuyi.admin.service.impl;
+
+import com.aijiuyi.admin.common.constant.ResultCode;
+import com.aijiuyi.admin.common.exception.BusinessException;
+import com.aijiuyi.admin.common.util.LogUtil;
+import com.aijiuyi.admin.controller.dto.DeviceQueryDTO;
+import com.aijiuyi.admin.controller.dto.DeviceSaveDTO;
+import com.aijiuyi.admin.entity.Device;
+import com.aijiuyi.admin.entity.DeviceUserVO;
+import com.aijiuyi.admin.entity.UserDevice;
+import com.aijiuyi.admin.mapper.DeviceMapper;
+import com.aijiuyi.admin.mapper.UserDeviceMapper;
+import com.aijiuyi.admin.service.DeviceService;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+
+import java.time.LocalDateTime;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * 设备管理 Service 实现类
+ */
+@Service
+public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> implements DeviceService {
+
+    @Autowired
+    private UserDeviceMapper userDeviceMapper;
+
+    /**
+     * 分页查询设备列表(联表聚合绑定用户信息)
+     *
+     * @param queryDTO 查询条件
+     * @return 分页结果
+     */
+    @Override
+    public IPage<Device> pageList(DeviceQueryDTO queryDTO) {
+        Page<Device> page = new Page<>(queryDTO.getPageNum(), queryDTO.getPageSize());
+        return baseMapper.pageWithUsers(page, queryDTO);
+    }
+
+    /**
+     * 新增设备(可同时绑定初始用户)
+     *
+     * @param dto 设备信息
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void addDevice(DeviceSaveDTO dto) {
+        // 设备编号唯一性校验
+        long codeCount = lambdaQuery().eq(Device::getDeviceCode, dto.getDeviceCode()).count();
+        if (codeCount > 0) {
+            throw new BusinessException(ResultCode.DEVICE_CODE_EXISTS);
+        }
+        // 序列号唯一性校验(若已填写)
+        if (StringUtils.hasText(dto.getSerialNo())) {
+            long serialCount = lambdaQuery().eq(Device::getSerialNo, dto.getSerialNo()).count();
+            if (serialCount > 0) {
+                throw new BusinessException(ResultCode.DEVICE_SERIAL_EXISTS);
+            }
+        }
+        Device device = buildDeviceFromDto(dto);
+        save(device);
+        // 绑定初始用户
+        bindUsers(device.getDeviceCode(), device.getDeviceName(), device.getDeviceModel(), dto.getUserIds());
+        LogUtil.info(DeviceServiceImpl.class, "新增设备[{}],编号[{}]", dto.getDeviceName(), dto.getDeviceCode());
+    }
+
+    /**
+     * 修改设备信息(可同步更新绑定用户)
+     *
+     * @param dto 设备信息
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void updateDevice(DeviceSaveDTO dto) {
+        Device exist = getById(dto.getId());
+        if (exist == null) {
+            throw new BusinessException(ResultCode.DEVICE_NOT_FOUND);
+        }
+        // 若修改了序列号,校验唯一性
+        if (StringUtils.hasText(dto.getSerialNo()) && !dto.getSerialNo().equals(exist.getSerialNo())) {
+            long serialCount = lambdaQuery()
+                    .eq(Device::getSerialNo, dto.getSerialNo())
+                    .ne(Device::getId, dto.getId())
+                    .count();
+            if (serialCount > 0) {
+                throw new BusinessException(ResultCode.DEVICE_SERIAL_EXISTS);
+            }
+        }
+        Device update = buildDeviceFromDto(dto);
+        update.setId(dto.getId());
+        // 设备编号不允许修改,清除该字段防止误更新
+        update.setDeviceCode(null);
+        updateById(update);
+        // 若传入了 userIds(包括空列表),则同步更新绑定用户
+        if (dto.getUserIds() != null) {
+            reconcileUserBindings(exist.getDeviceCode(), exist.getDeviceName(), exist.getDeviceModel(), dto.getUserIds());
+        }
+        LogUtil.info(DeviceServiceImpl.class, "修改设备[{}]", dto.getId());
+    }
+
+    /**
+     * 删除设备(逻辑删除,同步解绑所有用户)
+     *
+     * @param id 设备ID
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void deleteDevice(Long id) {
+        Device device = getById(id);
+        if (device == null) {
+            throw new BusinessException(ResultCode.DEVICE_NOT_FOUND);
+        }
+        removeById(id);
+        // 解绑该设备下所有用户
+        unbindAllUsers(device.getDeviceCode());
+        LogUtil.info(DeviceServiceImpl.class, "删除设备[{}],编号[{}]", id, device.getDeviceCode());
+    }
+
+    /**
+     * 批量删除设备(逻辑删除,同步解绑所有用户)
+     *
+     * @param ids 设备ID列表
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void batchDeleteDevices(List<Long> ids) {
+        if (CollectionUtils.isEmpty(ids)) {
+            throw new BusinessException(ResultCode.PARAM_ERROR);
+        }
+        // 先查出设备编号再删除,用于解绑用户
+        List<Device> devices = listByIds(ids);
+        removeByIds(ids);
+        for (Device device : devices) {
+            unbindAllUsers(device.getDeviceCode());
+        }
+        LogUtil.info(DeviceServiceImpl.class, "批量删除设备,共[{}]条", ids.size());
+    }
+
+    /**
+     * 批量导入设备(跳过编号已存在的记录)
+     *
+     * @param list 设备信息列表
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void batchImport(List<Device> list) {
+        if (CollectionUtils.isEmpty(list)) {
+            return;
+        }
+        for (Device device : list) {
+            long count = lambdaQuery().eq(Device::getDeviceCode, device.getDeviceCode()).count();
+            if (count == 0) {
+                device.setOnlineStatus(0);
+                save(device);
+            }
+        }
+        LogUtil.info(DeviceServiceImpl.class, "批量导入设备[{}]条", list.size());
+    }
+
+    /**
+     * 查询设备绑定的用户列表
+     *
+     * @param deviceId 设备ID
+     * @return 绑定用户列表
+     */
+    @Override
+    public List<DeviceUserVO> getDeviceUsers(Long deviceId) {
+        Device device = getById(deviceId);
+        if (device == null) {
+            throw new BusinessException(ResultCode.DEVICE_NOT_FOUND);
+        }
+        return baseMapper.getUsersByDeviceCode(device.getDeviceCode());
+    }
+
+    /**
+     * 为设备添加绑定用户
+     *
+     * @param deviceId  设备ID
+     * @param profileId 用户档案ID
+     */
+    @Override
+    public void addDeviceUser(Long deviceId, Long profileId) {
+        Device device = getById(deviceId);
+        if (device == null) {
+            throw new BusinessException(ResultCode.DEVICE_NOT_FOUND);
+        }
+        // 检查用户是否已绑定该设备
+        long count = userDeviceMapper.selectCount(
+                new LambdaQueryWrapper<UserDevice>()
+                        .eq(UserDevice::getDeviceCode, device.getDeviceCode())
+                        .eq(UserDevice::getUserId, profileId)
+                        .eq(UserDevice::getStatus, 1)
+        );
+        if (count > 0) {
+            throw new BusinessException(ResultCode.DEVICE_USER_ALREADY_BOUND);
+        }
+        UserDevice ud = new UserDevice();
+        ud.setUserId(profileId);
+        ud.setDeviceCode(device.getDeviceCode());
+        ud.setDeviceName(device.getDeviceName());
+        ud.setDeviceModel(device.getDeviceModel());
+        ud.setStatus(1);
+        ud.setIsPrimary(0);
+        ud.setOnlineStatus(0);
+        ud.setBindTime(LocalDateTime.now());
+        userDeviceMapper.insert(ud);
+        LogUtil.info(DeviceServiceImpl.class, "设备[{}]添加绑定用户[{}]", device.getDeviceCode(), profileId);
+    }
+
+    /**
+     * 解绑设备用户(设置状态为已解绑)
+     *
+     * @param deviceId  设备ID
+     * @param profileId 用户档案ID
+     */
+    @Override
+    public void removeDeviceUser(Long deviceId, Long profileId) {
+        Device device = getById(deviceId);
+        if (device == null) {
+            throw new BusinessException(ResultCode.DEVICE_NOT_FOUND);
+        }
+        LambdaUpdateWrapper<UserDevice> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.eq(UserDevice::getDeviceCode, device.getDeviceCode())
+               .eq(UserDevice::getUserId, profileId)
+               .eq(UserDevice::getStatus, 1)
+               .set(UserDevice::getStatus, 0)
+               .set(UserDevice::getIsPrimary, 0);
+        userDeviceMapper.update(null, wrapper);
+        LogUtil.info(DeviceServiceImpl.class, "设备[{}]解绑用户[{}]", device.getDeviceCode(), profileId);
+    }
+
+    /**
+     * 设为主用户(同一设备下只能有一个主用户)
+     *
+     * @param deviceId  设备ID
+     * @param profileId 用户档案ID
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void setDeviceUserPrimary(Long deviceId, Long profileId) {
+        Device device = getById(deviceId);
+        if (device == null) {
+            throw new BusinessException(ResultCode.DEVICE_NOT_FOUND);
+        }
+        // 先清除该设备下所有用户的主用户标记
+        LambdaUpdateWrapper<UserDevice> clearWrapper = new LambdaUpdateWrapper<>();
+        clearWrapper.eq(UserDevice::getDeviceCode, device.getDeviceCode())
+                    .eq(UserDevice::getStatus, 1)
+                    .set(UserDevice::getIsPrimary, 0);
+        userDeviceMapper.update(null, clearWrapper);
+        // 再将目标用户设为主用户
+        LambdaUpdateWrapper<UserDevice> setWrapper = new LambdaUpdateWrapper<>();
+        setWrapper.eq(UserDevice::getDeviceCode, device.getDeviceCode())
+                  .eq(UserDevice::getUserId, profileId)
+                  .eq(UserDevice::getStatus, 1)
+                  .set(UserDevice::getIsPrimary, 1);
+        userDeviceMapper.update(null, setWrapper);
+        LogUtil.info(DeviceServiceImpl.class, "设备[{}]设置主用户[{}]", device.getDeviceCode(), profileId);
+    }
+
+    /**
+     * 批量解绑设备用户(通过绑定记录ID批量解绑)
+     *
+     * @param deviceId 设备ID(校验用)
+     * @param bindIds  绑定记录ID列表(user_device.id)
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void batchRemoveDeviceUsers(Long deviceId, List<Long> bindIds) {
+        if (CollectionUtils.isEmpty(bindIds)) {
+            return;
+        }
+        LambdaUpdateWrapper<UserDevice> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.in(UserDevice::getId, bindIds)
+               .set(UserDevice::getStatus, 0)
+               .set(UserDevice::getIsPrimary, 0);
+        userDeviceMapper.update(null, wrapper);
+        LogUtil.info(DeviceServiceImpl.class, "设备[{}]批量解绑用户,共[{}]条", deviceId, bindIds.size());
+    }
+
+    /**
+     * 将 DTO 构建为 Device 实体
+     *
+     * @param dto 请求 DTO
+     * @return Device 实体
+     */
+    private Device buildDeviceFromDto(DeviceSaveDTO dto) {
+        Device device = new Device();
+        device.setDeviceCode(dto.getDeviceCode());
+        device.setDeviceName(dto.getDeviceName());
+        device.setDeviceModel(dto.getDeviceModel());
+        device.setSerialNo(dto.getSerialNo());
+        device.setFirmwareVersion(dto.getFirmwareVersion());
+        device.setRemark(dto.getRemark());
+        device.setOnlineStatus(0);
+        return device;
+    }
+
+    /**
+     * 为设备批量绑定用户(新增时使用)
+     *
+     * @param deviceCode  设备编号
+     * @param deviceName  设备名称
+     * @param deviceModel 设备型号
+     * @param userIds     用户ID列表
+     */
+    private void bindUsers(String deviceCode, String deviceName, String deviceModel, List<Long> userIds) {
+        if (CollectionUtils.isEmpty(userIds)) {
+            return;
+        }
+        for (Long profileId : userIds) {
+            UserDevice ud = new UserDevice();
+            ud.setUserId(profileId);
+            ud.setDeviceCode(deviceCode);
+            ud.setDeviceName(deviceName);
+            ud.setDeviceModel(deviceModel);
+            ud.setStatus(1);
+            ud.setIsPrimary(0);
+            ud.setOnlineStatus(0);
+            ud.setBindTime(LocalDateTime.now());
+            userDeviceMapper.insert(ud);
+        }
+    }
+
+    /**
+     * 同步更新设备绑定用户(编辑时使用)
+     * 对比当前绑定用户和新列表,新增差集,解绑多余项
+     *
+     * @param deviceCode  设备编号
+     * @param deviceName  设备名称
+     * @param deviceModel 设备型号
+     * @param newUserIds  新的用户ID列表
+     */
+    private void reconcileUserBindings(String deviceCode, String deviceName, String deviceModel, List<Long> newUserIds) {
+        // 查询当前已绑定的用户
+        List<UserDevice> currentBindings = userDeviceMapper.selectList(
+                new LambdaQueryWrapper<UserDevice>()
+                        .eq(UserDevice::getDeviceCode, deviceCode)
+                        .eq(UserDevice::getStatus, 1)
+        );
+        Set<Long> currentIds = currentBindings.stream()
+                .map(UserDevice::getUserId)
+                .collect(Collectors.toSet());
+        Set<Long> newIds = new HashSet<>(newUserIds);
+        // 解绑已不在新列表中的用户
+        for (UserDevice binding : currentBindings) {
+            if (!newIds.contains(binding.getUserId())) {
+                LambdaUpdateWrapper<UserDevice> unbind = new LambdaUpdateWrapper<>();
+                unbind.eq(UserDevice::getId, binding.getId())
+                      .set(UserDevice::getStatus, 0)
+                      .set(UserDevice::getIsPrimary, 0);
+                userDeviceMapper.update(null, unbind);
+            }
+        }
+        // 新增不在当前绑定中的用户
+        for (Long profileId : newUserIds) {
+            if (!currentIds.contains(profileId)) {
+                UserDevice ud = new UserDevice();
+                ud.setUserId(profileId);
+                ud.setDeviceCode(deviceCode);
+                ud.setDeviceName(deviceName);
+                ud.setDeviceModel(deviceModel);
+                ud.setStatus(1);
+                ud.setIsPrimary(0);
+                ud.setOnlineStatus(0);
+                ud.setBindTime(LocalDateTime.now());
+                userDeviceMapper.insert(ud);
+            }
+        }
+    }
+
+    /**
+     * 解绑指定设备的所有用户
+     *
+     * @param deviceCode 设备编号
+     */
+    private void unbindAllUsers(String deviceCode) {
+        LambdaUpdateWrapper<UserDevice> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.eq(UserDevice::getDeviceCode, deviceCode)
+               .eq(UserDevice::getStatus, 1)
+               .set(UserDevice::getStatus, 0)
+               .set(UserDevice::getIsPrimary, 0);
+        userDeviceMapper.update(null, wrapper);
+    }
+}

+ 135 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/service/impl/MoxibustionTechniqueServiceImpl.java

@@ -0,0 +1,135 @@
+package com.aijiuyi.admin.service.impl;
+
+import com.aijiuyi.admin.common.constant.ResultCode;
+import com.aijiuyi.admin.common.exception.BusinessException;
+import com.aijiuyi.admin.common.util.LogUtil;
+import com.aijiuyi.admin.controller.dto.MoxibustionTechniqueQueryDTO;
+import com.aijiuyi.admin.entity.MoxibustionTechnique;
+import com.aijiuyi.admin.mapper.MoxibustionTechniqueMapper;
+import com.aijiuyi.admin.service.MoxibustionTechniqueService;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+
+import java.util.List;
+
+/**
+ * 艾灸手法管理 Service 实现类
+ */
+@Service
+public class MoxibustionTechniqueServiceImpl
+        extends ServiceImpl<MoxibustionTechniqueMapper, MoxibustionTechnique>
+        implements MoxibustionTechniqueService {
+
+    /**
+     * 分页查询艾灸手法列表
+     *
+     * @param queryDTO 查询条件
+     * @return 分页结果
+     */
+    @Override
+    public IPage<MoxibustionTechnique> pageList(MoxibustionTechniqueQueryDTO queryDTO) {
+        Page<MoxibustionTechnique> page = new Page<>(queryDTO.getPageNum(), queryDTO.getPageSize());
+        LambdaQueryWrapper<MoxibustionTechnique> wrapper = new LambdaQueryWrapper<>();
+        wrapper.like(StringUtils.hasText(queryDTO.getName()), MoxibustionTechnique::getName, queryDTO.getName())
+               .eq(StringUtils.hasText(queryDTO.getMotionMode()), MoxibustionTechnique::getMotionMode, queryDTO.getMotionMode())
+               .eq(queryDTO.getStatus() != null, MoxibustionTechnique::getStatus, queryDTO.getStatus())
+               .orderByAsc(MoxibustionTechnique::getId);
+        return page(page, wrapper);
+    }
+
+    /**
+     * 新增艾灸手法,校验编码和名称唯一性
+     *
+     * @param technique 手法信息
+     */
+    @Override
+    public void addTechnique(MoxibustionTechnique technique) {
+        // 手法编码唯一性校验
+        long codeCount = lambdaQuery()
+                .eq(MoxibustionTechnique::getTechniqueCode, technique.getTechniqueCode())
+                .count();
+        if (codeCount > 0) {
+            throw new BusinessException(ResultCode.TECHNIQUE_CODE_EXISTS);
+        }
+        // 手法名称唯一性校验
+        long nameCount = lambdaQuery()
+                .eq(MoxibustionTechnique::getName, technique.getName())
+                .count();
+        if (nameCount > 0) {
+            throw new BusinessException(ResultCode.TECHNIQUE_NAME_EXISTS);
+        }
+        save(technique);
+        LogUtil.info(MoxibustionTechniqueServiceImpl.class,
+                "新增艾灸手法[{}],编码[{}]", technique.getName(), technique.getTechniqueCode());
+    }
+
+    /**
+     * 修改艾灸手法信息,校验存在性及编码/名称唯一性
+     *
+     * @param technique 手法信息
+     */
+    @Override
+    public void updateTechnique(MoxibustionTechnique technique) {
+        MoxibustionTechnique exist = getById(technique.getId());
+        if (exist == null) {
+            throw new BusinessException(ResultCode.TECHNIQUE_NOT_FOUND);
+        }
+        // 如果修改了编码,校验唯一性
+        if (StringUtils.hasText(technique.getTechniqueCode())
+                && !technique.getTechniqueCode().equals(exist.getTechniqueCode())) {
+            long count = lambdaQuery()
+                    .eq(MoxibustionTechnique::getTechniqueCode, technique.getTechniqueCode())
+                    .count();
+            if (count > 0) {
+                throw new BusinessException(ResultCode.TECHNIQUE_CODE_EXISTS);
+            }
+        }
+        // 如果修改了名称,校验唯一性
+        if (StringUtils.hasText(technique.getName())
+                && !technique.getName().equals(exist.getName())) {
+            long count = lambdaQuery()
+                    .eq(MoxibustionTechnique::getName, technique.getName())
+                    .count();
+            if (count > 0) {
+                throw new BusinessException(ResultCode.TECHNIQUE_NAME_EXISTS);
+            }
+        }
+        updateById(technique);
+        LogUtil.info(MoxibustionTechniqueServiceImpl.class, "修改艾灸手法[{}]", technique.getId());
+    }
+
+    /**
+     * 删除艾灸手法(逻辑删除)
+     *
+     * @param id 手法ID
+     */
+    @Override
+    public void deleteTechnique(Long id) {
+        MoxibustionTechnique technique = getById(id);
+        if (technique == null) {
+            throw new BusinessException(ResultCode.TECHNIQUE_NOT_FOUND);
+        }
+        removeById(id);
+        LogUtil.info(MoxibustionTechniqueServiceImpl.class, "删除艾灸手法[{}]", id);
+    }
+
+    /**
+     * 批量删除艾灸手法(逻辑删除)
+     *
+     * @param ids 手法ID列表
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void batchDeleteTechnique(List<Long> ids) {
+        if (ids == null || ids.isEmpty()) {
+            throw new BusinessException(ResultCode.PARAM_ERROR);
+        }
+        removeByIds(ids);
+        LogUtil.info(MoxibustionTechniqueServiceImpl.class, "批量删除艾灸手法,共[{}]条", ids.size());
+    }
+}

+ 277 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/service/impl/PlanServiceImpl.java

@@ -0,0 +1,277 @@
+package com.aijiuyi.admin.service.impl;
+
+import com.aijiuyi.admin.common.constant.ResultCode;
+import com.aijiuyi.admin.common.exception.BusinessException;
+import com.aijiuyi.admin.common.util.LogUtil;
+import com.aijiuyi.admin.controller.dto.PlanQueryDTO;
+import com.aijiuyi.admin.controller.dto.PlanSaveDTO;
+import com.aijiuyi.admin.entity.Plan;
+import com.aijiuyi.admin.entity.PlanStep;
+import com.aijiuyi.admin.mapper.PlanMapper;
+import com.aijiuyi.admin.mapper.PlanStepMapper;
+import com.aijiuyi.admin.service.PlanService;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * 方案管理 Service 实现类
+ */
+@Service
+public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements PlanService {
+
+    @Autowired
+    private PlanStepMapper planStepMapper;
+
+    /**
+     * 分页查询方案列表
+     *
+     * @param queryDTO 查询条件
+     * @return 分页结果
+     */
+    @Override
+    public IPage<Plan> pageList(PlanQueryDTO queryDTO) {
+        Page<Plan> page = new Page<>(queryDTO.getPageNum(), queryDTO.getPageSize());
+        LambdaQueryWrapper<Plan> wrapper = new LambdaQueryWrapper<>();
+        wrapper.like(StringUtils.hasText(queryDTO.getName()), Plan::getName, queryDTO.getName())
+               .eq(queryDTO.getModeType() != null, Plan::getModeType, queryDTO.getModeType())
+               .eq(StringUtils.hasText(queryDTO.getEffectType()), Plan::getEffectType, queryDTO.getEffectType())
+               .like(StringUtils.hasText(queryDTO.getAuthorName()), Plan::getAuthorName, queryDTO.getAuthorName())
+               .eq(queryDTO.getStatus() != null, Plan::getStatus, queryDTO.getStatus());
+        // 创建时间范围查询
+        if (StringUtils.hasText(queryDTO.getCreateTimeStart())) {
+            wrapper.ge(Plan::getCreateTime,
+                    LocalDateTime.parse(queryDTO.getCreateTimeStart() + " 00:00:00",
+                            DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+        }
+        if (StringUtils.hasText(queryDTO.getCreateTimeEnd())) {
+            wrapper.le(Plan::getCreateTime,
+                    LocalDateTime.parse(queryDTO.getCreateTimeEnd() + " 23:59:59",
+                            DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+        }
+        wrapper.orderByDesc(Plan::getCreateTime);
+        return page(page, wrapper);
+    }
+
+    /**
+     * 查询方案详情(含步骤列表)
+     *
+     * @param id 方案ID
+     * @return 方案详情(DTO)
+     */
+    @Override
+    public PlanSaveDTO getDetail(Long id) {
+        Plan plan = getById(id);
+        if (plan == null) {
+            throw new BusinessException(ResultCode.PLAN_NOT_FOUND);
+        }
+        PlanSaveDTO dto = new PlanSaveDTO();
+        BeanUtils.copyProperties(plan, dto);
+        // 查询步骤列表
+        List<PlanStep> steps = getStepsByPlanId(id);
+        dto.setSteps(steps);
+        return dto;
+    }
+
+    /**
+     * 新增方案(含步骤),状态默认为草稿
+     *
+     * @param dto 方案信息
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void addPlan(PlanSaveDTO dto) {
+        // 校验步骤不为空
+        if (dto.getSteps() == null || dto.getSteps().isEmpty()) {
+            throw new BusinessException(ResultCode.PLAN_STEP_MIN_ERROR);
+        }
+        // 方案名称唯一性校验
+        long nameCount = lambdaQuery().eq(Plan::getName, dto.getName()).count();
+        if (nameCount > 0) {
+            throw new BusinessException(ResultCode.PLAN_NAME_EXISTS);
+        }
+        // 生成方案编码(S + 6位随机字符)
+        String planCode = "S" + UUID.randomUUID().toString().replace("-", "").substring(0, 6).toUpperCase();
+        Plan plan = new Plan();
+        BeanUtils.copyProperties(dto, plan);
+        plan.setPlanCode(planCode);
+        plan.setStatus(0); // 草稿
+        plan.setUseCount(0);
+        save(plan);
+        // 保存步骤
+        saveSteps(plan.getId(), dto.getSteps());
+        LogUtil.info(PlanServiceImpl.class, "新增方案[{}],编码[{}]", plan.getName(), planCode);
+    }
+
+    /**
+     * 修改方案(含步骤),先删除旧步骤再保存新步骤
+     *
+     * @param dto 方案信息
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void updatePlan(PlanSaveDTO dto) {
+        Plan plan = getById(dto.getId());
+        if (plan == null) {
+            throw new BusinessException(ResultCode.PLAN_NOT_FOUND);
+        }
+        // 方案名称唯一性校验(排除自身)
+        long nameCount = lambdaQuery()
+                .eq(Plan::getName, dto.getName())
+                .ne(Plan::getId, dto.getId())
+                .count();
+        if (nameCount > 0) {
+            throw new BusinessException(ResultCode.PLAN_NAME_EXISTS);
+        }
+        BeanUtils.copyProperties(dto, plan);
+        updateById(plan);
+        // 删除旧步骤(逻辑删除)
+        planStepMapper.delete(new LambdaQueryWrapper<PlanStep>().eq(PlanStep::getPlanId, dto.getId()));
+        // 保存新步骤
+        if (dto.getSteps() != null && !dto.getSteps().isEmpty()) {
+            saveSteps(dto.getId(), dto.getSteps());
+        }
+        LogUtil.info(PlanServiceImpl.class, "修改方案[{}]", dto.getId());
+    }
+
+    /**
+     * 删除方案(逻辑删除,仅草稿状态可删)
+     *
+     * @param id 方案ID
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void deletePlan(Long id) {
+        Plan plan = getById(id);
+        if (plan == null) {
+            throw new BusinessException(ResultCode.PLAN_NOT_FOUND);
+        }
+        if (plan.getStatus() != 0) {
+            throw new BusinessException(ResultCode.PLAN_CANNOT_DELETE);
+        }
+        removeById(id);
+        // 同步删除步骤
+        planStepMapper.delete(new LambdaQueryWrapper<PlanStep>().eq(PlanStep::getPlanId, id));
+        LogUtil.info(PlanServiceImpl.class, "删除方案[{}]", id);
+    }
+
+    /**
+     * 批量删除方案(仅草稿状态可删)
+     *
+     * @param ids 方案ID列表
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void batchDeletePlan(List<Long> ids) {
+        if (ids == null || ids.isEmpty()) {
+            throw new BusinessException(ResultCode.PARAM_ERROR);
+        }
+        for (Long id : ids) {
+            deletePlan(id);
+        }
+        LogUtil.info(PlanServiceImpl.class, "批量删除方案,共[{}]条", ids.size());
+    }
+
+    /**
+     * 发布方案(草稿 → 已发布)
+     *
+     * @param id 方案ID
+     */
+    @Override
+    public void publishPlan(Long id) {
+        Plan plan = getById(id);
+        if (plan == null) {
+            throw new BusinessException(ResultCode.PLAN_NOT_FOUND);
+        }
+        lambdaUpdate().eq(Plan::getId, id).set(Plan::getStatus, 1).update();
+        LogUtil.info(PlanServiceImpl.class, "发布方案[{}]", id);
+    }
+
+    /**
+     * 批量发布方案
+     *
+     * @param ids 方案ID列表
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void batchPublishPlan(List<Long> ids) {
+        if (ids == null || ids.isEmpty()) {
+            throw new BusinessException(ResultCode.PARAM_ERROR);
+        }
+        update(new LambdaUpdateWrapper<Plan>().in(Plan::getId, ids).set(Plan::getStatus, 1));
+        LogUtil.info(PlanServiceImpl.class, "批量发布方案,共[{}]条", ids.size());
+    }
+
+    /**
+     * 下架方案(已发布 → 已下架)
+     *
+     * @param id 方案ID
+     */
+    @Override
+    public void offshelfPlan(Long id) {
+        Plan plan = getById(id);
+        if (plan == null) {
+            throw new BusinessException(ResultCode.PLAN_NOT_FOUND);
+        }
+        lambdaUpdate().eq(Plan::getId, id).set(Plan::getStatus, 2).update();
+        LogUtil.info(PlanServiceImpl.class, "下架方案[{}]", id);
+    }
+
+    /**
+     * 批量下架方案
+     *
+     * @param ids 方案ID列表
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void batchOffshelfPlan(List<Long> ids) {
+        if (ids == null || ids.isEmpty()) {
+            throw new BusinessException(ResultCode.PARAM_ERROR);
+        }
+        update(new LambdaUpdateWrapper<Plan>().in(Plan::getId, ids).set(Plan::getStatus, 2));
+        LogUtil.info(PlanServiceImpl.class, "批量下架方案,共[{}]条", ids.size());
+    }
+
+    /**
+     * 查询方案步骤列表(按步骤序号升序)
+     *
+     * @param planId 方案ID
+     * @return 步骤列表
+     */
+    @Override
+    public List<PlanStep> getStepsByPlanId(Long planId) {
+        return planStepMapper.selectList(
+                new LambdaQueryWrapper<PlanStep>()
+                        .eq(PlanStep::getPlanId, planId)
+                        .orderByAsc(PlanStep::getStepOrder)
+        );
+    }
+
+    /**
+     * 保存方案步骤(设置 planId 和步骤序号后批量插入)
+     *
+     * @param planId 方案ID
+     * @param steps  步骤列表
+     */
+    private void saveSteps(Long planId, List<PlanStep> steps) {
+        for (int i = 0; i < steps.size(); i++) {
+            PlanStep step = steps.get(i);
+            step.setId(null);
+            step.setPlanId(planId);
+            step.setStepOrder(i + 1);
+            planStepMapper.insert(step);
+        }
+    }
+}

+ 320 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/service/impl/UserAcupointServiceImpl.java

@@ -0,0 +1,320 @@
+package com.aijiuyi.admin.service.impl;
+
+import com.aijiuyi.admin.common.constant.ResultCode;
+import com.aijiuyi.admin.common.exception.BusinessException;
+import com.aijiuyi.admin.common.util.LogUtil;
+import com.aijiuyi.admin.entity.Acupoint;
+import com.aijiuyi.admin.entity.UserAcupoint;
+import com.aijiuyi.admin.entity.UserProfile;
+import com.aijiuyi.admin.mapper.AcupointMapper;
+import com.aijiuyi.admin.mapper.UserAcupointMapper;
+import com.aijiuyi.admin.mapper.UserProfileMapper;
+import com.aijiuyi.admin.service.UserAcupointService;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * 用户穴位坐标 Service 实现类
+ * 核心功能:根据子用户体型数据(指宽/肩宽/身长)与穴位定位参数,计算个性化穴位坐标
+ *
+ * <p>坐标计算规则(相对定位):</p>
+ * <ul>
+ *   <li>1寸(mm) = 对应指宽(cm)× 10</li>
+ *   <li>coordinateY(mm)= 纵向偏移(寸)× 1寸换算值</li>
+ *   <li>coordinateX(mm)= 横向偏移(寸)× 1寸换算值,中心穴位固定为 0</li>
+ *   <li>双侧穴位(side=4)生成 left/right 两条记录,X 取反对称</li>
+ * </ul>
+ */
+@Service
+public class UserAcupointServiceImpl extends ServiceImpl<UserAcupointMapper, UserAcupoint> implements UserAcupointService {
+
+    /** 指宽未设置时使用的默认 1寸换算值(mm),取中医标准均值 18 mm */
+    private static final BigDecimal DEFAULT_ONE_CUN_MM = new BigDecimal("18.0");
+
+    @Autowired
+    private UserProfileMapper userProfileMapper;
+
+    @Autowired
+    private AcupointMapper acupointMapper;
+
+    /**
+     * 为指定子用户生成(或重新生成)全量穴位坐标
+     *
+     * @param profileId 子用户ID(user_profile.id)
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void generateForUser(Long profileId) {
+        // 1. 校验子用户存在
+        UserProfile profile = userProfileMapper.selectById(profileId);
+        if (profile == null) {
+            throw new BusinessException(ResultCode.PROFILE_NOT_FOUND);
+        }
+
+        // 2. 查询全量活跃穴位
+        LambdaQueryWrapper<Acupoint> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(Acupoint::getStatus, 1);
+        List<Acupoint> acupoints = acupointMapper.selectList(wrapper);
+
+        // 3. 清除该用户旧的穴位坐标记录
+        baseMapper.deleteByUserId(profileId);
+
+        // 4. 计算并批量插入
+        List<UserAcupoint> records = buildAcupointRecords(profile, acupoints);
+        if (!records.isEmpty()) {
+            saveBatch(records);
+        }
+
+        // 5. 更新 user_profile.acupoint_table_id(使用 profileId 标记已生成)
+        UserProfile update = new UserProfile();
+        update.setId(profileId);
+        update.setAcupointTableId(profileId);
+        userProfileMapper.updateById(update);
+
+        LogUtil.info(UserAcupointServiceImpl.class,
+                "为子用户[{}]生成穴位坐标,共生成[{}]条记录", profileId, records.size());
+    }
+
+    /**
+     * 当穴位管理新增一条穴位时,为所有已生成过穴位表的子用户追加该穴位坐标
+     *
+     * @param acupointId 新增的穴位ID
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void generateForAllUsersByAcupoint(Long acupointId) {
+        // 1. 查询新增穴位信息
+        Acupoint acupoint = acupointMapper.selectById(acupointId);
+        if (acupoint == null) {
+            LogUtil.info(UserAcupointServiceImpl.class, "穴位[{}]不存在,跳过批量生成", acupointId);
+            return;
+        }
+
+        // 2. 查询所有已生成过穴位表的子用户(acupoint_table_id 不为空)
+        LambdaQueryWrapper<UserProfile> profileWrapper = new LambdaQueryWrapper<>();
+        profileWrapper.isNotNull(UserProfile::getAcupointTableId);
+        List<UserProfile> profiles = userProfileMapper.selectList(profileWrapper);
+
+        int total = 0;
+        for (UserProfile profile : profiles) {
+            // 3. 删除该用户下此穴位的旧记录(幂等处理)
+            baseMapper.deleteByUserIdAndAcupointId(profile.getId(), acupointId);
+            // 4. 为该用户计算并插入新穴位坐标
+            List<UserAcupoint> records = buildAcupointRecords(profile, Collections.singletonList(acupoint));
+            if (!records.isEmpty()) {
+                saveBatch(records);
+                total += records.size();
+            }
+        }
+        LogUtil.info(UserAcupointServiceImpl.class,
+                "新增穴位[{}]后,为[{}]个用户批量追加穴位坐标,共[{}]条记录",
+                acupointId, profiles.size(), total);
+    }
+
+    /**
+     * 查询指定子用户的穴位坐标列表
+     *
+     * @param profileId 子用户ID
+     * @return 穴位坐标列表
+     */
+    @Override
+    public List<UserAcupoint> listByUser(Long profileId) {
+        return baseMapper.listByUserId(profileId);
+    }
+
+    // ======================== 核心算法 ========================
+
+    /**
+     * 为单个子用户批量构建穴位坐标记录列表
+     *
+     * @param profile   子用户体型数据
+     * @param acupoints 需要计算的穴位列表
+     * @return 待插入的 UserAcupoint 记录列表
+     */
+    private List<UserAcupoint> buildAcupointRecords(UserProfile profile, List<Acupoint> acupoints) {
+        List<UserAcupoint> records = new ArrayList<>();
+        for (Acupoint acupoint : acupoints) {
+            if (acupoint.getLocationType() == null) {
+                continue;
+            }
+            if (acupoint.getLocationType() == 2) {
+                // 绝对定位:直接使用 abs_x/abs_y
+                records.add(buildAbsoluteRecord(profile.getId(), acupoint));
+            } else {
+                // 相对定位:按指寸换算坐标
+                records.addAll(buildRelativeRecords(profile, acupoint));
+            }
+        }
+        return records;
+    }
+
+    /**
+     * 绝对定位穴位:直接使用 abs_x/abs_y 构建一条坐标记录
+     *
+     * @param profileId 子用户ID
+     * @param acupoint  穴位信息
+     * @return 坐标记录
+     */
+    private UserAcupoint buildAbsoluteRecord(Long profileId, Acupoint acupoint) {
+        UserAcupoint record = new UserAcupoint();
+        record.setUserId(profileId);
+        record.setAcupointId(acupoint.getId());
+        record.setAcupointName(acupoint.getName());
+        record.setAcupointSide("center");
+        record.setCunValue(null);
+        record.setCunType(null);
+        record.setCoordinateX(acupoint.getAbsX() != null ? acupoint.getAbsX() : BigDecimal.ZERO);
+        record.setCoordinateY(acupoint.getAbsY() != null ? acupoint.getAbsY() : BigDecimal.ZERO);
+        return record;
+    }
+
+    /**
+     * 相对定位穴位:根据子用户体型数据计算坐标,按侧别生成 1~2 条记录
+     *
+     * @param profile  子用户体型数据
+     * @param acupoint 穴位信息
+     * @return 坐标记录列表(中心1条;单侧1条;双侧2条)
+     */
+    private List<UserAcupoint> buildRelativeRecords(UserProfile profile, Acupoint acupoint) {
+        List<UserAcupoint> list = new ArrayList<>();
+
+        // 获取 1寸 对应的 mm 换算值
+        BigDecimal oneCunMm = getOneCunMm(profile, acupoint.getFingerWidthType());
+        // 纵向坐标(Y):纵向偏移 × 1寸换算值
+        BigDecimal coordY = acupoint.getLongitudeOffset() != null
+                ? acupoint.getLongitudeOffset().multiply(oneCunMm).setScale(2, RoundingMode.HALF_UP)
+                : BigDecimal.ZERO;
+        // 横向偏移值(用于左/右侧计算)
+        BigDecimal lateralMm = acupoint.getLateralOffset() != null
+                ? acupoint.getLateralOffset().multiply(oneCunMm).setScale(2, RoundingMode.HALF_UP)
+                : BigDecimal.ZERO;
+
+        // 指寸类型文本
+        String cunTypeText = resolveCunType(acupoint.getFingerWidthType());
+
+        Integer side = acupoint.getSide();
+        if (side == null || side == 1) {
+            // 中心穴位,X=0
+            list.add(buildRecord(profile.getId(), acupoint, "center",
+                    acupoint.getLongitudeOffset(), cunTypeText, BigDecimal.ZERO, coordY));
+        } else if (side == 2) {
+            // 仅左侧,X 为负数(向左)
+            list.add(buildRecord(profile.getId(), acupoint, "left",
+                    acupoint.getLongitudeOffset(), cunTypeText, lateralMm.negate(), coordY));
+        } else if (side == 3) {
+            // 仅右侧,X 为正数(向右)
+            list.add(buildRecord(profile.getId(), acupoint, "right",
+                    acupoint.getLongitudeOffset(), cunTypeText, lateralMm, coordY));
+        } else if (side == 4) {
+            // 双侧:生成左右两条记录
+            list.add(buildRecord(profile.getId(), acupoint, "left",
+                    acupoint.getLongitudeOffset(), cunTypeText, lateralMm.negate(), coordY));
+            list.add(buildRecord(profile.getId(), acupoint, "right",
+                    acupoint.getLongitudeOffset(), cunTypeText, lateralMm, coordY));
+        }
+        return list;
+    }
+
+    /**
+     * 构建单条 UserAcupoint 记录
+     *
+     * @param profileId   子用户ID
+     * @param acupoint    穴位信息
+     * @param side        侧别(center/left/right)
+     * @param cunValue    纵向偏移(寸)
+     * @param cunType     指寸类型文本
+     * @param coordinateX X 坐标(mm)
+     * @param coordinateY Y 坐标(mm)
+     * @return 坐标记录
+     */
+    private UserAcupoint buildRecord(Long profileId, Acupoint acupoint, String side,
+                                      BigDecimal cunValue, String cunType,
+                                      BigDecimal coordinateX, BigDecimal coordinateY) {
+        UserAcupoint record = new UserAcupoint();
+        record.setUserId(profileId);
+        record.setAcupointId(acupoint.getId());
+        record.setAcupointName(acupoint.getName());
+        record.setAcupointSide(side);
+        record.setCunValue(cunValue);
+        record.setCunType(cunType);
+        record.setCoordinateX(coordinateX);
+        record.setCoordinateY(coordinateY);
+        return record;
+    }
+
+    /**
+     * 根据穴位的指寸类型和子用户的实测指宽,计算 1寸 对应的 mm 换算值
+     * <ul>
+     *   <li>指寸类型=1(1寸):1寸 = fingerWidth1 × 10 mm</li>
+     *   <li>指寸类型=2(1.5寸):1寸 = (fingerWidth15 / 1.5) × 10 mm</li>
+     *   <li>指寸类型=3(3寸):1寸 = (fingerWidth3 / 3) × 10 mm</li>
+     *   <li>如未设置指宽则使用默认值 18 mm/寸</li>
+     * </ul>
+     *
+     * @param profile          子用户体型数据
+     * @param fingerWidthType  穴位指寸类型(1/2/3)
+     * @return 1寸对应的 mm 值
+     */
+    private BigDecimal getOneCunMm(UserProfile profile, Integer fingerWidthType) {
+        if (fingerWidthType == null) {
+            return DEFAULT_ONE_CUN_MM;
+        }
+        switch (fingerWidthType) {
+            case 1:
+                // 1寸指宽(cm)× 10 = mm
+                if (profile.getFingerWidth1() != null) {
+                    return profile.getFingerWidth1().multiply(BigDecimal.TEN).setScale(2, RoundingMode.HALF_UP);
+                }
+                break;
+            case 2:
+                // 1.5寸指宽 / 1.5 × 10 = 1寸 mm
+                if (profile.getFingerWidth15() != null) {
+                    return profile.getFingerWidth15()
+                            .divide(new BigDecimal("1.5"), 4, RoundingMode.HALF_UP)
+                            .multiply(BigDecimal.TEN)
+                            .setScale(2, RoundingMode.HALF_UP);
+                }
+                break;
+            case 3:
+                // 3寸指宽 / 3 × 10 = 1寸 mm
+                if (profile.getFingerWidth3() != null) {
+                    return profile.getFingerWidth3()
+                            .divide(new BigDecimal("3"), 4, RoundingMode.HALF_UP)
+                            .multiply(BigDecimal.TEN)
+                            .setScale(2, RoundingMode.HALF_UP);
+                }
+                break;
+            default:
+                break;
+        }
+        // 指宽未设置,使用默认值
+        return DEFAULT_ONE_CUN_MM;
+    }
+
+    /**
+     * 将穴位的指寸类型编号转为中文文本
+     *
+     * @param fingerWidthType 指寸类型编号(1/2/3)
+     * @return 中文类型文本(1寸/1.5寸/3寸)
+     */
+    private String resolveCunType(Integer fingerWidthType) {
+        if (fingerWidthType == null) {
+            return null;
+        }
+        switch (fingerWidthType) {
+            case 1: return "1寸";
+            case 2: return "1.5寸";
+            case 3: return "3寸";
+            default: return null;
+        }
+    }
+}

+ 74 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/service/impl/UserDeviceServiceImpl.java

@@ -8,12 +8,16 @@ import com.aijiuyi.admin.entity.UserDevice;
 import com.aijiuyi.admin.mapper.UserDeviceMapper;
 import com.aijiuyi.admin.service.UserDeviceService;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 
+import java.util.List;
+
 /**
  * 用户设备绑定 Service 实现类
  */
@@ -38,6 +42,30 @@ public class UserDeviceServiceImpl extends ServiceImpl<UserDeviceMapper, UserDev
         return page(page, wrapper);
     }
 
+    /**
+     * 绑定设备
+     *
+     * @param device 设备信息
+     */
+    @Override
+    public void bindDevice(UserDevice device) {
+        // 校验该设备是否已被该子用户绑定
+        long count = lambdaQuery()
+                .eq(UserDevice::getUserId, device.getUserId())
+                .eq(UserDevice::getDeviceCode, device.getDeviceCode())
+                .eq(UserDevice::getStatus, 1)
+                .count();
+        if (count > 0) {
+            throw new BusinessException(ResultCode.DEVICE_ALREADY_BOUND);
+        }
+        device.setStatus(1);
+        device.setIsPrimary(0);
+        device.setOnlineStatus(0);
+        device.setBindTime(java.time.LocalDateTime.now());
+        save(device);
+        LogUtil.info(UserDeviceServiceImpl.class, "子用户[{}]绑定设备[{}]", device.getUserId(), device.getDeviceCode());
+    }
+
     /**
      * 解绑设备(设置状态为0)
      *
@@ -52,6 +80,7 @@ public class UserDeviceServiceImpl extends ServiceImpl<UserDeviceMapper, UserDev
         UserDevice update = new UserDevice();
         update.setId(id);
         update.setStatus(0);
+        update.setIsPrimary(0);
         updateById(update);
         LogUtil.info(UserDeviceServiceImpl.class, "设备[{}]已解绑", id);
     }
@@ -70,4 +99,49 @@ public class UserDeviceServiceImpl extends ServiceImpl<UserDeviceMapper, UserDev
         removeById(id);
         LogUtil.info(UserDeviceServiceImpl.class, "删除设备记录[{}]", id);
     }
+
+    /**
+     * 设置主设备(同一用户下只有一个主设备)
+     *
+     * @param id     设备记录ID
+     * @param userId 所属子用户ID
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void setPrimaryDevice(Long id, Long userId) {
+        UserDevice device = getById(id);
+        if (device == null) {
+            throw new BusinessException(ResultCode.DEVICE_NOT_FOUND);
+        }
+        // 先将该用户所有设备的主设备标记清除
+        lambdaUpdate()
+                .eq(UserDevice::getUserId, userId)
+                .set(UserDevice::getIsPrimary, 0)
+                .update();
+        // 再将目标设备设为主设备
+        UserDevice update = new UserDevice();
+        update.setId(id);
+        update.setIsPrimary(1);
+        updateById(update);
+        LogUtil.info(UserDeviceServiceImpl.class, "子用户[{}]设置主设备[{}]", userId, id);
+    }
+
+    /**
+     * 批量解绑设备
+     *
+     * @param ids 设备记录ID列表
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void batchUnbindDevices(List<Long> ids) {
+        if (ids == null || ids.isEmpty()) {
+            return;
+        }
+        LambdaUpdateWrapper<UserDevice> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.in(UserDevice::getId, ids)
+               .set(UserDevice::getStatus, 0)
+               .set(UserDevice::getIsPrimary, 0);
+        update(wrapper);
+        LogUtil.info(UserDeviceServiceImpl.class, "批量解绑设备,共[{}]条", ids.size());
+    }
 }

+ 51 - 0
openspec/backend/src/main/java/com/aijiuyi/admin/service/impl/UserPlanServiceImpl.java

@@ -0,0 +1,51 @@
+package com.aijiuyi.admin.service.impl;
+
+import com.aijiuyi.admin.common.constant.ResultCode;
+import com.aijiuyi.admin.common.exception.BusinessException;
+import com.aijiuyi.admin.entity.UserPlan;
+import com.aijiuyi.admin.mapper.UserPlanMapper;
+import com.aijiuyi.admin.service.UserPlanService;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 用户方案 Service 实现类
+ */
+@Service
+public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> implements UserPlanService {
+
+    /**
+     * 分页查询某子用户的方案列表
+     *
+     * @param userId   子用户ID
+     * @param pageNum  当前页码
+     * @param pageSize 每页条数
+     * @return 分页结果
+     */
+    @Override
+    public IPage<UserPlan> pageByUserId(Long userId, Integer pageNum, Integer pageSize) {
+        Page<UserPlan> page = new Page<>(pageNum, pageSize);
+        LambdaQueryWrapper<UserPlan> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(UserPlan::getUserId, userId)
+               .orderByDesc(UserPlan::getCreateTime);
+        return page(page, wrapper);
+    }
+
+    /**
+     * 查询用户方案详情
+     *
+     * @param id 用户方案ID
+     * @return 用户方案详情
+     */
+    @Override
+    public UserPlan getDetail(Long id) {
+        UserPlan userPlan = getById(id);
+        if (userPlan == null) {
+            throw new BusinessException(ResultCode.USER_PLAN_NOT_FOUND);
+        }
+        return userPlan;
+    }
+}

+ 193 - 29
openspec/backend/src/main/java/com/aijiuyi/admin/service/impl/UserProfileServiceImpl.java

@@ -4,39 +4,43 @@ import com.aijiuyi.admin.common.constant.ResultCode;
 import com.aijiuyi.admin.common.exception.BusinessException;
 import com.aijiuyi.admin.common.util.LogUtil;
 import com.aijiuyi.admin.controller.dto.UserProfileDTO;
+import com.aijiuyi.admin.controller.dto.UserProfileQueryDTO;
 import com.aijiuyi.admin.entity.UserProfile;
 import com.aijiuyi.admin.mapper.UserProfileMapper;
+import com.aijiuyi.admin.service.UserAcupointService;
 import com.aijiuyi.admin.service.UserProfileService;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
 
+import java.math.BigDecimal;
+import java.util.List;
+
 /**
  * 子用户信息 Service 实现类
  */
 @Service
 public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserProfile> implements UserProfileService {
 
+    /** 用户穴位坐标服务(自动触发生成) */
+    @Autowired
+    private UserAcupointService userAcupointService;
+
     /**
-     * 分页查询子用户列表
+     * 分页查询子用户列表(联表获取绑定设备编号)
      *
-     * @param userId   所属用户ID(可选)
-     * @param name     姓名(模糊搜索,可选)
-     * @param pageNum  当前页码
-     * @param pageSize 每页条数
+     * @param queryDTO 查询条件
      * @return 分页结果
      */
     @Override
-    public IPage<UserProfile> pageList(Long userId, String name, Integer pageNum, Integer pageSize) {
-        Page<UserProfile> page = new Page<>(pageNum, pageSize);
-        LambdaQueryWrapper<UserProfile> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(userId != null, UserProfile::getUserId, userId)
-               .like(StringUtils.hasText(name), UserProfile::getName, name)
-               .orderByDesc(UserProfile::getCreateTime);
-        return page(page, wrapper);
+    public IPage<UserProfile> pageList(UserProfileQueryDTO queryDTO) {
+        Page<UserProfile> page = new Page<>(queryDTO.getPageNum(), queryDTO.getPageSize());
+        return baseMapper.pageWithDevices(page, queryDTO);
     }
 
     /**
@@ -46,16 +50,20 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
      */
     @Override
     public void addProfile(UserProfileDTO dto) {
-        UserProfile profile = new UserProfile();
-        profile.setUserId(dto.getUserId());
-        profile.setName(dto.getName());
-        profile.setGender(dto.getGender());
-        profile.setAge(dto.getAge());
-        profile.setShoulderWidth(dto.getShoulderWidth());
-        profile.setBodyHeight(dto.getBodyHeight());
-        profile.setAcupointTableId(dto.getAcupointTableId());
+        // 手机号唯一性校验
+        checkPhoneUnique(dto.getPhone(), null);
+        // 指宽范围校验(基于性别)
+        validateFingerWidths(dto);
+        UserProfile profile = buildProfileFromDto(dto);
         save(profile);
-        LogUtil.info(UserProfileServiceImpl.class, "新增子用户[{}],所属用户[{}]", dto.getName(), dto.getUserId());
+        LogUtil.info(UserProfileServiceImpl.class, "新增子用户[{}],手机号[{}]", dto.getName(), dto.getPhone());
+        // 新增子用户后,自动生成穴位坐标(忽略异常,不影响主流程)
+        try {
+            userAcupointService.generateForUser(profile.getId());
+        } catch (Exception e) {
+            LogUtil.error(UserProfileServiceImpl.class,
+                    "新增子用户[" + profile.getId() + "]触发穴位坐标生成失败", e);
+        }
     }
 
     /**
@@ -69,20 +77,27 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
         if (exist == null) {
             throw new BusinessException(ResultCode.PROFILE_NOT_FOUND);
         }
-        UserProfile profile = new UserProfile();
+        // 如果修改了手机号,校验唯一性
+        if (StringUtils.hasText(dto.getPhone()) && !dto.getPhone().equals(exist.getPhone())) {
+            checkPhoneUnique(dto.getPhone(), dto.getId());
+        }
+        // 指宽范围校验(基于性别)
+        validateFingerWidths(dto);
+        UserProfile profile = buildProfileFromDto(dto);
         profile.setId(dto.getId());
-        profile.setName(dto.getName());
-        profile.setGender(dto.getGender());
-        profile.setAge(dto.getAge());
-        profile.setShoulderWidth(dto.getShoulderWidth());
-        profile.setBodyHeight(dto.getBodyHeight());
-        profile.setAcupointTableId(dto.getAcupointTableId());
         updateById(profile);
         LogUtil.info(UserProfileServiceImpl.class, "修改子用户[{}]", dto.getId());
+        // 修改子用户体型数据后,自动重新生成穴位坐标(忽略异常,不影响主流程)
+        try {
+            userAcupointService.generateForUser(dto.getId());
+        } catch (Exception e) {
+            LogUtil.error(UserProfileServiceImpl.class,
+                    "修改子用户[" + dto.getId() + "]触发穴位坐标重新生成失败", e);
+        }
     }
 
     /**
-     * 删除子用户
+     * 删除子用户(逻辑删除)
      *
      * @param id 子用户ID
      */
@@ -95,4 +110,153 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
         removeById(id);
         LogUtil.info(UserProfileServiceImpl.class, "删除子用户[{}]", id);
     }
+
+    /**
+     * 批量删除子用户(逻辑删除)
+     *
+     * @param ids 子用户ID列表
+     */
+    @Override
+    public void batchDelete(List<Long> ids) {
+        if (CollectionUtils.isEmpty(ids)) {
+            throw new BusinessException(ResultCode.PARAM_ERROR);
+        }
+        removeByIds(ids);
+        LogUtil.info(UserProfileServiceImpl.class, "批量删除子用户,共[{}]条", ids.size());
+    }
+
+    /**
+     * 批量导入子用户
+     *
+     * @param list 子用户信息列表
+     */
+    @Override
+    public void batchImport(List<UserProfileDTO> list) {
+        if (CollectionUtils.isEmpty(list)) {
+            throw new BusinessException(ResultCode.PARAM_ERROR);
+        }
+        for (UserProfileDTO dto : list) {
+            // 手机号已存在则跳过(幂等处理)
+            long count = lambdaQuery().eq(UserProfile::getPhone, dto.getPhone()).count();
+            if (count > 0) {
+                continue;
+            }
+            // 指宽范围校验(基于性别),不合法则跳过该条记录
+            try {
+                validateFingerWidths(dto);
+            } catch (BusinessException e) {
+                LogUtil.info(UserProfileServiceImpl.class, "批量导入跳过[{}]:指宽数值超出范围", dto.getPhone());
+                continue;
+            }
+            UserProfile profile = buildProfileFromDto(dto);
+            save(profile);
+        }
+        LogUtil.info(UserProfileServiceImpl.class, "批量导入子用户,共[{}]条", list.size());
+    }
+
+    /**
+     * 校验三个指宽字段是否在性别对应的合理范围内
+     * 规格(选填,值为 null 时跳过):
+     *   1寸:男 1.5~2.8 cm / 女 1.3~2.4 cm
+     *   1.5寸:男 2.2~4.0 cm / 女 2.0~3.5 cm
+     *   3寸:男 4.5~8.0 cm / 女 4.0~7.0 cm
+     *
+     * @param dto 请求 DTO
+     */
+    private void validateFingerWidths(UserProfileDTO dto) {
+        Integer gender = dto.getGender();
+        boolean male = Integer.valueOf(1).equals(gender);
+        boolean female = Integer.valueOf(2).equals(gender);
+        if (!male && !female) {
+            // 性别未知,无法校验,跳过
+            return;
+        }
+        checkFingerWidth("1寸", dto.getFingerWidth1(),
+                male ? new BigDecimal("1.5") : new BigDecimal("1.3"),
+                male ? new BigDecimal("2.8") : new BigDecimal("2.4"));
+        checkFingerWidth("1.5寸", dto.getFingerWidth15(),
+                male ? new BigDecimal("2.2") : new BigDecimal("2.0"),
+                male ? new BigDecimal("4.0") : new BigDecimal("3.5"));
+        checkFingerWidth("3寸", dto.getFingerWidth3(),
+                male ? new BigDecimal("4.5") : new BigDecimal("4.0"),
+                male ? new BigDecimal("8.0") : new BigDecimal("7.0"));
+    }
+
+    /**
+     * 校验单个指宽字段范围(选填,为 null 时直接通过)
+     *
+     * @param label 字段名称(用于错误信息)
+     * @param value 字段值
+     * @param min   允许最小值(含)
+     * @param max   允许最大值(含)
+     */
+    private void checkFingerWidth(String label, BigDecimal value, BigDecimal min, BigDecimal max) {
+        if (value == null) {
+            return;
+        }
+        if (value.compareTo(min) < 0 || value.compareTo(max) > 0) {
+            throw new BusinessException(ResultCode.FINGER_WIDTH_RANGE_ERROR.getCode(),
+                    label + "指宽应在 " + min.toPlainString() + "~" + max.toPlainString() + " cm 之间");
+        }
+    }
+
+    /**
+     * 校验手机号唯一性
+     *
+     * @param phone     手机号
+     * @param excludeId 排除的子用户ID(修改时传入,避免自身冲突)
+     */
+    private void checkPhoneUnique(String phone, Long excludeId) {
+        LambdaQueryWrapper<UserProfile> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(UserProfile::getPhone, phone);
+        if (excludeId != null) {
+            wrapper.ne(UserProfile::getId, excludeId);
+        }
+        long count = count(wrapper);
+        if (count > 0) {
+            throw new BusinessException(ResultCode.PHONE_PROFILE_EXISTS);
+        }
+    }
+
+    /**
+     * 将 DTO 转换为实体对象
+     *
+     * @param dto 请求 DTO
+     * @return UserProfile 实体
+     */
+    private UserProfile buildProfileFromDto(UserProfileDTO dto) {
+        UserProfile profile = new UserProfile();
+        profile.setUserId(dto.getUserId());
+        profile.setName(dto.getName());
+        profile.setGender(dto.getGender());
+        profile.setAge(dto.getAge());
+        profile.setPhone(dto.getPhone());
+        profile.setShoulderWidth(dto.getShoulderWidth());
+        profile.setBodyHeight(dto.getBodyHeight());
+        profile.setFingerWidth1(dto.getFingerWidth1());
+        profile.setFingerWidth15(dto.getFingerWidth15());
+        profile.setFingerWidth3(dto.getFingerWidth3());
+        profile.setAcupointTableId(dto.getAcupointTableId());
+        return profile;
+    }
+
+    /**
+     * 查询用户档案列表(用于下拉选择,支持姓名/手机号模糊搜索,最多返回200条)
+     *
+     * @param keyword 搜索关键字(姓名或手机号,为空则返回全部)
+     * @return 用户档案列表
+     */
+    @Override
+    public List<UserProfile> listOptions(String keyword) {
+        LambdaQueryWrapper<UserProfile> wrapper = new LambdaQueryWrapper<>();
+        wrapper.select(UserProfile::getId, UserProfile::getName, UserProfile::getPhone, UserProfile::getGender);
+        if (StringUtils.hasText(keyword)) {
+            wrapper.and(w -> w.like(UserProfile::getName, keyword)
+                              .or()
+                              .like(UserProfile::getPhone, keyword));
+        }
+        wrapper.orderByAsc(UserProfile::getName).last("LIMIT 200");
+        return list(wrapper);
+    }
 }
+

+ 5 - 0
openspec/backend/src/main/resources/mapper/AcupointMapper.xml

@@ -0,0 +1,5 @@
+<?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.aijiuyi.admin.mapper.AcupointMapper">
+
+</mapper>

+ 81 - 0
openspec/backend/src/main/resources/mapper/DeviceMapper.xml

@@ -0,0 +1,81 @@
+<?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.aijiuyi.admin.mapper.DeviceMapper">
+
+    <!--
+        分页查询设备列表,LEFT JOIN user_device + user_profile 聚合绑定用户数和姓名
+        bound_user_count:已绑定且未删除的用户数
+        bound_user_names:已绑定用户姓名,顿号分隔
+        绑定用户姓名过滤使用子查询,避免 LEFT JOIN 过滤导致无用户设备丢失
+    -->
+    <select id="pageWithUsers" resultType="com.aijiuyi.admin.entity.Device">
+        SELECT
+            d.id,
+            d.device_code,
+            d.device_name,
+            d.device_model,
+            d.serial_no,
+            d.firmware_version,
+            d.online_status,
+            d.last_online_time,
+            d.remark,
+            d.deleted,
+            d.create_time,
+            d.update_time,
+            COUNT(DISTINCT ud.user_id) AS bound_user_count,
+            GROUP_CONCAT(DISTINCT up.name ORDER BY up.name SEPARATOR '、') AS bound_user_names
+        FROM device d
+        LEFT JOIN user_device ud ON ud.device_code = d.device_code
+            AND ud.deleted = 0
+            AND ud.status = 1
+        LEFT JOIN user_profile up ON up.id = ud.user_id
+            AND up.deleted = 0
+        WHERE d.deleted = 0
+        <if test="q.deviceCode != null and q.deviceCode != ''">
+            AND d.device_code LIKE CONCAT('%', #{q.deviceCode}, '%')
+        </if>
+        <if test="q.deviceName != null and q.deviceName != ''">
+            AND d.device_name LIKE CONCAT('%', #{q.deviceName}, '%')
+        </if>
+        <if test="q.onlineStatus != null">
+            AND d.online_status = #{q.onlineStatus}
+        </if>
+        <if test="q.firmwareVersion != null and q.firmwareVersion != ''">
+            AND d.firmware_version = #{q.firmwareVersion}
+        </if>
+        <if test="q.boundUserName != null and q.boundUserName != ''">
+            AND d.device_code IN (
+                SELECT ud2.device_code FROM user_device ud2
+                JOIN user_profile up2 ON up2.id = ud2.user_id
+                WHERE up2.name LIKE CONCAT('%', #{q.boundUserName}, '%')
+                  AND ud2.status = 1
+                  AND ud2.deleted = 0
+                  AND up2.deleted = 0
+            )
+        </if>
+        GROUP BY d.id
+        ORDER BY d.create_time DESC
+    </select>
+
+    <!--
+        根据设备编号查询绑定的用户列表(联表 user_device + user_profile)
+        返回 DeviceUserVO 视图对象:bindId/userId/userName/phone/bindTime/isPrimary
+    -->
+    <select id="getUsersByDeviceCode" resultType="com.aijiuyi.admin.entity.DeviceUserVO">
+        SELECT
+            ud.id        AS bind_id,
+            ud.user_id,
+            up.name      AS user_name,
+            up.phone,
+            ud.bind_time,
+            ud.is_primary
+        FROM user_device ud
+        JOIN user_profile up ON up.id = ud.user_id
+            AND up.deleted = 0
+        WHERE ud.device_code = #{deviceCode}
+          AND ud.deleted = 0
+          AND ud.status = 1
+        ORDER BY ud.is_primary DESC, ud.bind_time ASC
+    </select>
+
+</mapper>

+ 11 - 0
openspec/backend/src/main/resources/mapper/MoxibustionTechniqueMapper.xml

@@ -0,0 +1,11 @@
+<?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 XML
+    简单查询通过 MyBatis Plus 自动生成,复杂查询在此扩展
+-->
+<mapper namespace="com.aijiuyi.admin.mapper.MoxibustionTechniqueMapper">
+
+</mapper>

+ 5 - 0
openspec/backend/src/main/resources/mapper/PlanMapper.xml

@@ -0,0 +1,5 @@
+<?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.aijiuyi.admin.mapper.PlanMapper">
+
+</mapper>

+ 5 - 0
openspec/backend/src/main/resources/mapper/PlanStepMapper.xml

@@ -0,0 +1,5 @@
+<?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.aijiuyi.admin.mapper.PlanStepMapper">
+
+</mapper>

+ 27 - 0
openspec/backend/src/main/resources/mapper/UserAcupointMapper.xml

@@ -0,0 +1,27 @@
+<?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.aijiuyi.admin.mapper.UserAcupointMapper">
+
+    <!-- 查询指定子用户的所有穴位坐标列表 -->
+    <select id="listByUserId" resultType="com.aijiuyi.admin.entity.UserAcupoint">
+        SELECT *
+        FROM user_acupoint
+        WHERE user_id = #{userId}
+        ORDER BY acupoint_id, acupoint_side
+    </select>
+
+    <!-- 删除指定子用户的所有穴位坐标记录(物理删除) -->
+    <delete id="deleteByUserId">
+        DELETE FROM user_acupoint
+        WHERE user_id = #{userId}
+    </delete>
+
+    <!-- 删除指定子用户下某穴位的坐标记录(物理删除) -->
+    <delete id="deleteByUserIdAndAcupointId">
+        DELETE FROM user_acupoint
+        WHERE user_id = #{userId}
+          AND acupoint_id = #{acupointId}
+    </delete>
+
+</mapper>

+ 5 - 0
openspec/backend/src/main/resources/mapper/UserPlanMapper.xml

@@ -0,0 +1,5 @@
+<?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.aijiuyi.admin.mapper.UserPlanMapper">
+
+</mapper>

+ 58 - 0
openspec/backend/src/main/resources/mapper/UserProfileMapper.xml

@@ -1,4 +1,62 @@
 <?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.aijiuyi.admin.mapper.UserProfileMapper">
+
+    <!--
+        分页查询子用户列表,LEFT JOIN user_device 获取绑定设备编号
+        device_codes: GROUP_CONCAT 逗号拼接已绑定设备编号
+        设备编号过滤使用子查询,避免 LEFT JOIN 过滤导致无设备用户丢失
+    -->
+    <select id="pageWithDevices" resultType="com.aijiuyi.admin.entity.UserProfile">
+        SELECT
+            up.id,
+            up.user_id,
+            up.name,
+            up.gender,
+            up.age,
+            up.phone,
+            up.shoulder_width,
+            up.body_height,
+            up.finger_width_1,
+            up.finger_width_15,
+            up.finger_width_3,
+            up.acupoint_table_id,
+            up.deleted,
+            up.create_time,
+            up.update_time,
+            GROUP_CONCAT(ud.device_code ORDER BY ud.id SEPARATOR ',') AS device_codes
+        FROM user_profile up
+        LEFT JOIN user_device ud ON ud.user_id = up.id AND ud.status = 1
+        WHERE up.deleted = 0
+        <if test="q.keyword != null and q.keyword != ''">
+            AND (up.name LIKE CONCAT('%', #{q.keyword}, '%')
+              OR up.phone LIKE CONCAT('%', #{q.keyword}, '%'))
+        </if>
+        <if test="q.gender != null">
+            AND up.gender = #{q.gender}
+        </if>
+        <if test="q.startTime != null and q.startTime != ''">
+            AND up.create_time &gt;= #{q.startTime}
+        </if>
+        <if test="q.endTime != null and q.endTime != ''">
+            AND up.create_time &lt;= #{q.endTime}
+        </if>
+        <if test="q.acupointStatus != null">
+            <choose>
+                <when test="q.acupointStatus == 1">AND up.acupoint_table_id IS NOT NULL</when>
+                <otherwise>AND up.acupoint_table_id IS NULL</otherwise>
+            </choose>
+        </if>
+        <if test="q.deviceCode != null and q.deviceCode != ''">
+            AND up.id IN (
+                SELECT user_id FROM user_device
+                WHERE device_code LIKE CONCAT('%', #{q.deviceCode}, '%')
+                  AND status = 1
+            )
+        </if>
+        GROUP BY up.id
+        ORDER BY up.create_time DESC
+    </select>
+
 </mapper>
+

+ 227 - 18
openspec/backend/src/main/resources/sql/init.sql

@@ -1,4 +1,4 @@
--- ==================== 爱久医管理后台初始化 SQL ====================
+-- ==================== 艾灸椅管理后台初始化 SQL ====================
 -- 执行前请确保已创建数据库:CREATE DATABASE aijiuyi_admin DEFAULT CHARACTER SET utf8mb4;
 -- 数据库连接:jdbc:mysql://localhost:3306/aijiuyi_admin
 
@@ -78,32 +78,42 @@ CREATE TABLE IF NOT EXISTS `app_user` (
 -- 子用户信息表(属于某个应用用户)
 -- ----------------------------
 CREATE TABLE IF NOT EXISTS `user_profile` (
-    `id`               BIGINT       NOT NULL AUTO_INCREMENT COMMENT '主键ID',
-    `user_id`          BIGINT       NOT NULL COMMENT '所属应用用户ID(关联 app_user.id)',
-    `name`             VARCHAR(50)  NOT NULL COMMENT '姓名',
-    `gender`           TINYINT               COMMENT '性别:1=男,2=女',
-    `age`              INT                   COMMENT '年龄',
-    `shoulder_width`   DECIMAL(5,1)          COMMENT '肩宽(cm)',
-    `body_height`      DECIMAL(5,1)          COMMENT '身长(cm)',
-    `acupoint_table_id` BIGINT               COMMENT '用户穴位表ID',
-    `create_time`      DATETIME              COMMENT '创建时间',
-    `update_time`      DATETIME              COMMENT '更新时间',
+    `id`                BIGINT       NOT NULL AUTO_INCREMENT COMMENT '主键ID',
+    `user_id`           BIGINT                COMMENT '所属应用用户ID(关联 app_user.id)',
+    `name`              VARCHAR(50)  NOT NULL COMMENT '姓名',
+    `gender`            TINYINT               COMMENT '性别:1=男,2=女',
+    `age`               INT                   COMMENT '年龄',
+    `phone`             VARCHAR(20)           COMMENT '手机号(唯一)',
+    `shoulder_width`    DECIMAL(5,1)          COMMENT '肩宽(cm)',
+    `body_height`       DECIMAL(5,1)          COMMENT '身长/坐高(cm)',
+    `finger_width_1`    DECIMAL(4,2)          COMMENT '1寸指宽(cm,选填,提高穴位精度)',
+    `finger_width_15`   DECIMAL(4,2)          COMMENT '1.5寸指宽(cm,选填)',
+    `finger_width_3`    DECIMAL(4,2)          COMMENT '3寸指宽(cm,选填)',
+    `acupoint_table_id` BIGINT                COMMENT '用户穴位表ID',
+    `deleted`           TINYINT      NOT NULL DEFAULT 0 COMMENT '逻辑删除:0=未删除,1=已删除',
+    `create_time`       DATETIME              COMMENT '创建时间',
+    `update_time`       DATETIME              COMMENT '更新时间',
     PRIMARY KEY (`id`),
-    KEY `idx_user_id` (`user_id`)
+    KEY `idx_user_id` (`user_id`),
+    KEY `idx_phone` (`phone`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4
   COMMENT = '子用户信息表';
 
 -- ----------------------------
--- 用户设备绑定表
+-- 用户设备绑定表(子用户与设备绑定)
 -- ----------------------------
 CREATE TABLE IF NOT EXISTS `user_device` (
     `id`          BIGINT       NOT NULL AUTO_INCREMENT COMMENT '主键ID',
-    `user_id`     BIGINT       NOT NULL COMMENT '所属应用用户ID(关联 app_user.id)',
-    `device_code` VARCHAR(100) NOT NULL COMMENT '设备唯一编码',
-    `device_name` VARCHAR(100)          COMMENT '设备名称',
-    `status`      TINYINT      NOT NULL DEFAULT 1 COMMENT '绑定状态:1=已绑定,0=已解绑',
+    `user_id`     BIGINT       NOT NULL COMMENT '所属子用户ID(关联 user_profile.id)',
+    `device_code`   VARCHAR(100) NOT NULL COMMENT '设备唯一编码',
+    `device_name`   VARCHAR(100)          COMMENT '设备名称',
+    `device_model`  VARCHAR(100)          COMMENT '设备型号',
+    `is_primary`    TINYINT      NOT NULL DEFAULT 0 COMMENT '是否主设备:1=是,0=否',
+    `online_status` TINYINT      NOT NULL DEFAULT 0 COMMENT '在线状态:1=在线,0=离线',
+    `status`        TINYINT      NOT NULL DEFAULT 1 COMMENT '绑定状态:1=已绑定,0=已解绑',
     `bind_time`   DATETIME              COMMENT '绑定时间',
+    `deleted`     TINYINT      NOT NULL DEFAULT 0 COMMENT '逻辑删除:0=未删除,1=已删除',
     `create_time` DATETIME              COMMENT '创建时间',
     `update_time` DATETIME              COMMENT '更新时间',
     PRIMARY KEY (`id`),
@@ -111,6 +121,205 @@ CREATE TABLE IF NOT EXISTS `user_device` (
     KEY `idx_device_code` (`device_code`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4
-  COMMENT = '用户设备绑定表';
+  COMMENT = '用户设备绑定表(子用户绑定设备)';
+
+-- ----------------------------
+-- 艾灸椅设备表
+-- ----------------------------
+CREATE TABLE IF NOT EXISTS `device` (
+    `id`                BIGINT       NOT NULL AUTO_INCREMENT COMMENT '主键ID',
+    `device_code`       VARCHAR(50)  NOT NULL COMMENT '设备编号(唯一,如:AJY001)',
+    `device_name`       VARCHAR(100) NOT NULL COMMENT '设备名称(如:艾灸椅-001)',
+    `device_model`      VARCHAR(50)           COMMENT '设备型号(AJY-2026 / AJY-2025)',
+    `serial_no`         VARCHAR(50)           COMMENT '设备序列号(唯一)',
+    `firmware_version`  VARCHAR(20)           COMMENT '固件版本(如:v1.2.0)',
+    `online_status`     TINYINT      NOT NULL DEFAULT 0 COMMENT '在线状态:1=在线,0=离线',
+    `last_online_time`  DATETIME              COMMENT '最后在线时间',
+    `remark`            VARCHAR(200)          COMMENT '备注',
+    `deleted`           TINYINT      NOT NULL DEFAULT 0 COMMENT '逻辑删除:0=未删除,1=已删除',
+    `create_time`       DATETIME              COMMENT '创建时间',
+    `update_time`       DATETIME              COMMENT '更新时间',
+    PRIMARY KEY (`id`),
+    UNIQUE KEY `uk_device_code` (`device_code`),
+    UNIQUE KEY `uk_serial_no` (`serial_no`)
+) ENGINE = InnoDB
+  DEFAULT CHARSET = utf8mb4
+  COMMENT = '艾灸椅设备表';
+
+-- ----------------------------
+-- 穴位信息表
+-- ----------------------------
+CREATE TABLE IF NOT EXISTS `acupoint` (
+    `id`                BIGINT        NOT NULL AUTO_INCREMENT COMMENT '主键ID',
+    `acupoint_code`     VARCHAR(100)  NOT NULL COMMENT '穴位编码(唯一标识,如 dazhui)',
+    `name`              VARCHAR(50)   NOT NULL COMMENT '穴位名称(如:大椎穴)',
+    `meridian`          VARCHAR(100)           COMMENT '所属经络(如:督脉、足太阳膀胱经)',
+    `effects`           VARCHAR(500)           COMMENT '功效描述(逗号分隔,如:驱寒,祛湿)',
+    `location_type`     TINYINT                COMMENT '定位方式:1=相对定位,2=绝对定位',
+    `longitude_offset`  DECIMAL(6,2)           COMMENT '相对大椎穴纵向偏移(寸)',
+    `lateral_offset`    DECIMAL(6,2)           COMMENT '相对大椎穴横向偏移(寸,双侧穴位填写)',
+    `side`              TINYINT                COMMENT '侧别:1=中心,2=左侧,3=右侧,4=双侧',
+    `finger_width_type` TINYINT                COMMENT '指寸类型:1=一寸,2=1.5寸,3=三寸',
+    `abs_x`             DECIMAL(8,2)           COMMENT '绝对坐标X(mm)',
+    `abs_y`             DECIMAL(8,2)           COMMENT '绝对坐标Y(mm)',
+    `abs_z`             DECIMAL(8,2)           COMMENT '绝对坐标Z(mm)',
+    `gender`            TINYINT       NOT NULL DEFAULT 0 COMMENT '适用性别:0=不限,1=仅男,2=仅女',
+    `status`            TINYINT       NOT NULL DEFAULT 1 COMMENT '状态:1=活跃,0=待完善',
+    `deleted`           TINYINT       NOT NULL DEFAULT 0 COMMENT '逻辑删除:0=未删除,1=已删除',
+    `create_time`       DATETIME               COMMENT '创建时间',
+    `update_time`       DATETIME               COMMENT '更新时间',
+    PRIMARY KEY (`id`),
+    UNIQUE KEY `uk_acupoint_code` (`acupoint_code`)
+) ENGINE = InnoDB
+  DEFAULT CHARSET = utf8mb4
+  COMMENT = '穴位信息表';
+
+-- 初始化12个常用穴位
+INSERT INTO `acupoint` (`acupoint_code`, `name`, `meridian`, `effects`, `location_type`, `longitude_offset`, `lateral_offset`, `side`, `finger_width_type`, `gender`, `status`, `deleted`, `create_time`, `update_time`) VALUES
+('dazhui',   '大椎穴', '督脉',         '驱寒,祛湿',   1, 0.00,  NULL,  1, 1, 0, 1, 0, NOW(), NOW()),
+('fengmen',  '风门穴', '足太阳膀胱经', '祛风,解表',   1, 2.00,  1.50,  4, 1, 0, 1, 0, NOW(), NOW()),
+('feishu',   '肺俞穴', '足太阳膀胱经', '宣肺,止咳',   1, 3.00,  1.50,  4, 1, 0, 1, 0, NOW(), NOW()),
+('xinshu',   '心俞穴', '足太阳膀胱经', '养心,安神',   1, 5.00,  1.50,  4, 1, 0, 1, 0, NOW(), NOW()),
+('ganshu',   '肝俞穴', '足太阳膀胱经', '疏肝,理气',   1, 9.00,  1.50,  4, 1, 0, 1, 0, NOW(), NOW()),
+('pishu',    '脾俞穴', '足太阳膀胱经', '健脾,祛湿',   1, 11.00, 1.50,  4, 1, 0, 1, 0, NOW(), NOW()),
+('weishu',   '胃俞穴', '足太阳膀胱经', '和胃,消食',   1, 12.00, 1.50,  4, 1, 0, 1, 0, NOW(), NOW()),
+('shenshu',  '肾俞穴', '足太阳膀胱经', '补肾,扶阳',   1, 14.00, 1.50,  4, 1, 0, 1, 0, NOW(), NOW()),
+('mingmen',  '命门穴', '督脉',         '扶阳,固本',   1, 14.00, NULL,  1, 1, 0, 1, 0, NOW(), NOW()),
+('zhongwan', '中脘穴', '任脉',         '健脾,和胃',   2, NULL,  NULL,  1, NULL, 0, 1, 0, NOW(), NOW()),
+('qihai',    '气海穴', '任脉',         '扶阳,益气',   2, NULL,  NULL,  1, NULL, 0, 1, 0, NOW(), NOW()),
+('guanyuan', '关元穴', '任脉',         '温肾,扶阳',   2, NULL,  NULL,  1, NULL, 0, 1, 0, NOW(), NOW());
+
+-- ----------------------------
+-- 用户穴位坐标表(根据用户体型数据和穴位信息计算生成)
+-- ----------------------------
+CREATE TABLE IF NOT EXISTS `user_acupoint` (
+    `id`             BIGINT        NOT NULL AUTO_INCREMENT COMMENT '主键ID',
+    `user_id`        BIGINT        NOT NULL COMMENT '子用户ID(关联 user_profile.id)',
+    `acupoint_id`    BIGINT        NOT NULL COMMENT '穴位ID(关联 acupoint.id)',
+    `acupoint_name`  VARCHAR(50)   NOT NULL COMMENT '穴位名称(冗余存储,加速查询)',
+    `acupoint_side`  VARCHAR(10)   NOT NULL DEFAULT 'center' COMMENT '侧别:center=中心,left=左侧,right=右侧',
+    `cun_value`      DECIMAL(6,2)           COMMENT '相对大椎穴纵向偏移(寸)',
+    `cun_type`       VARCHAR(10)            COMMENT '指寸类型:1寸/1.5寸/3寸',
+    `coordinate_x`   DECIMAL(8,2)           COMMENT '计算后的X坐标(mm,相对大椎穴,向右为正)',
+    `coordinate_y`   DECIMAL(8,2)           COMMENT '计算后的Y坐标(mm,相对大椎穴,向下为正)',
+    `create_time`    DATETIME               COMMENT '首次生成时间',
+    `update_time`    DATETIME               COMMENT '最后更新时间',
+    PRIMARY KEY (`id`),
+    KEY `idx_user_id` (`user_id`),
+    KEY `idx_acupoint_id` (`acupoint_id`)
+) ENGINE = InnoDB
+  DEFAULT CHARSET = utf8mb4
+  COMMENT = '用户穴位坐标表(按用户体型计算的个性化穴位坐标)';
+
+-- ----------------------------
+-- 艾灸手法表
+-- ----------------------------
+CREATE TABLE IF NOT EXISTS `moxibustion_technique` (
+    `id`               BIGINT        NOT NULL AUTO_INCREMENT COMMENT '主键ID',
+    `technique_code`   VARCHAR(50)   NOT NULL COMMENT '手法编码(唯一标识,如 oneclick)',
+    `name`             VARCHAR(50)   NOT NULL COMMENT '手法名称(如:一键艾灸)',
+    `motion_mode`      VARCHAR(20)   NOT NULL COMMENT '运动模式:default=默认工艺,fixed=固定不动,updown=上下移动,circular=圆周运动,dotted=点状移动',
+    `temp_min`         DECIMAL(4,1)  NOT NULL COMMENT '温度范围最小值(°C,35-50)',
+    `temp_max`         DECIMAL(4,1)  NOT NULL COMMENT '温度范围最大值(°C,35-50)',
+    `time_min`         INT           NOT NULL COMMENT '时间范围最小值(分钟,1-30)',
+    `time_max`         INT           NOT NULL COMMENT '时间范围最大值(分钟,1-30)',
+    `motion_amplitude` DECIMAL(4,1)           COMMENT '运动幅度(mm,1-20,运动模式非固定不动时必填)',
+    `motion_speed`     DECIMAL(4,1)           COMMENT '运动速度(mm/s,1-10,运动模式非固定不动时必填)',
+    `status`           TINYINT       NOT NULL DEFAULT 1 COMMENT '状态:1=启用,0=禁用',
+    `remark`           VARCHAR(200)           COMMENT '备注(最长200字符)',
+    `deleted`          TINYINT       NOT NULL DEFAULT 0 COMMENT '逻辑删除:0=未删除,1=已删除',
+    `create_time`      DATETIME               COMMENT '创建时间',
+    `update_time`      DATETIME               COMMENT '更新时间',
+    PRIMARY KEY (`id`),
+    UNIQUE KEY `uk_technique_code` (`technique_code`)
+) ENGINE = InnoDB
+  DEFAULT CHARSET = utf8mb4
+  COMMENT = '艾灸手法表';
+
+-- 初始化5个内置手法
+INSERT INTO `moxibustion_technique` (`technique_code`, `name`, `motion_mode`, `temp_min`, `temp_max`, `time_min`, `time_max`, `motion_amplitude`, `motion_speed`, `status`, `deleted`, `create_time`, `update_time`) VALUES
+('oneclick', '一键艾灸', 'default',   42.0, 45.0,  30, 30,  NULL, NULL, 1, 0, NOW(), NOW()),
+('gentle',   '温和灸',   'fixed',     35.0, 50.0,   1, 30,  NULL, NULL, 1, 0, NOW(), NOW()),
+('pecking',  '雀啄灸',   'updown',    35.0, 50.0,   1, 30,  10.0,  5.0, 1, 0, NOW(), NOW()),
+('circular', '回旋灸',   'circular',  35.0, 50.0,   1, 30,  15.0,  3.0, 1, 0, NOW(), NOW()),
+('sparrow',  '麻雀灸',   'dotted',    35.0, 50.0,   1, 30,   8.0,  4.0, 1, 0, NOW(), NOW());
+
+-- ----------------------------
+-- 方案表(艾灸方案)
+-- ----------------------------
+CREATE TABLE IF NOT EXISTS `plan` (
+    `id`               BIGINT        NOT NULL AUTO_INCREMENT COMMENT '主键ID',
+    `plan_code`        VARCHAR(50)   NOT NULL COMMENT '方案编码(唯一标识,如 S001)',
+    `name`             VARCHAR(100)  NOT NULL COMMENT '方案名称(最长100字符)',
+    `mode_type`        TINYINT       NOT NULL COMMENT '模式类型:1=一键艾灸,2=专业模式,3=自定义模式,4=延年圣手',
+    `effect_type`      VARCHAR(20)            COMMENT '功效类型:驱寒/祛湿/祛风/化瘀/活血/化痰/养颜/扶阳',
+    `symptoms`         VARCHAR(500)           COMMENT '适用症状(逗号分隔:怕冷,感冒,咳嗽,...)',
+    `applicable_gender` TINYINT      NOT NULL DEFAULT 0 COMMENT '适用人群:0=不限,1=仅男,2=仅女',
+    `age_min`          INT           NOT NULL DEFAULT 1 COMMENT '适用年龄最小值(岁)',
+    `age_max`          INT           NOT NULL DEFAULT 120 COMMENT '适用年龄最大值(岁)',
+    `description`      VARCHAR(200)           COMMENT '方案描述(最长200字符)',
+    `author_type`      TINYINT       NOT NULL DEFAULT 1 COMMENT '创作人类型:1=管理员,2=普通用户,3=专家',
+    `author_id`        BIGINT                 COMMENT '创作人ID(对应 sys_user.id 或 app_user.id)',
+    `author_name`      VARCHAR(100)           COMMENT '创作人名称(冗余存储,加速查询)',
+    `status`           TINYINT       NOT NULL DEFAULT 0 COMMENT '状态:0=草稿,1=已发布,2=已下架',
+    `use_count`        INT           NOT NULL DEFAULT 0 COMMENT '使用人数',
+    `avg_rating`       DECIMAL(3,1)           COMMENT '平均评分',
+    `last_use_time`    DATETIME               COMMENT '最后使用时间',
+    `deleted`          TINYINT       NOT NULL DEFAULT 0 COMMENT '逻辑删除:0=未删除,1=已删除',
+    `create_time`      DATETIME               COMMENT '创建时间',
+    `update_time`      DATETIME               COMMENT '更新时间',
+    PRIMARY KEY (`id`),
+    UNIQUE KEY `uk_plan_code` (`plan_code`)
+) ENGINE = InnoDB
+  DEFAULT CHARSET = utf8mb4
+  COMMENT = '方案表(艾灸方案)';
+
+-- ----------------------------
+-- 方案步骤表
+-- ----------------------------
+CREATE TABLE IF NOT EXISTS `plan_step` (
+    `id`             BIGINT        NOT NULL AUTO_INCREMENT COMMENT '主键ID',
+    `plan_id`        BIGINT        NOT NULL COMMENT '方案ID(关联 plan.id)',
+    `step_order`     INT           NOT NULL COMMENT '步骤序号(从1开始)',
+    `acupoint_id`    BIGINT                 COMMENT '穴位ID(关联 acupoint.id)',
+    `acupoint_name`  VARCHAR(50)   NOT NULL COMMENT '穴位名称(冗余存储)',
+    `side`           TINYINT       NOT NULL COMMENT '侧别:1=中心,2=左侧,3=右侧,4=双侧',
+    `temperature`    DECIMAL(4,1)  NOT NULL COMMENT '温度(°C,35-50)',
+    `duration`       INT           NOT NULL COMMENT '时间(分钟,1-30)',
+    `technique_id`   BIGINT                 COMMENT '艾灸手法ID(关联 moxibustion_technique.id)',
+    `technique_name` VARCHAR(50)            COMMENT '艾灸手法名称(冗余存储)',
+    `remark`         VARCHAR(100)           COMMENT '备注(最长100字符)',
+    `deleted`        TINYINT       NOT NULL DEFAULT 0 COMMENT '逻辑删除:0=未删除,1=已删除',
+    `create_time`    DATETIME               COMMENT '创建时间',
+    `update_time`    DATETIME               COMMENT '更新时间',
+    PRIMARY KEY (`id`),
+    KEY `idx_plan_id` (`plan_id`)
+) ENGINE = InnoDB
+  DEFAULT CHARSET = utf8mb4
+  COMMENT = '方案步骤表';
+
+-- ----------------------------
+-- 用户方案表(用户个性化工艺参数方案)
+-- ----------------------------
+CREATE TABLE IF NOT EXISTS `user_plan` (
+    `id`          BIGINT        NOT NULL AUTO_INCREMENT COMMENT '主键ID',
+    `user_id`     BIGINT        NOT NULL COMMENT '子用户ID(关联 user_profile.id)',
+    `plan_id`     BIGINT        NOT NULL COMMENT '方案ID(关联 plan.id)',
+    `plan_code`   VARCHAR(50)   NOT NULL COMMENT '方案编码(冗余存储)',
+    `plan_name`   VARCHAR(100)  NOT NULL COMMENT '方案名称(冗余存储)',
+    `mode_type`   TINYINT       NOT NULL COMMENT '模式类型:1=一键艾灸,2=专业模式,3=自定义模式,4=延年圣手',
+    `author_name` VARCHAR(100)           COMMENT '创作人名称(冗余存储)',
+    `step_count`  INT           NOT NULL DEFAULT 0 COMMENT '步骤数量',
+    `use_count`   INT           NOT NULL DEFAULT 0 COMMENT '使用次数',
+    `steps_json`  TEXT                   COMMENT '个性化工艺步骤(JSON格式,含坐标/温度/时间等)',
+    `deleted`     TINYINT       NOT NULL DEFAULT 0 COMMENT '逻辑删除:0=未删除,1=已删除',
+    `create_time` DATETIME               COMMENT '订阅/生成时间',
+    `update_time` DATETIME               COMMENT '更新时间',
+    PRIMARY KEY (`id`),
+    KEY `idx_user_id` (`user_id`),
+    KEY `idx_plan_id` (`plan_id`)
+) ENGINE = InnoDB
+  DEFAULT CHARSET = utf8mb4
+  COMMENT = '用户方案表(用户个性化工艺参数方案)';
 
 SET FOREIGN_KEY_CHECKS = 1;

+ 3 - 0
openspec/frontend/.vite/deps/package.json

@@ -0,0 +1,3 @@
+{
+  "type": "module"
+}

+ 62 - 0
openspec/frontend/src/api/acupoint.js

@@ -0,0 +1,62 @@
+import request from '@/utils/request'
+
+/**
+ * 穴位管理模块 API
+ * 对应后端 AcupointController
+ */
+
+/**
+ * 分页查询穴位列表
+ * @param {Object} params 查询参数:name/meridian/locationType/status/pageNum/pageSize
+ */
+export function getAcupointPage(params) {
+  return request.get('/acupoint/page', { params })
+}
+
+/**
+ * 查询穴位详情
+ * @param {number} id 穴位ID
+ */
+export function getAcupointById(id) {
+  return request.get(`/acupoint/${id}`)
+}
+
+/**
+ * 新增穴位
+ * @param {Object} data 穴位信息
+ */
+export function addAcupoint(data) {
+  return request.post('/acupoint', data)
+}
+
+/**
+ * 修改穴位信息
+ * @param {Object} data 穴位信息(含id)
+ */
+export function updateAcupoint(data) {
+  return request.put('/acupoint', data)
+}
+
+/**
+ * 删除穴位(逻辑删除)
+ * @param {number} id 穴位ID
+ */
+export function deleteAcupoint(id) {
+  return request.delete(`/acupoint/${id}`)
+}
+
+/**
+ * 批量删除穴位
+ * @param {number[]} ids 穴位ID列表
+ */
+export function batchDeleteAcupoint(ids) {
+  return request.delete('/acupoint/batch', { data: ids })
+}
+
+/**
+ * 批量导入穴位
+ * @param {Object[]} list 穴位信息列表
+ */
+export function batchImportAcupoint(list) {
+  return request.post('/acupoint/import', list)
+}

+ 120 - 0
openspec/frontend/src/api/device.js

@@ -0,0 +1,120 @@
+import request from '@/utils/request'
+
+/**
+ * 设备管理模块 API
+ * 对应后端 DeviceController
+ */
+
+// ======================== 设备 CRUD ========================
+
+/**
+ * 分页查询设备列表
+ * @param {Object} params 查询参数:deviceCode/deviceName/boundUserName/onlineStatus/firmwareVersion/pageNum/pageSize
+ */
+export function getDevicePageList(params) {
+  return request.get('/device/page', { params })
+}
+
+/**
+ * 查询设备详情
+ * @param {number} id 设备ID
+ */
+export function getDeviceById(id) {
+  return request.get(`/device/${id}`)
+}
+
+/**
+ * 新增设备
+ * @param {Object} data 设备信息(含 userIds 可选初始绑定用户)
+ */
+export function addDevice(data) {
+  return request.post('/device', data)
+}
+
+/**
+ * 修改设备信息
+ * @param {Object} data 设备信息
+ */
+export function updateDevice(data) {
+  return request.put('/device', data)
+}
+
+/**
+ * 删除设备(逻辑删除)
+ * @param {number} id 设备ID
+ */
+export function deleteDevice(id) {
+  return request.delete(`/device/${id}`)
+}
+
+/**
+ * 批量删除设备
+ * @param {number[]} ids 设备ID列表
+ */
+export function batchDeleteDevice(ids) {
+  return request.delete('/device/batch', { data: ids })
+}
+
+/**
+ * 批量导入设备
+ * @param {Object[]} list 设备信息列表
+ */
+export function batchImportDevice(list) {
+  return request.post('/device/import', list)
+}
+
+// ======================== 设备用户管理 ========================
+
+/**
+ * 查询设备绑定的用户列表
+ * @param {number} deviceId 设备ID
+ */
+export function getDeviceUsers(deviceId) {
+  return request.get(`/device/${deviceId}/users`)
+}
+
+/**
+ * 为设备添加绑定用户
+ * @param {number} deviceId  设备ID
+ * @param {number} profileId 用户档案ID
+ */
+export function addDeviceUser(deviceId, profileId) {
+  return request.post(`/device/${deviceId}/users/${profileId}`)
+}
+
+/**
+ * 解绑设备用户
+ * @param {number} deviceId  设备ID
+ * @param {number} profileId 用户档案ID
+ */
+export function removeDeviceUser(deviceId, profileId) {
+  return request.delete(`/device/${deviceId}/users/${profileId}`)
+}
+
+/**
+ * 设为主用户
+ * @param {number} deviceId  设备ID
+ * @param {number} profileId 用户档案ID
+ */
+export function setDeviceUserPrimary(deviceId, profileId) {
+  return request.put(`/device/${deviceId}/users/${profileId}/primary`)
+}
+
+/**
+ * 批量解绑设备用户
+ * @param {number}   deviceId 设备ID
+ * @param {number[]} bindIds  绑定记录ID列表(user_device.id)
+ */
+export function batchRemoveDeviceUsers(deviceId, bindIds) {
+  return request.delete(`/device/${deviceId}/users/batch`, { data: bindIds })
+}
+
+// ======================== 用户档案选项(供绑定用户下拉使用)========================
+
+/**
+ * 查询用户档案选项列表
+ * @param {string} keyword 搜索关键字(姓名或手机号,选填)
+ */
+export function getUserProfileOptions(keyword) {
+  return request.get('/user/profile/options', { params: { keyword } })
+}

+ 12 - 0
openspec/frontend/src/api/index.js

@@ -13,3 +13,15 @@ export * as userApi from './user'
 
 // 日志管理模块
 export * as logApi from './log'
+
+// 穴位管理模块
+export * as acupointApi from './acupoint'
+
+// 设备管理模块
+export * as deviceApi from './device'
+
+// 艾灸手法管理模块
+export * as moxibustionApi from './moxibustion'
+
+// 方案管理模块
+export * as planApi from './plan'

+ 54 - 0
openspec/frontend/src/api/moxibustion.js

@@ -0,0 +1,54 @@
+import request from '@/utils/request'
+
+/**
+ * 艾灸手法管理模块 API
+ * 对应后端 MoxibustionTechniqueController
+ */
+
+/**
+ * 分页查询艾灸手法列表
+ * @param {Object} params 查询参数:name/motionMode/status/pageNum/pageSize
+ */
+export function getTechniquePage(params) {
+  return request.get('/moxibustion-technique/page', { params })
+}
+
+/**
+ * 查询艾灸手法详情
+ * @param {number} id 手法ID
+ */
+export function getTechniqueById(id) {
+  return request.get(`/moxibustion-technique/${id}`)
+}
+
+/**
+ * 新增艾灸手法
+ * @param {Object} data 手法信息
+ */
+export function addTechnique(data) {
+  return request.post('/moxibustion-technique', data)
+}
+
+/**
+ * 修改艾灸手法
+ * @param {Object} data 手法信息(含id)
+ */
+export function updateTechnique(data) {
+  return request.put('/moxibustion-technique', data)
+}
+
+/**
+ * 删除艾灸手法(逻辑删除)
+ * @param {number} id 手法ID
+ */
+export function deleteTechnique(id) {
+  return request.delete(`/moxibustion-technique/${id}`)
+}
+
+/**
+ * 批量删除艾灸手法
+ * @param {number[]} ids 手法ID列表
+ */
+export function batchDeleteTechnique(ids) {
+  return request.delete('/moxibustion-technique/batch', { data: ids })
+}

+ 97 - 0
openspec/frontend/src/api/plan.js

@@ -0,0 +1,97 @@
+import request from '@/utils/request'
+
+/**
+ * 分页查询方案列表
+ * @param {Object} params 查询条件
+ */
+export function getPlanPage(params) {
+  return request.get('/plan/page', { params })
+}
+
+/**
+ * 查询方案详情(含步骤)
+ * @param {number} id 方案ID
+ */
+export function getPlanDetail(id) {
+  return request.get(`/plan/${id}`)
+}
+
+/**
+ * 新增方案(保存为草稿)
+ * @param {Object} data 方案信息(含步骤列表)
+ */
+export function addPlan(data) {
+  return request.post('/plan', data)
+}
+
+/**
+ * 修改方案信息(含步骤)
+ * @param {Object} data 方案信息(含步骤列表)
+ */
+export function updatePlan(data) {
+  return request.put('/plan', data)
+}
+
+/**
+ * 删除方案(仅草稿可删)
+ * @param {number} id 方案ID
+ */
+export function deletePlan(id) {
+  return request.delete(`/plan/${id}`)
+}
+
+/**
+ * 批量删除方案(仅草稿可删)
+ * @param {Array} ids 方案ID列表
+ */
+export function batchDeletePlan(ids) {
+  return request.delete('/plan/batch', { data: ids })
+}
+
+/**
+ * 发布方案
+ * @param {number} id 方案ID
+ */
+export function publishPlan(id) {
+  return request.put(`/plan/${id}/publish`)
+}
+
+/**
+ * 批量发布方案
+ * @param {Array} ids 方案ID列表
+ */
+export function batchPublishPlan(ids) {
+  return request.put('/plan/batch/publish', ids)
+}
+
+/**
+ * 下架方案
+ * @param {number} id 方案ID
+ */
+export function offshelfPlan(id) {
+  return request.put(`/plan/${id}/offshelf`)
+}
+
+/**
+ * 批量下架方案
+ * @param {Array} ids 方案ID列表
+ */
+export function batchOffshelfPlan(ids) {
+  return request.put('/plan/batch/offshelf', ids)
+}
+
+/**
+ * 分页查询用户方案列表
+ * @param {Object} params { userId, pageNum, pageSize }
+ */
+export function getUserPlanPage(params) {
+  return request.get('/user-plan/page', { params })
+}
+
+/**
+ * 查询用户方案详情
+ * @param {number} id 用户方案ID
+ */
+export function getUserPlanDetail(id) {
+  return request.get(`/user-plan/${id}`)
+}

+ 112 - 52
openspec/frontend/src/api/user.js

@@ -2,100 +2,83 @@ import request from '@/utils/request'
 
 /**
  * 用户管理模块 API
- * 对应后端 AppUserController / UserProfileController / UserDeviceController
+ * 对应后端 UserProfileController / UserDeviceController
  */
 
-// ======================== 应用用户 ========================
+// ======================== 用户管理(子用户档案)========================
 
 /**
- * 分页查询应用用户列表
- * @param {Object} params 查询参数
+ * 分页查询用户列表(联表获取设备编号)
+ * @param {Object} params 查询参数:keyword/deviceCode/gender/startTime/endTime/acupointStatus/pageNum/pageSize
  */
-export function getAppUserPage(params) {
-  return request.get('/user/app/page', { params })
+export function getProfilePage(params) {
+  return request.get('/user/profile/page', { params })
 }
 
 /**
- * 查询应用用户详情
+ * 查询用户详情
  * @param {number} id 用户ID
  */
-export function getAppUserById(id) {
-  return request.get(`/user/app/${id}`)
+export function getProfileById(id) {
+  return request.get(`/user/profile/${id}`)
 }
 
 /**
- * 新增应用用户
+ * 新增用户
  * @param {Object} data 用户信息
  */
-export function addAppUser(data) {
-  return request.post('/user/app', data)
+export function addProfile(data) {
+  return request.post('/user/profile', data)
 }
 
 /**
- * 修改应用用户
+ * 修改用户
  * @param {Object} data 用户信息
  */
-export function updateAppUser(data) {
-  return request.put('/user/app', data)
+export function updateProfile(data) {
+  return request.put('/user/profile', data)
 }
 
 /**
- * 删除应用用户
+ * 删除用户
  * @param {number} id 用户ID
  */
-export function deleteAppUser(id) {
-  return request.delete(`/user/app/${id}`)
-}
-
-/**
- * 修改应用用户状态
- * @param {number} id     用户ID
- * @param {number} status 目标状态:1=启用,0=禁用
- */
-export function updateAppUserStatus(id, status) {
-  return request.put(`/user/app/${id}/status`, null, { params: { status } })
+export function deleteProfile(id) {
+  return request.delete(`/user/profile/${id}`)
 }
 
-// ======================== 子用户 ========================
-
 /**
- * 分页查询子用户列表
- * @param {Object} params 查询参数
+ * 批量删除用户
+ * @param {number[]} ids 用户ID列表
  */
-export function getProfilePage(params) {
-  return request.get('/user/profile/page', { params })
+export function batchDeleteProfile(ids) {
+  return request.delete('/user/profile/batch', { data: ids })
 }
 
 /**
- * 查询子用户详情
- * @param {number} id 子用户ID
+ * 批量导入用户
+ * @param {Object[]} list 用户信息列表
  */
-export function getProfileById(id) {
-  return request.get(`/user/profile/${id}`)
+export function batchImportProfile(list) {
+  return request.post('/user/profile/import', list)
 }
 
-/**
- * 新增子用户
- * @param {Object} data 子用户信息
- */
-export function addProfile(data) {
-  return request.post('/user/profile', data)
-}
+// ======================== 用户穴位管理 ========================
 
 /**
- * 修改子用户
- * @param {Object} data 子用户信息
+ * 手动为指定子用户生成(或重新生成)穴位坐标表
+ * @param {number} profileId 子用户ID(user_profile.id)
  */
-export function updateProfile(data) {
-  return request.put('/user/profile', data)
+export function generateUserAcupoint(profileId) {
+  return request.post(`/user/acupoint/${profileId}/generate`)
 }
 
 /**
- * 删除子用户
- * @param {number} id 子用户ID
+ * 查询指定子用户的穴位坐标列表
+ * @param {number} profileId 子用户ID
  */
-export function deleteProfile(id) {
-  return request.delete(`/user/profile/${id}`)
+export function getUserAcupointList(profileId) {
+  return request.get(`/user/acupoint/${profileId}/list`)
 }
 
 // ======================== 设备管理 ========================
@@ -108,6 +91,14 @@ export function getDevicePage(params) {
   return request.get('/user/device/page', { params })
 }
 
+/**
+ * 新增设备绑定
+ * @param {Object} data 设备信息
+ */
+export function addDevice(data) {
+  return request.post('/user/device', data)
+}
+
 /**
  * 解绑设备
  * @param {number} id 设备记录ID
@@ -116,6 +107,23 @@ export function unbindDevice(id) {
   return request.put(`/user/device/${id}/unbind`)
 }
 
+/**
+ * 设置主设备
+ * @param {number} id     设备记录ID
+ * @param {number} userId 所属子用户ID
+ */
+export function setPrimaryDevice(id, userId) {
+  return request.put(`/user/device/${id}/primary`, null, { params: { userId } })
+}
+
+/**
+ * 批量解绑设备
+ * @param {number[]} ids 设备记录ID列表
+ */
+export function batchUnbindDevices(ids) {
+  return request.put('/user/device/batch-unbind', ids)
+}
+
 /**
  * 删除设备记录
  * @param {number} id 设备记录ID
@@ -123,3 +131,55 @@ export function unbindDevice(id) {
 export function deleteDevice(id) {
   return request.delete(`/user/device/${id}`)
 }
+
+// ======================== 应用用户(保留,备用)========================
+
+/**
+ * 分页查询应用用户列表
+ * @param {Object} params 查询参数
+ */
+export function getAppUserPage(params) {
+  return request.get('/user/app/page', { params })
+}
+
+/**
+ * 查询应用用户详情
+ * @param {number} id 用户ID
+ */
+export function getAppUserById(id) {
+  return request.get(`/user/app/${id}`)
+}
+
+/**
+ * 新增应用用户
+ * @param {Object} data 用户信息
+ */
+export function addAppUser(data) {
+  return request.post('/user/app', data)
+}
+
+/**
+ * 修改应用用户
+ * @param {Object} data 用户信息
+ */
+export function updateAppUser(data) {
+  return request.put('/user/app', data)
+}
+
+/**
+ * 删除应用用户
+ * @param {number} id 用户ID
+ */
+export function deleteAppUser(id) {
+  return request.delete(`/user/app/${id}`)
+}
+
+/**
+ * 修改应用用户状态
+ * @param {number} id     用户ID
+ * @param {number} status 目标状态:1=启用,0=禁用
+ */
+export function updateAppUserStatus(id, status) {
+  return request.put(`/user/app/${id}/status`, null, { params: { status } })
+}
+

+ 2 - 1
openspec/frontend/src/layout/index.vue

@@ -5,7 +5,7 @@
       <!-- Logo 区域 -->
       <div class="sidebar-logo">
         <img src="/logo.svg" alt="logo" class="logo-img" @error="handleLogoError" />
-        <span v-show="!isCollapsed" class="logo-title">爱久医管理</span>
+        <span v-show="!isCollapsed" class="logo-title">艾灸椅管理</span>
       </div>
       <!-- 导航菜单 -->
       <el-menu
@@ -104,6 +104,7 @@ const currentRoute = computed(() => route)
 const menuRoutes = computed(() => {
   return router.getRoutes().filter(r =>
     r.meta?.title &&
+    !r.meta?.hidden &&
     r.path !== '/' &&
     r.path !== '/login' &&
     r.path !== '/404'

+ 39 - 3
openspec/frontend/src/router/index.js

@@ -35,19 +35,55 @@ const routes = [
         path: 'user/profile',
         name: 'UserProfile',
         component: () => import('@/views/user/profile/index.vue'),
-        meta: { requiresAuth: true, title: '子用户管理', icon: 'UserFilled' }
+        meta: { requiresAuth: true, title: '用户管理', icon: 'UserFilled' }
       },
       {
         path: 'user/device',
         name: 'UserDevice',
         component: () => import('@/views/user/device/index.vue'),
-        meta: { requiresAuth: true, title: '设备管理', icon: 'Monitor' }
+        meta: { requiresAuth: true, title: '用户设备管理', icon: 'Monitor', hidden: true }
       },
       {
         path: 'log',
         name: 'Log',
         component: () => import('@/views/log/index.vue'),
         meta: { requiresAuth: true, title: '日志管理', icon: 'Document' }
+      },
+      {
+        path: 'acupoint',
+        name: 'Acupoint',
+        component: () => import('@/views/acupoint/index.vue'),
+        meta: { requiresAuth: true, title: '穴位管理', icon: 'FirstAidKit' }
+      },
+      {
+        path: 'device',
+        name: 'Device',
+        component: () => import('@/views/device/index.vue'),
+        meta: { requiresAuth: true, title: '设备管理', icon: 'Monitor' }
+      },
+      {
+        path: 'device/users',
+        name: 'DeviceUsers',
+        component: () => import('@/views/device/users.vue'),
+        meta: { requiresAuth: true, title: '设备用户管理', hidden: true }
+      },
+      {
+        path: 'moxibustion',
+        name: 'Moxibustion',
+        component: () => import('@/views/moxibustion/index.vue'),
+        meta: { requiresAuth: true, title: '艾灸手法管理', icon: 'Promotion' }
+      },
+      {
+        path: 'plan',
+        name: 'Plan',
+        component: () => import('@/views/plan/index.vue'),
+        meta: { requiresAuth: true, title: '方案管理', icon: 'Notebook' }
+      },
+      {
+        path: 'user/plan',
+        name: 'UserPlan',
+        component: () => import('@/views/user/plan/index.vue'),
+        meta: { requiresAuth: true, title: '用户方案管理', hidden: true }
       }
     ]
   },
@@ -73,7 +109,7 @@ const router = createRouter({
 router.beforeEach((to, from, next) => {
   // 设置页面标题
   if (to.meta?.title) {
-    document.title = `${to.meta.title} - 爱久医管理后台`
+    document.title = `${to.meta.title} - 艾灸椅管理后台`
   }
 
   const token = getToken()

+ 573 - 0
openspec/frontend/src/views/acupoint/index.vue

@@ -0,0 +1,573 @@
+<template>
+  <div class="page-container">
+    <!-- 搜索区域 -->
+    <el-card class="search-card">
+      <el-form :model="queryForm" inline>
+        <el-form-item label="穴位名称">
+          <el-input v-model="queryForm.name" placeholder="请输入穴位名称" clearable style="width:180px" />
+        </el-form-item>
+        <el-form-item label="所属经络">
+          <el-select v-model="queryForm.meridian" placeholder="全部" clearable style="width:160px">
+            <el-option label="督脉" value="督脉" />
+            <el-option label="任脉" value="任脉" />
+            <el-option label="足太阳膀胱经" value="足太阳膀胱经" />
+            <el-option label="手太阳小肠经" value="手太阳小肠经" />
+            <el-option label="足阳明胃经" value="足阳明胃经" />
+            <el-option label="其他" value="其他" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="定位方式">
+          <el-select v-model="queryForm.locationType" placeholder="全部" clearable style="width:120px">
+            <el-option label="相对定位" :value="1" />
+            <el-option label="绝对定位" :value="2" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="状态">
+          <el-select v-model="queryForm.status" placeholder="全部" clearable style="width:110px">
+            <el-option label="活跃" :value="1" />
+            <el-option label="待完善" :value="0" />
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" :icon="Search" @click="handleSearch">查询</el-button>
+          <el-button :icon="Refresh" @click="handleReset">重置</el-button>
+        </el-form-item>
+      </el-form>
+    </el-card>
+
+    <!-- 表格区域 -->
+    <el-card class="table-card">
+      <template #header>
+        <div class="card-header">
+          <span class="title">穴位列表</span>
+          <div class="btn-group">
+            <ExcelImport :on-import="handleImport" button-text="导入" @success="loadData" />
+            <ExcelExport
+              :headers="exportHeaders"
+              :data="tableData"
+              file-name="穴位列表"
+            />
+            <el-button type="primary" :icon="Plus" @click="handleAdd">新增</el-button>
+            <el-button
+              type="danger"
+              :icon="Delete"
+              :disabled="selectedIds.length === 0"
+              @click="handleBatchDelete"
+            >批量删除</el-button>
+          </div>
+        </div>
+      </template>
+
+      <el-table
+        :data="tableData"
+        v-loading="loading"
+        border
+        stripe
+        @selection-change="handleSelectionChange"
+      >
+        <el-table-column type="selection" width="50" align="center" />
+        <el-table-column type="index" label="序号" width="60" align="center" />
+        <el-table-column prop="acupointCode" label="穴位编码" width="120" />
+        <el-table-column prop="name" label="穴位名称" width="110" />
+        <el-table-column prop="meridian" label="所属经络" width="140">
+          <template #default="{ row }">{{ row.meridian || '-' }}</template>
+        </el-table-column>
+        <el-table-column prop="effects" label="功效" min-width="160">
+          <template #default="{ row }">
+            <template v-if="row.effects">
+              <el-tag
+                v-for="tag in row.effects.split(',')"
+                :key="tag"
+                size="small"
+                style="margin: 2px"
+              >{{ tag }}</el-tag>
+            </template>
+            <span v-else>-</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="定位方式" width="100" align="center">
+          <template #default="{ row }">
+            <el-tag :type="row.locationType === 1 ? 'primary' : 'warning'" size="small">
+              {{ row.locationType === 1 ? '相对定位' : row.locationType === 2 ? '绝对定位' : '待完善' }}
+            </el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column label="状态" width="90" align="center">
+          <template #default="{ row }">
+            <el-tag :type="row.status === 1 ? 'success' : 'info'" size="small">
+              {{ row.status === 1 ? '活跃' : '待完善' }}
+            </el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" width="180" align="center" fixed="right">
+          <template #default="{ row }">
+            <el-button size="small" type="primary" link @click="handleView(row)">查看</el-button>
+            <el-button size="small" type="warning" link @click="handleEdit(row)">编辑</el-button>
+            <el-button size="small" type="danger" link @click="handleDelete(row)">删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+
+      <!-- 分页 -->
+      <el-pagination
+        v-model:current-page="queryForm.pageNum"
+        v-model:page-size="queryForm.pageSize"
+        :page-sizes="[10, 20, 50]"
+        :total="total"
+        layout="total, sizes, prev, pager, next, jumper"
+        class="pagination"
+        @size-change="loadData"
+        @current-change="loadData"
+      />
+    </el-card>
+
+    <!-- 新增/编辑弹窗 -->
+    <el-dialog
+      v-model="dialogVisible"
+      :title="dialogTitle"
+      width="680px"
+      destroy-on-close
+      :close-on-click-modal="false"
+    >
+      <el-form
+        :model="formData"
+        :rules="formRules"
+        ref="formRef"
+        label-width="130px"
+        :disabled="dialogMode === 'view'"
+      >
+        <!-- 基础信息 -->
+        <el-form-item label="穴位编码" prop="acupointCode">
+          <el-input v-model="formData.acupointCode" placeholder="如: hegu(英文小写)" maxlength="100" :disabled="!!formData.id" />
+        </el-form-item>
+        <el-form-item label="穴位名称" prop="name">
+          <el-input v-model="formData.name" placeholder="如:合谷穴" maxlength="50" />
+        </el-form-item>
+        <el-form-item label="所属经络" prop="meridian">
+          <el-select v-model="formData.meridian" placeholder="请选择经络" style="width:100%">
+            <el-option label="督脉" value="督脉" />
+            <el-option label="任脉" value="任脉" />
+            <el-option label="足太阳膀胱经" value="足太阳膀胱经" />
+            <el-option label="手太阳小肠经" value="手太阳小肠经" />
+            <el-option label="足阳明胃经" value="足阳明胃经" />
+            <el-option label="其他" value="其他" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="功效描述" prop="effectsList">
+          <el-checkbox-group v-model="formData.effectsList">
+            <el-checkbox label="驱寒" />
+            <el-checkbox label="祛湿" />
+            <el-checkbox label="祛风" />
+            <el-checkbox label="化瘀" />
+            <el-checkbox label="活血" />
+            <el-checkbox label="化痰" />
+            <el-checkbox label="养颜" />
+            <el-checkbox label="扶阳" />
+          </el-checkbox-group>
+        </el-form-item>
+        <el-form-item label="定位方式" prop="locationType">
+          <el-radio-group v-model="formData.locationType">
+            <el-radio :label="1">相对定位</el-radio>
+            <el-radio :label="2">绝对定位</el-radio>
+          </el-radio-group>
+        </el-form-item>
+
+        <!-- 相对定位字段 -->
+        <template v-if="formData.locationType === 1">
+          <el-form-item label="纵向偏移(寸)" prop="longitudeOffset">
+            <el-input-number v-model="formData.longitudeOffset" :precision="2" :step="0.5" style="width:100%" placeholder="相对大椎穴纵向偏移" />
+          </el-form-item>
+          <el-form-item label="横向偏移(寸)">
+            <el-input-number v-model="formData.lateralOffset" :precision="2" :step="0.5" style="width:100%" placeholder="双侧穴位填写,选填" />
+          </el-form-item>
+          <el-form-item label="指寸类型" prop="fingerWidthType">
+            <el-select v-model="formData.fingerWidthType" placeholder="请选择" style="width:100%">
+              <el-option label="一寸" :value="1" />
+              <el-option label="1.5寸" :value="2" />
+              <el-option label="三寸" :value="3" />
+            </el-select>
+          </el-form-item>
+        </template>
+
+        <!-- 绝对定位字段 -->
+        <template v-if="formData.locationType === 2">
+          <el-form-item label="绝对坐标X(mm)" prop="absX">
+            <el-input-number v-model="formData.absX" :precision="2" style="width:100%" />
+          </el-form-item>
+          <el-form-item label="绝对坐标Y(mm)" prop="absY">
+            <el-input-number v-model="formData.absY" :precision="2" style="width:100%" />
+          </el-form-item>
+          <el-form-item label="绝对坐标Z(mm)" prop="absZ">
+            <el-input-number v-model="formData.absZ" :precision="2" style="width:100%" />
+          </el-form-item>
+        </template>
+
+        <el-form-item label="侧别" prop="side">
+          <el-radio-group v-model="formData.side">
+            <el-radio :label="1">中心</el-radio>
+            <el-radio :label="2">左侧</el-radio>
+            <el-radio :label="3">右侧</el-radio>
+            <el-radio :label="4">双侧</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="适用性别" prop="gender">
+          <el-radio-group v-model="formData.gender">
+            <el-radio :label="0">不限</el-radio>
+            <el-radio :label="1">仅男</el-radio>
+            <el-radio :label="2">仅女</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="状态" prop="status">
+          <el-radio-group v-model="formData.status">
+            <el-radio :label="1">活跃</el-radio>
+            <el-radio :label="0">待完善</el-radio>
+          </el-radio-group>
+        </el-form-item>
+      </el-form>
+      <template #footer>
+        <el-button @click="dialogVisible = false">{{ dialogMode === 'view' ? '关闭' : '取消' }}</el-button>
+        <el-button v-if="dialogMode !== 'view'" type="primary" :loading="submitLoading" @click="handleSubmit">保存</el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import { ref, reactive, onMounted } from 'vue'
+import { ElMessage, ElMessageBox } from 'element-plus'
+import { Search, Refresh, Plus, Delete } from '@element-plus/icons-vue'
+import ExcelImport from '@/components/ExcelImport.vue'
+import ExcelExport from '@/components/ExcelExport.vue'
+import {
+  getAcupointPage,
+  addAcupoint,
+  updateAcupoint,
+  deleteAcupoint,
+  batchDeleteAcupoint,
+  batchImportAcupoint
+} from '@/api/acupoint'
+
+// 查询表单
+const queryForm = reactive({
+  name: '',
+  meridian: '',
+  locationType: null,
+  status: null,
+  pageNum: 1,
+  pageSize: 10
+})
+
+const tableData = ref([])
+const total = ref(0)
+const loading = ref(false)
+const selectedIds = ref([])
+
+// 弹窗
+const dialogVisible = ref(false)
+const dialogTitle = ref('')
+const dialogMode = ref('add') // add | edit | view
+const submitLoading = ref(false)
+const formRef = ref(null)
+
+const defaultForm = () => ({
+  id: null,
+  acupointCode: '',
+  name: '',
+  meridian: '',
+  effectsList: [],
+  locationType: 1,
+  longitudeOffset: null,
+  lateralOffset: null,
+  fingerWidthType: null,
+  absX: null,
+  absY: null,
+  absZ: null,
+  side: 1,
+  gender: 0,
+  status: 1
+})
+
+const formData = reactive(defaultForm())
+
+// 动态校验规则
+const formRules = {
+  acupointCode: [{ required: true, message: '请输入穴位编码', trigger: 'blur' }],
+  name: [
+    { required: true, message: '请输入穴位名称', trigger: 'blur' },
+    { max: 50, message: '穴位名称最长50字符', trigger: 'blur' }
+  ],
+  meridian: [{ required: true, message: '请选择所属经络', trigger: 'change' }],
+  effectsList: [{ required: true, type: 'array', min: 1, message: '请至少选择1项功效', trigger: 'change' }],
+  locationType: [{ required: true, message: '请选择定位方式', trigger: 'change' }],
+  longitudeOffset: [
+    {
+      validator: (rule, value, callback) => {
+        if (formData.locationType === 1 && (value === null || value === undefined)) {
+          callback(new Error('请填写纵向偏移'))
+        } else {
+          callback()
+        }
+      },
+      trigger: 'blur'
+    }
+  ],
+  fingerWidthType: [
+    {
+      validator: (rule, value, callback) => {
+        if (formData.locationType === 1 && !value) {
+          callback(new Error('请选择指寸类型'))
+        } else {
+          callback()
+        }
+      },
+      trigger: 'change'
+    }
+  ],
+  absX: [
+    {
+      validator: (rule, value, callback) => {
+        if (formData.locationType === 2 && (value === null || value === undefined)) {
+          callback(new Error('请填写绝对坐标X'))
+        } else {
+          callback()
+        }
+      },
+      trigger: 'blur'
+    }
+  ],
+  absY: [
+    {
+      validator: (rule, value, callback) => {
+        if (formData.locationType === 2 && (value === null || value === undefined)) {
+          callback(new Error('请填写绝对坐标Y'))
+        } else {
+          callback()
+        }
+      },
+      trigger: 'blur'
+    }
+  ],
+  absZ: [
+    {
+      validator: (rule, value, callback) => {
+        if (formData.locationType === 2 && (value === null || value === undefined)) {
+          callback(new Error('请填写绝对坐标Z'))
+        } else {
+          callback()
+        }
+      },
+      trigger: 'blur'
+    }
+  ],
+  side: [{ required: true, message: '请选择侧别', trigger: 'change' }],
+  gender: [{ required: true, message: '请选择适用性别', trigger: 'change' }]
+}
+
+// 导出列定义
+const exportHeaders = [
+  { label: '穴位编码', prop: 'acupointCode' },
+  { label: '穴位名称', prop: 'name' },
+  { label: '所属经络', prop: 'meridian' },
+  { label: '功效', prop: 'effects' },
+  { label: '定位方式', prop: 'locationTypeLabel' },
+  { label: '侧别', prop: 'sideLabel' },
+  { label: '适用性别', prop: 'genderLabel' },
+  { label: '状态', prop: 'statusLabel' }
+]
+
+/**
+ * 加载穴位列表
+ */
+async function loadData() {
+  loading.value = true
+  try {
+    const res = await getAcupointPage(queryForm)
+    const records = res.data?.records || []
+    // 添加辅助显示字段
+    tableData.value = records.map(item => ({
+      ...item,
+      locationTypeLabel: item.locationType === 1 ? '相对定位' : item.locationType === 2 ? '绝对定位' : '-',
+      sideLabel: ['', '中心', '左侧', '右侧', '双侧'][item.side] || '-',
+      genderLabel: ['不限', '仅男', '仅女'][item.gender] || '-',
+      statusLabel: item.status === 1 ? '活跃' : '待完善'
+    }))
+    total.value = res.data?.total || 0
+  } finally {
+    loading.value = false
+  }
+}
+
+/**
+ * 查询
+ */
+function handleSearch() {
+  queryForm.pageNum = 1
+  loadData()
+}
+
+/**
+ * 重置查询条件
+ */
+function handleReset() {
+  queryForm.name = ''
+  queryForm.meridian = ''
+  queryForm.locationType = null
+  queryForm.status = null
+  queryForm.pageNum = 1
+  loadData()
+}
+
+/**
+ * 多选变化
+ */
+function handleSelectionChange(selection) {
+  selectedIds.value = selection.map(r => r.id)
+}
+
+/**
+ * 填充表单(从行数据反向解析 effects 字段)
+ */
+function fillForm(row) {
+  Object.assign(formData, defaultForm(), {
+    ...row,
+    effectsList: row.effects ? row.effects.split(',').map(s => s.trim()).filter(Boolean) : []
+  })
+}
+
+/**
+ * 打开新增弹窗
+ */
+function handleAdd() {
+  Object.assign(formData, defaultForm())
+  dialogTitle.value = '新增穴位'
+  dialogMode.value = 'add'
+  dialogVisible.value = true
+}
+
+/**
+ * 打开查看弹窗
+ */
+function handleView(row) {
+  fillForm(row)
+  dialogTitle.value = '查看穴位'
+  dialogMode.value = 'view'
+  dialogVisible.value = true
+}
+
+/**
+ * 打开编辑弹窗
+ */
+function handleEdit(row) {
+  fillForm(row)
+  dialogTitle.value = '编辑穴位'
+  dialogMode.value = 'edit'
+  dialogVisible.value = true
+}
+
+/**
+ * 提交保存(新增或编辑)
+ */
+async function handleSubmit() {
+  await formRef.value.validate()
+  submitLoading.value = true
+  try {
+    // 将功效数组转为逗号字符串
+    const payload = {
+      ...formData,
+      effects: formData.effectsList.join(',')
+    }
+    if (formData.id) {
+      await updateAcupoint(payload)
+    } else {
+      await addAcupoint(payload)
+    }
+    ElMessage.success('操作成功')
+    dialogVisible.value = false
+    loadData()
+  } finally {
+    submitLoading.value = false
+  }
+}
+
+/**
+ * 删除单条穴位(二次确认)
+ */
+async function handleDelete(row) {
+  await ElMessageBox.confirm(`确认删除穴位「${row.name}」吗?`, '提示', { type: 'warning' })
+  await deleteAcupoint(row.id)
+  ElMessage.success('删除成功')
+  loadData()
+}
+
+/**
+ * 批量删除穴位(二次确认)
+ */
+async function handleBatchDelete() {
+  await ElMessageBox.confirm(
+    `确认批量删除选中的 ${selectedIds.value.length} 条穴位吗?`,
+    '批量删除确认',
+    { type: 'warning', confirmButtonText: '确认删除', cancelButtonText: '取消' }
+  )
+  await batchDeleteAcupoint(selectedIds.value)
+  ElMessage.success('批量删除成功')
+  selectedIds.value = []
+  loadData()
+}
+
+/**
+ * Excel 导入回调
+ */
+async function handleImport(data) {
+  // 将 Excel 中的中文字段转换为接口所需格式
+  const list = data.map(row => ({
+    acupointCode: row['穴位编码'] || '',
+    name: row['穴位名称'] || '',
+    meridian: row['所属经络'] || '',
+    effects: row['功效'] || '',
+    locationType: row['定位方式'] === '相对定位' ? 1 : row['定位方式'] === '绝对定位' ? 2 : null,
+    gender: row['适用性别'] === '仅男' ? 1 : row['适用性别'] === '仅女' ? 2 : 0,
+    status: row['状态'] === '活跃' ? 1 : 0
+  }))
+  await batchImportAcupoint(list)
+}
+
+onMounted(loadData)
+</script>
+
+<style lang="scss" scoped>
+.page-container {
+  display: flex;
+  flex-direction: column;
+  gap: 16px;
+}
+
+.search-card {
+  :deep(.el-card__body) {
+    padding: 16px 20px 4px;
+  }
+}
+
+.table-card {
+  .card-header {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+
+    .title {
+      font-weight: 600;
+      font-size: 15px;
+    }
+
+    .btn-group {
+      display: flex;
+      gap: 8px;
+      align-items: center;
+    }
+  }
+}
+
+.pagination {
+  margin-top: 16px;
+  justify-content: flex-end;
+}
+</style>

+ 582 - 0
openspec/frontend/src/views/device/index.vue

@@ -0,0 +1,582 @@
+<template>
+  <div class="page-container">
+    <!-- 搜索区域 -->
+    <el-card class="search-card">
+      <el-form :model="query" inline>
+        <el-form-item label="设备编号">
+          <el-input v-model="query.deviceCode" placeholder="请输入设备编号" clearable style="width:160px" />
+        </el-form-item>
+        <el-form-item label="设备名称">
+          <el-input v-model="query.deviceName" placeholder="请输入设备名称" clearable style="width:160px" />
+        </el-form-item>
+        <el-form-item label="绑定用户">
+          <el-input v-model="query.boundUserName" placeholder="用户姓名模糊搜索" clearable style="width:160px" />
+        </el-form-item>
+        <el-form-item label="在线状态">
+          <el-select v-model="query.onlineStatus" placeholder="全部" clearable style="width:110px">
+            <el-option label="在线" :value="1" />
+            <el-option label="离线" :value="0" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="固件版本">
+          <el-select v-model="query.firmwareVersion" placeholder="全部" clearable style="width:130px">
+            <el-option label="v1.2.0" value="v1.2.0" />
+            <el-option label="v1.1.0" value="v1.1.0" />
+            <el-option label="v1.0.0" value="v1.0.0" />
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" :icon="Search" @click="handleSearch">查询</el-button>
+          <el-button :icon="Refresh" @click="handleReset">重置</el-button>
+        </el-form-item>
+      </el-form>
+    </el-card>
+
+    <!-- 操作按钮区 -->
+    <el-card class="action-card">
+      <div class="action-bar">
+        <div class="action-left">
+          <ExcelImport :on-import="handleImport" button-text="导入" @success="onImportSuccess" />
+          <ExcelExport
+            :headers="exportHeaders"
+            :data="tableData"
+            file-name="设备列表"
+          />
+          <el-button type="primary" :icon="Plus" @click="handleAdd">新增</el-button>
+          <el-button
+            type="danger"
+            :icon="Delete"
+            :disabled="selectedIds.length === 0"
+            @click="handleBatchDelete"
+          >批量删除</el-button>
+        </div>
+      </div>
+    </el-card>
+
+    <!-- 表格区域 -->
+    <el-card class="table-card">
+      <el-table
+        :data="tableData"
+        v-loading="loading"
+        border
+        stripe
+        @selection-change="handleSelectionChange"
+      >
+        <el-table-column type="selection" width="50" align="center" />
+        <el-table-column type="index" label="序号" width="60" align="center" />
+        <el-table-column prop="deviceCode" label="设备编号" min-width="110" />
+        <el-table-column prop="deviceName" label="设备名称" min-width="120" />
+        <el-table-column prop="deviceModel" label="设备型号" width="110">
+          <template #default="{ row }">{{ row.deviceModel || '-' }}</template>
+        </el-table-column>
+        <el-table-column label="绑定用户数" width="95" align="center">
+          <template #default="{ row }">
+            <el-tag type="info" size="small">{{ row.boundUserCount || 0 }} 人</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column prop="boundUserNames" label="绑定用户" min-width="130">
+          <template #default="{ row }">{{ row.boundUserNames || '-' }}</template>
+        </el-table-column>
+        <el-table-column label="在线状态" width="90" align="center">
+          <template #default="{ row }">
+            <el-tag :type="row.onlineStatus === 1 ? 'success' : 'info'" size="small">
+              {{ row.onlineStatus === 1 ? '在线' : '离线' }}
+            </el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column prop="firmwareVersion" label="固件版本" width="95">
+          <template #default="{ row }">{{ row.firmwareVersion || '-' }}</template>
+        </el-table-column>
+        <el-table-column prop="lastOnlineTime" label="最后在线时间" width="160">
+          <template #default="{ row }">{{ row.lastOnlineTime || '-' }}</template>
+        </el-table-column>
+        <el-table-column label="操作" width="195" align="center" fixed="right">
+          <template #default="{ row }">
+            <el-button size="small" type="primary" link @click="handleView(row)">查看</el-button>
+            <el-button size="small" type="warning" link @click="handleEdit(row)">编辑</el-button>
+            <el-button size="small" type="success" link @click="handleManageUsers(row)">用户管理</el-button>
+            <el-button size="small" type="danger" link @click="handleDelete(row)">删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+
+      <!-- 分页 -->
+      <el-pagination
+        v-model:current-page="pageNum"
+        v-model:page-size="pageSize"
+        :page-sizes="[10, 20, 50]"
+        :total="total"
+        layout="total, sizes, prev, pager, next, jumper"
+        class="pagination"
+        @size-change="loadData"
+        @current-change="loadData"
+      />
+    </el-card>
+
+    <!-- 新增/编辑弹窗 -->
+    <el-dialog
+      v-model="formDialogVisible"
+      :title="formMode === 'add' ? '新增设备' : (formMode === 'view' ? '查看设备' : '编辑设备')"
+      width="580px"
+      destroy-on-close
+    >
+      <el-form
+        :model="deviceForm"
+        :rules="formMode !== 'view' ? deviceRules : {}"
+        ref="deviceFormRef"
+        label-width="100px"
+      >
+        <el-form-item label="设备编号" prop="deviceCode">
+          <el-input
+            v-model="deviceForm.deviceCode"
+            placeholder="请输入设备编号(如:AJY001)"
+            maxlength="50"
+            :disabled="formMode !== 'add'"
+          />
+        </el-form-item>
+        <el-form-item label="设备名称" prop="deviceName">
+          <el-input
+            v-model="deviceForm.deviceName"
+            placeholder="请输入设备名称"
+            maxlength="100"
+            :disabled="formMode === 'view'"
+          />
+        </el-form-item>
+        <el-form-item label="设备型号" prop="deviceModel">
+          <el-select
+            v-model="deviceForm.deviceModel"
+            placeholder="请选择设备型号"
+            style="width:100%"
+            :disabled="formMode === 'view'"
+          >
+            <el-option label="AJY-2026" value="AJY-2026" />
+            <el-option label="AJY-2025" value="AJY-2025" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="设备序列号" prop="serialNo">
+          <el-input
+            v-model="deviceForm.serialNo"
+            placeholder="请输入设备序列号"
+            maxlength="50"
+            :disabled="formMode === 'view'"
+          />
+        </el-form-item>
+        <el-form-item label="固件版本" prop="firmwareVersion">
+          <el-input
+            v-model="deviceForm.firmwareVersion"
+            placeholder="请输入固件版本(如:v1.2.0)"
+            maxlength="20"
+            :disabled="formMode === 'view'"
+          />
+        </el-form-item>
+        <el-form-item label="绑定用户">
+          <el-select
+            v-model="deviceForm.userIds"
+            multiple
+            filterable
+            remote
+            :remote-method="searchUserOptions"
+            :loading="userOptionsLoading"
+            placeholder="可搜索并选择用户(选填)"
+            style="width:100%"
+            :disabled="formMode === 'view'"
+          >
+            <el-option
+              v-for="u in userOptions"
+              :key="u.id"
+              :label="`${u.name}(${u.phone || '-'})`"
+              :value="u.id"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="备注">
+          <el-input
+            v-model="deviceForm.remark"
+            type="textarea"
+            :rows="3"
+            placeholder="请输入备注(选填)"
+            maxlength="200"
+            show-word-limit
+            :disabled="formMode === 'view'"
+          />
+        </el-form-item>
+      </el-form>
+      <template #footer>
+        <el-button @click="formDialogVisible = false">{{ formMode === 'view' ? '关闭' : '取消' }}</el-button>
+        <el-button
+          v-if="formMode !== 'view'"
+          type="primary"
+          :loading="submitLoading"
+          @click="submitForm"
+        >保存</el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import { ref, reactive, onMounted } from 'vue'
+import { useRouter } from 'vue-router'
+import { ElMessage, ElMessageBox } from 'element-plus'
+import { Search, Refresh, Plus, Delete } from '@element-plus/icons-vue'
+import ExcelImport from '@/components/ExcelImport.vue'
+import ExcelExport from '@/components/ExcelExport.vue'
+import {
+  getDevicePageList,
+  addDevice,
+  updateDevice,
+  deleteDevice,
+  batchDeleteDevice,
+  batchImportDevice,
+  getUserProfileOptions,
+  getDeviceUsers
+} from '@/api/device'
+
+const router = useRouter()
+
+// ======================== 列表数据 ========================
+const tableData = ref([])
+const total = ref(0)
+const loading = ref(false)
+const selectedIds = ref([])
+const pageNum = ref(1)
+const pageSize = ref(10)
+
+/** 搜索条件 */
+const query = reactive({
+  deviceCode: '',
+  deviceName: '',
+  boundUserName: '',
+  onlineStatus: null,
+  firmwareVersion: ''
+})
+
+/** 导出表头配置 */
+const exportHeaders = [
+  { label: '设备编号', prop: 'deviceCode' },
+  { label: '设备名称', prop: 'deviceName' },
+  { label: '设备型号', prop: 'deviceModel' },
+  { label: '绑定用户数', prop: 'boundUserCount' },
+  { label: '绑定用户', prop: 'boundUserNames' },
+  { label: '在线状态', prop: 'onlineStatusLabel' },
+  { label: '固件版本', prop: 'firmwareVersion' },
+  { label: '最后在线时间', prop: 'lastOnlineTime' }
+]
+
+/**
+ * 加载设备列表数据
+ */
+async function loadData() {
+  loading.value = true
+  try {
+    const res = await getDevicePageList({
+      ...query,
+      pageNum: pageNum.value,
+      pageSize: pageSize.value
+    })
+    const records = res.data?.records || []
+    // 为导出添加状态标签字段
+    tableData.value = records.map(r => ({
+      ...r,
+      onlineStatusLabel: r.onlineStatus === 1 ? '在线' : '离线'
+    }))
+    total.value = res.data?.total || 0
+  } finally {
+    loading.value = false
+  }
+}
+
+/**
+ * 点击查询
+ */
+function handleSearch() {
+  pageNum.value = 1
+  loadData()
+}
+
+/**
+ * 重置查询条件
+ */
+function handleReset() {
+  Object.assign(query, {
+    deviceCode: '',
+    deviceName: '',
+    boundUserName: '',
+    onlineStatus: null,
+    firmwareVersion: ''
+  })
+  pageNum.value = 1
+  loadData()
+}
+
+/**
+ * 多选变化
+ */
+function handleSelectionChange(selection) {
+  selectedIds.value = selection.map(r => r.id)
+}
+
+// ======================== 新增/编辑表单 ========================
+const formDialogVisible = ref(false)
+const submitLoading = ref(false)
+const deviceFormRef = ref(null)
+const formMode = ref('add') // 'add' | 'edit' | 'view'
+
+const deviceForm = reactive({
+  id: null,
+  deviceCode: '',
+  deviceName: '',
+  deviceModel: '',
+  serialNo: '',
+  firmwareVersion: '',
+  userIds: [],
+  remark: ''
+})
+
+const deviceRules = {
+  deviceCode: [
+    { required: true, message: '请输入设备编号', trigger: 'blur' },
+    { max: 50, message: '设备编号不超过50个字符', trigger: 'blur' }
+  ],
+  deviceName: [
+    { required: true, message: '请输入设备名称', trigger: 'blur' },
+    { max: 100, message: '设备名称不超过100个字符', trigger: 'blur' }
+  ],
+  deviceModel: [{ required: true, message: '请选择设备型号', trigger: 'change' }],
+  serialNo: [
+    { required: true, message: '请输入设备序列号', trigger: 'blur' },
+    { max: 50, message: '序列号不超过50个字符', trigger: 'blur' }
+  ],
+  firmwareVersion: [{ required: true, message: '请输入固件版本', trigger: 'blur' }]
+}
+
+// 用户选项数据(供绑定用户下拉使用)
+const userOptions = ref([])
+const userOptionsLoading = ref(false)
+
+/**
+ * 搜索用户选项
+ * @param {string} keyword 搜索关键字
+ */
+async function searchUserOptions(keyword) {
+  userOptionsLoading.value = true
+  try {
+    const res = await getUserProfileOptions(keyword)
+    userOptions.value = res.data || []
+  } finally {
+    userOptionsLoading.value = false
+  }
+}
+
+/**
+ * 打开新增对话框
+ */
+async function handleAdd() {
+  formMode.value = 'add'
+  Object.assign(deviceForm, {
+    id: null,
+    deviceCode: '',
+    deviceName: '',
+    deviceModel: '',
+    serialNo: '',
+    firmwareVersion: '',
+    userIds: [],
+    remark: ''
+  })
+  // 预加载用户选项
+  await searchUserOptions('')
+  formDialogVisible.value = true
+}
+
+/**
+ * 打开查看对话框
+ * @param {Object} row 设备行数据
+ */
+async function handleView(row) {
+  formMode.value = 'view'
+  // 获取当前绑定用户列表,填充 userOptions 和 userIds 以实现回显
+  const res = await getDeviceUsers(row.id)
+  const boundUsers = res.data || []
+  userOptions.value = boundUsers.map(u => ({ id: u.userId, name: u.userName, phone: u.phone }))
+  Object.assign(deviceForm, {
+    ...row,
+    userIds: boundUsers.map(u => u.userId)
+  })
+  formDialogVisible.value = true
+}
+
+/**
+ * 打开编辑对话框
+ * @param {Object} row 设备行数据
+ */
+async function handleEdit(row) {
+  formMode.value = 'edit'
+  // 加载全量用户选项(供重新选择)
+  await searchUserOptions('')
+  // 获取当前绑定用户列表,回显已选用户
+  const res = await getDeviceUsers(row.id)
+  const boundUsers = res.data || []
+  // 将已绑定用户合并进 userOptions,防止 remote 模式下找不到对应选项
+  boundUsers.forEach(u => {
+    if (!userOptions.value.find(o => o.id === u.userId)) {
+      userOptions.value.push({ id: u.userId, name: u.userName, phone: u.phone })
+    }
+  })
+  Object.assign(deviceForm, {
+    id: row.id,
+    deviceCode: row.deviceCode,
+    deviceName: row.deviceName,
+    deviceModel: row.deviceModel || '',
+    serialNo: row.serialNo || '',
+    firmwareVersion: row.firmwareVersion || '',
+    remark: row.remark || '',
+    userIds: boundUsers.map(u => u.userId)
+  })
+  formDialogVisible.value = true
+}
+
+/**
+ * 提交表单(新增或编辑)
+ */
+async function submitForm() {
+  await deviceFormRef.value.validate()
+  submitLoading.value = true
+  try {
+    const payload = {
+      id: deviceForm.id,
+      deviceCode: deviceForm.deviceCode,
+      deviceName: deviceForm.deviceName,
+      deviceModel: deviceForm.deviceModel,
+      serialNo: deviceForm.serialNo,
+      firmwareVersion: deviceForm.firmwareVersion,
+      remark: deviceForm.remark || undefined,
+      userIds: deviceForm.userIds.length > 0 ? deviceForm.userIds : undefined
+    }
+    if (formMode.value === 'add') {
+      await addDevice(payload)
+      ElMessage.success('新增成功')
+    } else {
+      await updateDevice(payload)
+      ElMessage.success('修改成功')
+    }
+    formDialogVisible.value = false
+    loadData()
+  } finally {
+    submitLoading.value = false
+  }
+}
+
+// ======================== 删除 ========================
+
+/**
+ * 删除单条设备
+ * @param {Object} row 设备行数据
+ */
+async function handleDelete(row) {
+  await ElMessageBox.confirm(
+    `确认删除设备「${row.deviceName}」吗?删除后将同时解绑该设备的所有用户。`,
+    '删除确认',
+    { type: 'warning', confirmButtonText: '确认删除', cancelButtonText: '取消' }
+  )
+  await deleteDevice(row.id)
+  ElMessage.success('删除成功')
+  loadData()
+}
+
+/**
+ * 批量删除设备(需二次确认)
+ */
+async function handleBatchDelete() {
+  await ElMessageBox.confirm(
+    `确认批量删除选中的 ${selectedIds.value.length} 台设备吗?删除后将同时解绑这些设备的所有用户。`,
+    '批量删除确认',
+    { type: 'warning', confirmButtonText: '确认删除', cancelButtonText: '取消' }
+  )
+  await batchDeleteDevice(selectedIds.value)
+  ElMessage.success('批量删除成功')
+  selectedIds.value = []
+  loadData()
+}
+
+// ======================== 导入导出 ========================
+
+/**
+ * 处理 Excel 导入数据
+ * @param {Object[]} data 解析后的数据列表
+ */
+async function handleImport(data) {
+  const list = data.map(row => ({
+    deviceCode: row['设备编号'] || row.deviceCode,
+    deviceName: row['设备名称'] || row.deviceName,
+    deviceModel: row['设备型号'] || row.deviceModel,
+    serialNo: row['设备序列号'] || row.serialNo,
+    firmwareVersion: row['固件版本'] || row.firmwareVersion,
+    remark: row['备注'] || row.remark
+  }))
+  await batchImportDevice(list)
+}
+
+/**
+ * 导入成功回调
+ */
+function onImportSuccess() {
+  ElMessage.success('导入成功')
+  loadData()
+}
+
+// ======================== 用户管理跳转 ========================
+
+/**
+ * 跳转到设备用户管理页面
+ * @param {Object} row 设备行数据
+ */
+function handleManageUsers(row) {
+  router.push({
+    path: '/device/users',
+    query: { deviceId: row.id, deviceCode: row.deviceCode, deviceName: row.deviceName }
+  })
+}
+
+onMounted(loadData)
+</script>
+
+<style lang="scss" scoped>
+.page-container {
+  display: flex;
+  flex-direction: column;
+  gap: 16px;
+}
+
+.search-card {
+  :deep(.el-card__body) {
+    padding: 18px 20px 4px;
+  }
+}
+
+.action-card {
+  :deep(.el-card__body) {
+    padding: 14px 20px;
+  }
+
+  .action-bar {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+
+    .action-left {
+      display: flex;
+      align-items: center;
+      gap: 8px;
+    }
+  }
+}
+
+.table-card {
+  flex: 1;
+}
+
+.pagination {
+  margin-top: 16px;
+  justify-content: flex-end;
+}
+</style>

+ 332 - 0
openspec/frontend/src/views/device/users.vue

@@ -0,0 +1,332 @@
+<template>
+  <div class="page-container">
+    <!-- 页头:设备名称 + 返回按钮 -->
+    <div class="page-header">
+      <el-button :icon="ArrowLeft" @click="goBack">返回设备列表</el-button>
+      <span class="page-title">
+        设备用户管理 —
+        <span class="device-info">{{ deviceName }}({{ deviceCode }})</span>
+      </span>
+    </div>
+
+    <!-- 操作按钮区 -->
+    <el-card class="action-card">
+      <div class="action-bar">
+        <div>
+          <el-button type="primary" :icon="Plus" @click="handleAddUser">添加用户</el-button>
+          <el-button
+            type="danger"
+            :icon="Delete"
+            :disabled="selectedBindIds.length === 0"
+            @click="handleBatchUnbind"
+          >批量解绑</el-button>
+        </div>
+      </div>
+    </el-card>
+
+    <!-- 表格区域 -->
+    <el-card class="table-card">
+      <el-table
+        :data="tableData"
+        v-loading="loading"
+        border
+        stripe
+        @selection-change="handleSelectionChange"
+      >
+        <el-table-column type="selection" width="50" align="center" />
+        <el-table-column type="index" label="序号" width="60" align="center" />
+        <el-table-column prop="userId" label="用户ID" width="80" align="center" />
+        <el-table-column prop="userName" label="用户姓名" min-width="100" />
+        <el-table-column prop="phone" label="手机号" min-width="130">
+          <template #default="{ row }">
+            {{ row.phone ? row.phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') : '-' }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="bindTime" label="绑定时间" width="170" />
+        <el-table-column label="是否主用户" width="100" align="center">
+          <template #default="{ row }">
+            <el-tag :type="row.isPrimary === 1 ? 'warning' : 'info'" size="small">
+              {{ row.isPrimary === 1 ? '是' : '否' }}
+            </el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" width="170" align="center" fixed="right">
+          <template #default="{ row }">
+            <el-button
+              size="small"
+              type="primary"
+              link
+              :disabled="row.isPrimary === 1"
+              @click="handleSetPrimary(row)"
+            >
+              设为主用户
+            </el-button>
+            <el-button
+              size="small"
+              type="danger"
+              link
+              @click="handleUnbind(row)"
+            >
+              解绑
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+    </el-card>
+
+    <!-- 添加用户弹窗 -->
+    <el-dialog v-model="addUserDialogVisible" title="添加绑定用户" width="520px" destroy-on-close>
+      <div class="add-user-tip">从用户档案列表中选择用户与该设备绑定</div>
+      <el-input
+        v-model="addUserKeyword"
+        placeholder="搜索用户姓名或手机号"
+        :prefix-icon="Search"
+        clearable
+        style="margin-bottom: 12px"
+        @input="searchAddUserOptions"
+      />
+      <el-table
+        :data="addUserOptions"
+        v-loading="addUserLoading"
+        border
+        stripe
+        height="300"
+        @selection-change="handleAddUserSelect"
+      >
+        <el-table-column type="selection" width="50" align="center" />
+        <el-table-column prop="id" label="用户ID" width="80" align="center" />
+        <el-table-column prop="name" label="姓名" min-width="100" />
+        <el-table-column prop="phone" label="手机号" min-width="130">
+          <template #default="{ row }">
+            {{ row.phone ? row.phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') : '-' }}
+          </template>
+        </el-table-column>
+      </el-table>
+      <template #footer>
+        <el-button @click="addUserDialogVisible = false">取消</el-button>
+        <el-button
+          type="primary"
+          :loading="addUserSubmitLoading"
+          :disabled="selectedAddUsers.length === 0"
+          @click="submitAddUser"
+        >确认绑定({{ selectedAddUsers.length }} 人)</el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import { ref, computed, onMounted } from 'vue'
+import { useRoute, useRouter } from 'vue-router'
+import { ElMessage, ElMessageBox } from 'element-plus'
+import { ArrowLeft, Plus, Delete, Search } from '@element-plus/icons-vue'
+import {
+  getDeviceUsers,
+  addDeviceUser,
+  removeDeviceUser,
+  setDeviceUserPrimary,
+  batchRemoveDeviceUsers,
+  getUserProfileOptions
+} from '@/api/device'
+
+const route = useRoute()
+const router = useRouter()
+
+// 从路由参数获取设备信息
+const deviceId = computed(() => route.query.deviceId ? Number(route.query.deviceId) : null)
+const deviceCode = computed(() => route.query.deviceCode || '')
+const deviceName = computed(() => route.query.deviceName || '')
+
+// 列表数据
+const tableData = ref([])
+const loading = ref(false)
+const selectedBindIds = ref([])
+
+/**
+ * 加载设备绑定用户列表
+ */
+async function loadData() {
+  if (!deviceId.value) return
+  loading.value = true
+  try {
+    const res = await getDeviceUsers(deviceId.value)
+    tableData.value = res.data || []
+  } finally {
+    loading.value = false
+  }
+}
+
+/**
+ * 多选变化(选择的是 bindId,即 user_device.id)
+ */
+function handleSelectionChange(selection) {
+  selectedBindIds.value = selection.map(r => r.bindId)
+}
+
+/**
+ * 返回设备列表
+ */
+function goBack() {
+  router.push('/device')
+}
+
+// ======================== 解绑 ========================
+
+/**
+ * 解绑单个用户
+ * @param {Object} row 行数据
+ */
+async function handleUnbind(row) {
+  await ElMessageBox.confirm(
+    `确认解绑用户「${row.userName}」吗?`,
+    '解绑确认',
+    { type: 'warning', confirmButtonText: '确认解绑', cancelButtonText: '取消' }
+  )
+  await removeDeviceUser(deviceId.value, row.userId)
+  ElMessage.success('解绑成功')
+  loadData()
+}
+
+/**
+ * 批量解绑用户(需二次确认)
+ */
+async function handleBatchUnbind() {
+  await ElMessageBox.confirm(
+    `确认批量解绑选中的 ${selectedBindIds.value.length} 位用户吗?`,
+    '批量解绑确认',
+    { type: 'warning', confirmButtonText: '确认解绑', cancelButtonText: '取消' }
+  )
+  await batchRemoveDeviceUsers(deviceId.value, selectedBindIds.value)
+  ElMessage.success('批量解绑成功')
+  selectedBindIds.value = []
+  loadData()
+}
+
+// ======================== 设为主用户 ========================
+
+/**
+ * 设置主用户
+ * @param {Object} row 行数据
+ */
+async function handleSetPrimary(row) {
+  await ElMessageBox.confirm(
+    `确认将「${row.userName}」设为该设备的主用户吗?`,
+    '设置主用户',
+    { type: 'warning', confirmButtonText: '确认', cancelButtonText: '取消' }
+  )
+  await setDeviceUserPrimary(deviceId.value, row.userId)
+  ElMessage.success('设置成功')
+  loadData()
+}
+
+// ======================== 添加用户 ========================
+const addUserDialogVisible = ref(false)
+const addUserKeyword = ref('')
+const addUserOptions = ref([])
+const addUserLoading = ref(false)
+const selectedAddUsers = ref([])
+const addUserSubmitLoading = ref(false)
+
+/**
+ * 搜索可添加的用户选项
+ */
+async function searchAddUserOptions() {
+  addUserLoading.value = true
+  try {
+    const res = await getUserProfileOptions(addUserKeyword.value)
+    addUserOptions.value = res.data || []
+  } finally {
+    addUserLoading.value = false
+  }
+}
+
+/**
+ * 打开添加用户对话框
+ */
+async function handleAddUser() {
+  addUserKeyword.value = ''
+  selectedAddUsers.value = []
+  addUserDialogVisible.value = true
+  await searchAddUserOptions()
+}
+
+/**
+ * 表格选择变化
+ */
+function handleAddUserSelect(selection) {
+  selectedAddUsers.value = selection
+}
+
+/**
+ * 提交绑定用户
+ */
+async function submitAddUser() {
+  addUserSubmitLoading.value = true
+  try {
+    // 逐个绑定,跳过已绑定的用户
+    let successCount = 0
+    for (const user of selectedAddUsers.value) {
+      try {
+        await addDeviceUser(deviceId.value, user.id)
+        successCount++
+      } catch (e) {
+        // 跳过已绑定的情况
+      }
+    }
+    ElMessage.success(`成功绑定 ${successCount} 位用户`)
+    addUserDialogVisible.value = false
+    loadData()
+  } finally {
+    addUserSubmitLoading.value = false
+  }
+}
+
+onMounted(loadData)
+</script>
+
+<style lang="scss" scoped>
+.page-container {
+  display: flex;
+  flex-direction: column;
+  gap: 16px;
+}
+
+.page-header {
+  display: flex;
+  align-items: center;
+  gap: 16px;
+  padding: 4px 0;
+
+  .page-title {
+    font-size: 16px;
+    font-weight: 600;
+    color: #303133;
+
+    .device-info {
+      color: #409eff;
+    }
+  }
+}
+
+.action-card {
+  :deep(.el-card__body) {
+    padding: 14px 20px;
+  }
+
+  .action-bar {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+  }
+}
+
+.table-card {
+  flex: 1;
+}
+
+.add-user-tip {
+  color: #909399;
+  font-size: 13px;
+  margin-bottom: 12px;
+}
+</style>

+ 1 - 1
openspec/frontend/src/views/login/index.vue

@@ -6,7 +6,7 @@
         <div class="login-logo">
           <span class="logo-icon">医</span>
         </div>
-        <h1 class="login-title">爱久医管理后台</h1>
+        <h1 class="login-title">艾灸椅管理后台</h1>
         <p class="login-subtitle">欢迎回来,请登录您的账号</p>
       </div>
 

+ 514 - 0
openspec/frontend/src/views/moxibustion/index.vue

@@ -0,0 +1,514 @@
+<template>
+  <div class="page-container">
+    <!-- 搜索区域 -->
+    <el-card class="search-card">
+      <el-form :model="queryForm" inline>
+        <el-form-item label="手法名称">
+          <el-input v-model="queryForm.name" placeholder="请输入手法名称" clearable style="width:180px" />
+        </el-form-item>
+        <el-form-item label="运动模式">
+          <el-select v-model="queryForm.motionMode" placeholder="全部" clearable style="width:140px">
+            <el-option label="默认工艺" value="default" />
+            <el-option label="固定不动" value="fixed" />
+            <el-option label="上下移动" value="updown" />
+            <el-option label="圆周运动" value="circular" />
+            <el-option label="点状移动" value="dotted" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="状态">
+          <el-select v-model="queryForm.status" placeholder="全部" clearable style="width:110px">
+            <el-option label="启用" :value="1" />
+            <el-option label="禁用" :value="0" />
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" :icon="Search" @click="handleSearch">查询</el-button>
+          <el-button :icon="Refresh" @click="handleReset">重置</el-button>
+        </el-form-item>
+      </el-form>
+    </el-card>
+
+    <!-- 表格区域 -->
+    <el-card class="table-card">
+      <template #header>
+        <div class="card-header">
+          <span class="title">艾灸手法列表</span>
+          <div class="btn-group">
+            <el-button type="primary" :icon="Plus" @click="handleAdd">新增</el-button>
+            <el-button
+              type="danger"
+              :icon="Delete"
+              :disabled="selectedIds.length === 0"
+              @click="handleBatchDelete"
+            >批量删除</el-button>
+          </div>
+        </div>
+      </template>
+
+      <el-table
+        :data="tableData"
+        v-loading="loading"
+        border
+        stripe
+        @selection-change="handleSelectionChange"
+      >
+        <el-table-column type="selection" width="50" align="center" />
+        <el-table-column type="index" label="序号" width="60" align="center" />
+        <el-table-column prop="techniqueCode" label="手法编码" width="120" />
+        <el-table-column prop="name" label="手法名称" min-width="150" />
+        <el-table-column label="运动模式" width="110" align="center">
+          <template #default="{ row }">
+            {{ MOTION_MODE_MAP[row.motionMode] || row.motionMode }}
+          </template>
+        </el-table-column>
+        <el-table-column label="温度范围" width="130" align="center">
+          <template #default="{ row }">
+            {{ row.tempMin }}~{{ row.tempMax }}°C
+          </template>
+        </el-table-column>
+        <el-table-column label="时间范围" width="120" align="center">
+          <template #default="{ row }">
+            {{ row.timeMin === row.timeMax ? row.timeMin + '分钟' : row.timeMin + '~' + row.timeMax + '分钟' }}
+          </template>
+        </el-table-column>
+        <el-table-column label="运动幅度" width="100" align="center">
+          <template #default="{ row }">
+            {{ row.motionAmplitude != null ? row.motionAmplitude + 'mm' : '-' }}
+          </template>
+        </el-table-column>
+        <el-table-column label="运动速度" width="110" align="center">
+          <template #default="{ row }">
+            {{ row.motionSpeed != null ? row.motionSpeed + 'mm/s' : '-' }}
+          </template>
+        </el-table-column>
+        <el-table-column label="状态" width="90" align="center">
+          <template #default="{ row }">
+            <el-tag :type="row.status === 1 ? 'success' : 'danger'" size="small">
+              {{ row.status === 1 ? '启用' : '禁用' }}
+            </el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" width="180" align="center" fixed="right">
+          <template #default="{ row }">
+            <el-button size="small" type="primary" link @click="handleView(row)">查看</el-button>
+            <el-button size="small" type="warning" link @click="handleEdit(row)">编辑</el-button>
+            <el-button size="small" type="danger" link @click="handleDelete(row)">删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+
+      <!-- 分页 -->
+      <el-pagination
+        v-model:current-page="queryForm.pageNum"
+        v-model:page-size="queryForm.pageSize"
+        :page-sizes="[10, 20, 50]"
+        :total="total"
+        layout="total, sizes, prev, pager, next, jumper"
+        class="pagination"
+        @size-change="loadData"
+        @current-change="loadData"
+      />
+    </el-card>
+
+    <!-- 新增/编辑/查看弹窗 -->
+    <el-dialog
+      v-model="dialogVisible"
+      :title="dialogTitle"
+      width="640px"
+      destroy-on-close
+      :close-on-click-modal="false"
+    >
+      <el-form
+        :model="formData"
+        :rules="formRules"
+        ref="formRef"
+        label-width="130px"
+        :disabled="dialogMode === 'view'"
+      >
+        <el-form-item label="手法名称" prop="name">
+          <el-input v-model="formData.name" placeholder="请输入手法名称" maxlength="50" show-word-limit />
+        </el-form-item>
+        <el-form-item label="运动模式" prop="motionMode">
+          <el-select v-model="formData.motionMode" placeholder="请选择运动模式" style="width:100%">
+            <el-option label="默认工艺" value="default" />
+            <el-option label="固定不动" value="fixed" />
+            <el-option label="上下移动" value="updown" />
+            <el-option label="圆周运动" value="circular" />
+            <el-option label="点状移动" value="dotted" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="温度最小值(°C)" prop="tempMin">
+          <el-input-number
+            v-model="formData.tempMin"
+            :min="35"
+            :max="50"
+            :precision="1"
+            :step="0.5"
+            style="width:100%"
+            placeholder="35-50°C"
+          />
+        </el-form-item>
+        <el-form-item label="温度最大值(°C)" prop="tempMax">
+          <el-input-number
+            v-model="formData.tempMax"
+            :min="35"
+            :max="50"
+            :precision="1"
+            :step="0.5"
+            style="width:100%"
+            placeholder="35-50°C,需≥最小值"
+          />
+        </el-form-item>
+        <el-form-item label="时间最小值(分钟)" prop="timeMin">
+          <el-input-number
+            v-model="formData.timeMin"
+            :min="1"
+            :max="30"
+            :precision="0"
+            style="width:100%"
+            placeholder="1-30分钟"
+          />
+        </el-form-item>
+        <el-form-item label="时间最大值(分钟)" prop="timeMax">
+          <el-input-number
+            v-model="formData.timeMax"
+            :min="1"
+            :max="30"
+            :precision="0"
+            style="width:100%"
+            placeholder="1-30分钟,需≥最小值"
+          />
+        </el-form-item>
+
+        <!-- 运动模式非固定不动时显示幅度和速度 -->
+        <template v-if="formData.motionMode && formData.motionMode !== 'fixed' && formData.motionMode !== 'default'">
+          <el-form-item label="运动幅度(mm)" prop="motionAmplitude">
+            <el-input-number
+              v-model="formData.motionAmplitude"
+              :min="1"
+              :max="20"
+              :precision="1"
+              :step="1"
+              style="width:100%"
+              placeholder="1-20mm"
+            />
+          </el-form-item>
+          <el-form-item label="运动速度(mm/s)" prop="motionSpeed">
+            <el-input-number
+              v-model="formData.motionSpeed"
+              :min="1"
+              :max="10"
+              :precision="1"
+              :step="0.5"
+              style="width:100%"
+              placeholder="1-10mm/s"
+            />
+          </el-form-item>
+        </template>
+
+        <el-form-item label="状态" prop="status">
+          <el-radio-group v-model="formData.status">
+            <el-radio :label="1">启用</el-radio>
+            <el-radio :label="0">禁用</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="备注" prop="remark">
+          <el-input
+            v-model="formData.remark"
+            type="textarea"
+            :rows="3"
+            maxlength="200"
+            show-word-limit
+            placeholder="选填,最长200字符"
+          />
+        </el-form-item>
+      </el-form>
+      <template #footer>
+        <el-button @click="dialogVisible = false">{{ dialogMode === 'view' ? '关闭' : '取消' }}</el-button>
+        <el-button v-if="dialogMode !== 'view'" type="primary" :loading="submitLoading" @click="handleSubmit">保存</el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import { ref, reactive, onMounted } from 'vue'
+import { ElMessage, ElMessageBox } from 'element-plus'
+import { Search, Refresh, Plus, Delete } from '@element-plus/icons-vue'
+import {
+  getTechniquePage,
+  addTechnique,
+  updateTechnique,
+  deleteTechnique,
+  batchDeleteTechnique
+} from '@/api/moxibustion'
+
+/** 运动模式中文映射 */
+const MOTION_MODE_MAP = {
+  default: '默认工艺',
+  fixed: '固定不动',
+  updown: '上下移动',
+  circular: '圆周运动',
+  dotted: '点状移动'
+}
+
+// 查询表单
+const queryForm = reactive({
+  name: '',
+  motionMode: '',
+  status: null,
+  pageNum: 1,
+  pageSize: 10
+})
+
+const tableData = ref([])
+const total = ref(0)
+const loading = ref(false)
+const selectedIds = ref([])
+
+// 弹窗
+const dialogVisible = ref(false)
+const dialogTitle = ref('')
+const dialogMode = ref('add') // add | edit | view
+const submitLoading = ref(false)
+const formRef = ref(null)
+
+/**
+ * 默认表单数据
+ */
+const defaultForm = () => ({
+  id: null,
+  techniqueCode: '',
+  name: '',
+  motionMode: 'fixed',
+  tempMin: 35,
+  tempMax: 50,
+  timeMin: 1,
+  timeMax: 30,
+  motionAmplitude: null,
+  motionSpeed: null,
+  status: 1,
+  remark: ''
+})
+
+const formData = reactive(defaultForm())
+
+// 表单校验规则
+const formRules = {
+  name: [
+    { required: true, message: '请输入手法名称', trigger: 'blur' },
+    { max: 50, message: '手法名称最长50字符', trigger: 'blur' }
+  ],
+  motionMode: [{ required: true, message: '请选择运动模式', trigger: 'change' }],
+  tempMin: [{ required: true, message: '请输入温度最小值', trigger: 'blur' }],
+  tempMax: [
+    { required: true, message: '请输入温度最大值', trigger: 'blur' },
+    {
+      validator: (rule, value, callback) => {
+        if (value != null && formData.tempMin != null && value < formData.tempMin) {
+          callback(new Error('温度最大值不能小于最小值'))
+        } else {
+          callback()
+        }
+      },
+      trigger: 'blur'
+    }
+  ],
+  timeMin: [{ required: true, message: '请输入时间最小值', trigger: 'blur' }],
+  timeMax: [
+    { required: true, message: '请输入时间最大值', trigger: 'blur' },
+    {
+      validator: (rule, value, callback) => {
+        if (value != null && formData.timeMin != null && value < formData.timeMin) {
+          callback(new Error('时间最大值不能小于最小值'))
+        } else {
+          callback()
+        }
+      },
+      trigger: 'blur'
+    }
+  ],
+  motionAmplitude: [
+    {
+      validator: (rule, value, callback) => {
+        const needsMotion = formData.motionMode && formData.motionMode !== 'fixed' && formData.motionMode !== 'default'
+        if (needsMotion && (value === null || value === undefined)) {
+          callback(new Error('运动模式下运动幅度必填'))
+        } else {
+          callback()
+        }
+      },
+      trigger: 'blur'
+    }
+  ],
+  motionSpeed: [
+    {
+      validator: (rule, value, callback) => {
+        const needsMotion = formData.motionMode && formData.motionMode !== 'fixed' && formData.motionMode !== 'default'
+        if (needsMotion && (value === null || value === undefined)) {
+          callback(new Error('运动模式下运动速度必填'))
+        } else {
+          callback()
+        }
+      },
+      trigger: 'blur'
+    }
+  ],
+  status: [{ required: true, message: '请选择状态', trigger: 'change' }]
+}
+
+/**
+ * 加载艾灸手法列表
+ */
+async function loadData() {
+  loading.value = true
+  try {
+    const res = await getTechniquePage(queryForm)
+    tableData.value = res.data?.records || []
+    total.value = res.data?.total || 0
+  } finally {
+    loading.value = false
+  }
+}
+
+/**
+ * 查询
+ */
+function handleSearch() {
+  queryForm.pageNum = 1
+  loadData()
+}
+
+/**
+ * 重置查询条件
+ */
+function handleReset() {
+  queryForm.name = ''
+  queryForm.motionMode = ''
+  queryForm.status = null
+  queryForm.pageNum = 1
+  loadData()
+}
+
+/**
+ * 多选变化
+ */
+function handleSelectionChange(selection) {
+  selectedIds.value = selection.map(r => r.id)
+}
+
+/**
+ * 打开新增弹窗
+ */
+function handleAdd() {
+  Object.assign(formData, defaultForm())
+  dialogTitle.value = '新增艾灸手法'
+  dialogMode.value = 'add'
+  dialogVisible.value = true
+}
+
+/**
+ * 打开查看弹窗
+ */
+function handleView(row) {
+  Object.assign(formData, defaultForm(), { ...row })
+  dialogTitle.value = '查看艾灸手法'
+  dialogMode.value = 'view'
+  dialogVisible.value = true
+}
+
+/**
+ * 打开编辑弹窗
+ */
+function handleEdit(row) {
+  Object.assign(formData, defaultForm(), { ...row })
+  dialogTitle.value = '编辑艾灸手法'
+  dialogMode.value = 'edit'
+  dialogVisible.value = true
+}
+
+/**
+ * 提交保存(新增或编辑)
+ */
+async function handleSubmit() {
+  await formRef.value.validate()
+  submitLoading.value = true
+  try {
+    if (formData.id) {
+      await updateTechnique({ ...formData })
+    } else {
+      await addTechnique({ ...formData })
+    }
+    ElMessage.success('操作成功')
+    dialogVisible.value = false
+    loadData()
+  } finally {
+    submitLoading.value = false
+  }
+}
+
+/**
+ * 删除单条手法(二次确认)
+ */
+async function handleDelete(row) {
+  await ElMessageBox.confirm(`确认删除手法「${row.name}」吗?`, '提示', { type: 'warning' })
+  await deleteTechnique(row.id)
+  ElMessage.success('删除成功')
+  loadData()
+}
+
+/**
+ * 批量删除手法(二次确认)
+ */
+async function handleBatchDelete() {
+  await ElMessageBox.confirm(
+    `确认批量删除选中的 ${selectedIds.value.length} 条手法吗?`,
+    '批量删除确认',
+    { type: 'warning', confirmButtonText: '确认删除', cancelButtonText: '取消' }
+  )
+  await batchDeleteTechnique(selectedIds.value)
+  ElMessage.success('批量删除成功')
+  selectedIds.value = []
+  loadData()
+}
+
+onMounted(loadData)
+</script>
+
+<style lang="scss" scoped>
+.page-container {
+  display: flex;
+  flex-direction: column;
+  gap: 16px;
+}
+
+.search-card {
+  :deep(.el-card__body) {
+    padding: 16px 20px 4px;
+  }
+}
+
+.table-card {
+  .card-header {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+
+    .title {
+      font-weight: 600;
+      font-size: 15px;
+    }
+
+    .btn-group {
+      display: flex;
+      gap: 8px;
+      align-items: center;
+    }
+  }
+}
+
+.pagination {
+  margin-top: 16px;
+  justify-content: flex-end;
+}
+</style>

+ 686 - 0
openspec/frontend/src/views/plan/index.vue

@@ -0,0 +1,686 @@
+<template>
+  <div class="page-container">
+    <!-- 搜索区域 -->
+    <el-card class="search-card">
+      <el-form :model="queryForm" inline>
+        <el-form-item label="方案名称">
+          <el-input v-model="queryForm.name" placeholder="请输入方案名称" clearable style="width:180px" />
+        </el-form-item>
+        <el-form-item label="模式类型">
+          <el-select v-model="queryForm.modeType" placeholder="全部" clearable style="width:130px">
+            <el-option label="一键艾灸" :value="1" />
+            <el-option label="专业模式" :value="2" />
+            <el-option label="自定义模式" :value="3" />
+            <el-option label="延年圣手" :value="4" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="功效类型">
+          <el-select v-model="queryForm.effectType" placeholder="全部" clearable style="width:110px">
+            <el-option v-for="e in effectOptions" :key="e" :label="e" :value="e" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="创作人">
+          <el-input v-model="queryForm.authorName" placeholder="请输入创作人" clearable style="width:150px" />
+        </el-form-item>
+        <el-form-item label="状态">
+          <el-select v-model="queryForm.status" placeholder="全部" clearable style="width:110px">
+            <el-option label="草稿" :value="0" />
+            <el-option label="已发布" :value="1" />
+            <el-option label="已下架" :value="2" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="创建时间">
+          <el-date-picker
+            v-model="dateRange"
+            type="daterange"
+            range-separator="~"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            value-format="YYYY-MM-DD"
+            style="width:220px"
+          />
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" :icon="Search" @click="handleSearch">查询</el-button>
+          <el-button :icon="Refresh" @click="handleReset">重置</el-button>
+        </el-form-item>
+      </el-form>
+    </el-card>
+
+    <!-- 表格区域 -->
+    <el-card class="table-card">
+      <template #header>
+        <div class="card-header">
+          <span class="title">方案列表</span>
+          <div class="btn-group">
+            <el-button type="primary" :icon="Plus" @click="handleAdd">新增</el-button>
+            <el-button
+              type="success"
+              :disabled="selectedIds.length === 0"
+              @click="handleBatchPublish"
+            >批量发布</el-button>
+            <el-button
+              type="warning"
+              :disabled="selectedIds.length === 0"
+              @click="handleBatchOffshelf"
+            >批量下架</el-button>
+            <el-button
+              type="danger"
+              :icon="Delete"
+              :disabled="selectedIds.length === 0"
+              @click="handleBatchDelete"
+            >批量删除</el-button>
+          </div>
+        </div>
+      </template>
+
+      <el-table
+        :data="tableData"
+        v-loading="loading"
+        border
+        stripe
+        @selection-change="handleSelectionChange"
+      >
+        <el-table-column type="selection" width="50" align="center" />
+        <el-table-column type="index" label="序号" width="60" align="center" />
+        <el-table-column prop="planCode" label="方案ID" width="100" />
+        <el-table-column prop="name" label="方案名称" min-width="140" show-overflow-tooltip />
+        <el-table-column label="模式类型" width="110" align="center">
+          <template #default="{ row }">
+            <el-tag :type="modeTypeTag(row.modeType)" size="small">{{ modeTypeLabel(row.modeType) }}</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column prop="effectType" label="功效类型" width="90" align="center">
+          <template #default="{ row }">{{ row.effectType || '-' }}</template>
+        </el-table-column>
+        <el-table-column prop="authorName" label="创作人" width="100">
+          <template #default="{ row }">{{ row.authorName || 'ADMIN' }}</template>
+        </el-table-column>
+        <el-table-column label="状态" width="90" align="center">
+          <template #default="{ row }">
+            <el-tag :type="statusTag(row.status)" size="small">{{ statusLabel(row.status) }}</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column prop="createTime" label="创建时间" width="160">
+          <template #default="{ row }">{{ row.createTime?.substring(0, 10) || '-' }}</template>
+        </el-table-column>
+        <el-table-column label="操作" width="220" align="center" fixed="right">
+          <template #default="{ row }">
+            <el-button size="small" type="primary" link @click="handleView(row)">查看</el-button>
+            <el-button size="small" type="warning" link @click="handleEdit(row)">编辑</el-button>
+            <el-button v-if="row.status === 0 || row.status === 2" size="small" type="success" link @click="handlePublish(row)">发布</el-button>
+            <el-button v-if="row.status === 1" size="small" type="info" link @click="handleOffshelf(row)">下架</el-button>
+            <el-button v-if="row.status === 0" size="small" type="danger" link @click="handleDelete(row)">删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+
+      <!-- 分页 -->
+      <el-pagination
+        v-model:current-page="queryForm.pageNum"
+        v-model:page-size="queryForm.pageSize"
+        :page-sizes="[10, 20, 50]"
+        :total="total"
+        layout="total, sizes, prev, pager, next, jumper"
+        class="pagination"
+        @size-change="loadData"
+        @current-change="loadData"
+      />
+    </el-card>
+
+    <!-- 新增/编辑弹窗 -->
+    <el-dialog
+      v-model="dialogVisible"
+      :title="dialogTitle"
+      width="780px"
+      destroy-on-close
+      :close-on-click-modal="false"
+    >
+      <el-form
+        :model="formData"
+        :rules="formRules"
+        ref="formRef"
+        label-width="110px"
+        :disabled="dialogMode === 'view'"
+      >
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="方案名称" prop="name">
+              <el-input v-model="formData.name" placeholder="请输入方案名称" maxlength="100" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="模式类型" prop="modeType">
+              <el-select v-model="formData.modeType" placeholder="请选择模式类型" style="width:100%">
+                <el-option label="一键艾灸" :value="1" />
+                <el-option label="专业模式" :value="2" />
+                <el-option label="自定义模式" :value="3" />
+                <el-option label="延年圣手" :value="4" />
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="功效类型" prop="effectType">
+              <el-select v-model="formData.effectType" placeholder="请选择功效" clearable style="width:100%">
+                <el-option v-for="e in effectOptions" :key="e" :label="e" :value="e" />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="适用人群" prop="applicableGender">
+              <el-radio-group v-model="formData.applicableGender">
+                <el-radio :label="0">不限</el-radio>
+                <el-radio :label="1">仅男</el-radio>
+                <el-radio :label="2">仅女</el-radio>
+              </el-radio-group>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="适用年龄" prop="ageMin">
+              <el-input-number v-model="formData.ageMin" :min="1" :max="119" style="width:90px" /> 岁 ~
+              <el-input-number v-model="formData.ageMax" :min="2" :max="120" style="width:90px" /> 岁
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="创作人" prop="authorName">
+              <el-input v-model="formData.authorName" placeholder="默认 ADMIN" maxlength="100" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-form-item label="适用症状" prop="symptomsList">
+          <el-checkbox-group v-model="formData.symptomsList">
+            <el-checkbox v-for="s in symptomsOptions" :key="s" :label="s" />
+          </el-checkbox-group>
+        </el-form-item>
+        <el-form-item label="方案描述">
+          <el-input v-model="formData.description" type="textarea" :rows="2" maxlength="200" show-word-limit />
+        </el-form-item>
+
+        <!-- 治疗步骤 -->
+        <el-divider>治疗步骤</el-divider>
+        <div v-for="(step, index) in formData.steps" :key="index" class="step-row">
+          <div class="step-header">
+            <span class="step-num">步骤 {{ index + 1 }}</span>
+            <el-button
+              v-if="dialogMode !== 'view'"
+              size="small"
+              type="danger"
+              link
+              :disabled="formData.steps.length <= 1"
+              @click="removeStep(index)"
+            >删除</el-button>
+          </div>
+          <el-row :gutter="12">
+            <el-col :span="8">
+              <el-form-item :label="'穴位'" :prop="`steps.${index}.acupointName`" :rules="stepRules.acupointName">
+                <el-input v-model="step.acupointName" placeholder="穴位名称" />
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item :label="'侧别'" :prop="`steps.${index}.side`" :rules="stepRules.side">
+                <el-select v-model="step.side" placeholder="侧别" style="width:100%">
+                  <el-option label="中心" :value="1" />
+                  <el-option label="左侧" :value="2" />
+                  <el-option label="右侧" :value="3" />
+                  <el-option label="双侧" :value="4" />
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item :label="'手法'" :prop="`steps.${index}.techniqueName`" :rules="stepRules.techniqueName">
+                <el-input v-model="step.techniqueName" placeholder="艾灸手法" />
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row :gutter="12">
+            <el-col :span="8">
+              <el-form-item :label="'温度(°C)'" :prop="`steps.${index}.temperature`" :rules="stepRules.temperature">
+                <el-input-number v-model="step.temperature" :min="35" :max="50" :precision="1" style="width:100%" />
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item :label="'时间(分)'" :prop="`steps.${index}.duration`" :rules="stepRules.duration">
+                <el-input-number v-model="step.duration" :min="1" :max="30" style="width:100%" />
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="备注">
+                <el-input v-model="step.remark" placeholder="备注(选填)" maxlength="100" />
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </div>
+        <el-button
+          v-if="dialogMode !== 'view'"
+          type="primary"
+          plain
+          size="small"
+          @click="addStep"
+          style="margin-top:4px"
+        >+ 添加步骤</el-button>
+      </el-form>
+
+      <template #footer>
+        <el-button @click="dialogVisible = false">{{ dialogMode === 'view' ? '关闭' : '取消' }}</el-button>
+        <template v-if="dialogMode !== 'view'">
+          <el-button :loading="submitLoading" @click="handleSubmit(0)">保存为草稿</el-button>
+          <el-button type="primary" :loading="submitLoading" @click="handleSubmit(1)">发布方案</el-button>
+        </template>
+      </template>
+    </el-dialog>
+
+    <!-- 方案详情弹窗(只读) -->
+    <el-dialog v-model="detailVisible" title="方案详情" width="700px" destroy-on-close>
+      <template v-if="detailData">
+        <el-descriptions :column="2" border size="small">
+          <el-descriptions-item label="方案编码">{{ detailData.planCode }}</el-descriptions-item>
+          <el-descriptions-item label="方案名称">{{ detailData.name }}</el-descriptions-item>
+          <el-descriptions-item label="模式类型">{{ modeTypeLabel(detailData.modeType) }}</el-descriptions-item>
+          <el-descriptions-item label="功效类型">{{ detailData.effectType || '-' }}</el-descriptions-item>
+          <el-descriptions-item label="创作人">{{ detailData.authorName || 'ADMIN' }}</el-descriptions-item>
+          <el-descriptions-item label="状态">{{ statusLabel(detailData.status) }}</el-descriptions-item>
+          <el-descriptions-item label="适用人群">{{ ['不限', '仅男', '仅女'][detailData.applicableGender] || '-' }}</el-descriptions-item>
+          <el-descriptions-item label="适用年龄">{{ detailData.ageMin }}-{{ detailData.ageMax }}岁</el-descriptions-item>
+          <el-descriptions-item label="适用症状" :span="2">{{ detailData.symptoms || '-' }}</el-descriptions-item>
+          <el-descriptions-item label="方案描述" :span="2">{{ detailData.description || '-' }}</el-descriptions-item>
+          <el-descriptions-item label="使用人数">{{ detailData.useCount || 0 }}人</el-descriptions-item>
+          <el-descriptions-item label="平均评分">{{ detailData.avgRating ?? '-' }}分</el-descriptions-item>
+          <el-descriptions-item label="创建时间">{{ detailData.createTime || '-' }}</el-descriptions-item>
+          <el-descriptions-item label="更新时间">{{ detailData.updateTime || '-' }}</el-descriptions-item>
+        </el-descriptions>
+
+        <el-divider>治疗步骤</el-divider>
+        <el-table :data="detailData.steps || []" border size="small">
+          <el-table-column prop="stepOrder" label="步骤" width="60" align="center" />
+          <el-table-column prop="acupointName" label="穴位" width="100" />
+          <el-table-column label="侧别" width="80" align="center">
+            <template #default="{ row }">{{ ['', '中心', '左侧', '右侧', '双侧'][row.side] || '-' }}</template>
+          </el-table-column>
+          <el-table-column prop="temperature" label="温度(°C)" width="90" align="center" />
+          <el-table-column prop="duration" label="时间(分)" width="90" align="center" />
+          <el-table-column prop="techniqueName" label="艾灸手法" width="100" />
+          <el-table-column prop="remark" label="备注" min-width="100">
+            <template #default="{ row }">{{ row.remark || '-' }}</template>
+          </el-table-column>
+        </el-table>
+      </template>
+      <template #footer>
+        <el-button @click="detailVisible = false">关闭</el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import { ref, reactive, onMounted } from 'vue'
+import { ElMessage, ElMessageBox } from 'element-plus'
+import { Search, Refresh, Plus, Delete } from '@element-plus/icons-vue'
+import {
+  getPlanPage,
+  getPlanDetail,
+  addPlan,
+  updatePlan,
+  deletePlan,
+  batchDeletePlan,
+  publishPlan,
+  batchPublishPlan,
+  offshelfPlan,
+  batchOffshelfPlan
+} from '@/api/plan'
+
+// ============ 枚举常量 ============
+const effectOptions = ['驱寒', '祛湿', '祛风', '化瘀', '活血', '化痰', '养颜', '扶阳']
+const symptomsOptions = ['怕冷', '感冒', '咳嗽', '痰多', '疼痛', '腰酸', '失眠', '疲劳', '皮肤暗沉', '手脚冰凉', '其他']
+
+/**
+ * 模式类型标签文字
+ */
+function modeTypeLabel(val) {
+  return ['', '一键艾灸', '专业模式', '自定义模式', '延年圣手'][val] || '-'
+}
+
+/**
+ * 模式类型 Tag 颜色
+ */
+function modeTypeTag(val) {
+  return ['', '', 'success', 'warning', 'danger'][val] || ''
+}
+
+/**
+ * 状态标签文字
+ */
+function statusLabel(val) {
+  return { 0: '草稿', 1: '已发布', 2: '已下架' }[val] ?? '-'
+}
+
+/**
+ * 状态 Tag 颜色
+ */
+function statusTag(val) {
+  return { 0: 'info', 1: 'success', 2: 'warning' }[val] ?? ''
+}
+
+// ============ 查询 ============
+const queryForm = reactive({
+  name: '',
+  modeType: null,
+  effectType: '',
+  authorName: '',
+  status: null,
+  createTimeStart: '',
+  createTimeEnd: '',
+  pageNum: 1,
+  pageSize: 10
+})
+const dateRange = ref([])
+const tableData = ref([])
+const total = ref(0)
+const loading = ref(false)
+const selectedIds = ref([])
+
+/**
+ * 加载方案列表
+ */
+async function loadData() {
+  loading.value = true
+  // 同步日期范围
+  queryForm.createTimeStart = dateRange.value?.[0] || ''
+  queryForm.createTimeEnd = dateRange.value?.[1] || ''
+  try {
+    const res = await getPlanPage(queryForm)
+    tableData.value = res.data?.records || []
+    total.value = res.data?.total || 0
+  } finally {
+    loading.value = false
+  }
+}
+
+/**
+ * 查询
+ */
+function handleSearch() {
+  queryForm.pageNum = 1
+  loadData()
+}
+
+/**
+ * 重置查询条件
+ */
+function handleReset() {
+  queryForm.name = ''
+  queryForm.modeType = null
+  queryForm.effectType = ''
+  queryForm.authorName = ''
+  queryForm.status = null
+  queryForm.createTimeStart = ''
+  queryForm.createTimeEnd = ''
+  queryForm.pageNum = 1
+  dateRange.value = []
+  loadData()
+}
+
+/**
+ * 多选变化
+ */
+function handleSelectionChange(selection) {
+  selectedIds.value = selection.map(r => r.id)
+}
+
+// ============ 新增/编辑弹窗 ============
+const dialogVisible = ref(false)
+const dialogTitle = ref('')
+const dialogMode = ref('add')
+const submitLoading = ref(false)
+const formRef = ref(null)
+
+const defaultStep = () => ({
+  acupointName: '',
+  side: 1,
+  temperature: 42,
+  duration: 5,
+  techniqueName: '',
+  remark: ''
+})
+
+const defaultForm = () => ({
+  id: null,
+  name: '',
+  modeType: 1,
+  effectType: '',
+  symptomsList: [],
+  symptoms: '',
+  applicableGender: 0,
+  ageMin: 1,
+  ageMax: 120,
+  authorName: 'ADMIN',
+  authorType: 1,
+  description: '',
+  steps: [defaultStep()]
+})
+
+const formData = reactive(defaultForm())
+
+const formRules = {
+  name: [{ required: true, message: '请输入方案名称', trigger: 'blur' }],
+  modeType: [{ required: true, message: '请选择模式类型', trigger: 'change' }]
+}
+
+const stepRules = {
+  acupointName: [{ required: true, message: '请填写穴位名称', trigger: 'blur' }],
+  side: [{ required: true, message: '请选择侧别', trigger: 'change' }],
+  temperature: [{ required: true, message: '请填写温度', trigger: 'blur' }],
+  duration: [{ required: true, message: '请填写时间', trigger: 'blur' }],
+  techniqueName: [{ required: true, message: '请填写艾灸手法', trigger: 'blur' }]
+}
+
+/**
+ * 添加一个治疗步骤
+ */
+function addStep() {
+  formData.steps.push(defaultStep())
+}
+
+/**
+ * 删除某个治疗步骤
+ */
+function removeStep(index) {
+  if (formData.steps.length <= 1) return
+  formData.steps.splice(index, 1)
+}
+
+/**
+ * 打开新增弹窗
+ */
+function handleAdd() {
+  Object.assign(formData, defaultForm())
+  formData.steps = [defaultStep()]
+  dialogTitle.value = '新增方案'
+  dialogMode.value = 'add'
+  dialogVisible.value = true
+}
+
+/**
+ * 打开编辑弹窗
+ */
+async function handleEdit(row) {
+  const res = await getPlanDetail(row.id)
+  const detail = res.data
+  Object.assign(formData, defaultForm(), {
+    ...detail,
+    symptomsList: detail.symptoms ? detail.symptoms.split(',') : [],
+    steps: detail.steps?.length > 0 ? detail.steps : [defaultStep()]
+  })
+  dialogTitle.value = '编辑方案'
+  dialogMode.value = 'edit'
+  dialogVisible.value = true
+}
+
+/**
+ * 提交保存(0=草稿,1=发布)
+ */
+async function handleSubmit(publishFlag) {
+  await formRef.value.validate()
+  submitLoading.value = true
+  try {
+    const payload = {
+      ...formData,
+      symptoms: formData.symptomsList.join(','),
+      status: publishFlag
+    }
+    if (formData.id) {
+      await updatePlan(payload)
+    } else {
+      await addPlan(payload)
+    }
+    ElMessage.success('操作成功')
+    dialogVisible.value = false
+    loadData()
+  } finally {
+    submitLoading.value = false
+  }
+}
+
+// ============ 方案详情弹窗 ============
+const detailVisible = ref(false)
+const detailData = ref(null)
+
+/**
+ * 查看方案详情
+ */
+async function handleView(row) {
+  const res = await getPlanDetail(row.id)
+  detailData.value = res.data
+  detailVisible.value = true
+}
+
+// ============ 状态操作 ============
+/**
+ * 发布单条方案
+ */
+async function handlePublish(row) {
+  await ElMessageBox.confirm(`确认发布方案「${row.name}」吗?`, '提示', { type: 'warning' })
+  await publishPlan(row.id)
+  ElMessage.success('发布成功')
+  loadData()
+}
+
+/**
+ * 下架单条方案
+ */
+async function handleOffshelf(row) {
+  await ElMessageBox.confirm(`确认下架方案「${row.name}」吗?`, '提示', { type: 'warning' })
+  await offshelfPlan(row.id)
+  ElMessage.success('下架成功')
+  loadData()
+}
+
+/**
+ * 批量发布
+ */
+async function handleBatchPublish() {
+  await ElMessageBox.confirm(`确认批量发布选中的 ${selectedIds.value.length} 条方案吗?`, '批量发布', { type: 'warning' })
+  await batchPublishPlan(selectedIds.value)
+  ElMessage.success('批量发布成功')
+  loadData()
+}
+
+/**
+ * 批量下架
+ */
+async function handleBatchOffshelf() {
+  await ElMessageBox.confirm(`确认批量下架选中的 ${selectedIds.value.length} 条方案吗?`, '批量下架', { type: 'warning' })
+  await batchOffshelfPlan(selectedIds.value)
+  ElMessage.success('批量下架成功')
+  loadData()
+}
+
+/**
+ * 删除单条方案
+ */
+async function handleDelete(row) {
+  await ElMessageBox.confirm(`确认删除方案「${row.name}」吗?`, '提示', { type: 'warning' })
+  await deletePlan(row.id)
+  ElMessage.success('删除成功')
+  loadData()
+}
+
+/**
+ * 批量删除
+ */
+async function handleBatchDelete() {
+  await ElMessageBox.confirm(
+    `确认批量删除选中的 ${selectedIds.value.length} 条方案吗?(仅草稿状态可删)`,
+    '批量删除确认',
+    { type: 'warning', confirmButtonText: '确认删除', cancelButtonText: '取消' }
+  )
+  await batchDeletePlan(selectedIds.value)
+  ElMessage.success('批量删除成功')
+  selectedIds.value = []
+  loadData()
+}
+
+onMounted(loadData)
+</script>
+
+<style lang="scss" scoped>
+.page-container {
+  display: flex;
+  flex-direction: column;
+  gap: 16px;
+}
+
+.search-card {
+  :deep(.el-card__body) {
+    padding: 16px 20px 4px;
+  }
+}
+
+.table-card {
+  .card-header {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+
+    .title {
+      font-weight: 600;
+      font-size: 15px;
+    }
+
+    .btn-group {
+      display: flex;
+      gap: 8px;
+      align-items: center;
+    }
+  }
+}
+
+.pagination {
+  margin-top: 16px;
+  justify-content: flex-end;
+}
+
+.step-row {
+  border: 1px solid #ebeef5;
+  border-radius: 6px;
+  padding: 12px 16px 0;
+  margin-bottom: 12px;
+  background: #fafafa;
+
+  .step-header {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    margin-bottom: 8px;
+
+    .step-num {
+      font-weight: 600;
+      color: #409eff;
+      font-size: 13px;
+    }
+  }
+}
+</style>

+ 3 - 1
openspec/frontend/src/views/user/app-user/index.vue

@@ -55,6 +55,8 @@
             </el-tag>
           </template>
         </el-table-column>
+         <el-table-column prop="s" label="绑定设备" width="170" />
+          <el-table-column prop="s" label="子用户" width="170" />
         <el-table-column prop="createTime" label="注册时间" width="170" />
         <el-table-column label="操作" width="240" align="center" fixed="right">
           <template #default="{ row }">
@@ -67,7 +69,7 @@
             >
               {{ row.status === 1 ? '禁用' : '启用' }}
             </el-button>
-            <el-button size="small" type="info" link @click="handleViewProfiles(row)">子用户</el-button>
+            <!-- <el-button size="small" type="info" link @click="handleViewProfiles(row)">子用户</el-button> -->
             <el-button size="small" type="danger" link @click="handleDelete(row)">删除</el-button>
           </template>
         </el-table-column>

+ 225 - 83
openspec/frontend/src/views/user/device/index.vue

@@ -1,54 +1,70 @@
 <template>
   <div class="page-container">
-    <!-- 搜索区域 -->
-    <el-card class="search-card">
-      <el-form :model="queryForm" inline>
-        <el-form-item label="所属用户ID">
-          <el-input-number v-model="queryForm.userId" :min="1" placeholder="用户ID" controls-position="right" style="width:150px" />
-        </el-form-item>
-        <el-form-item label="设备编码">
-          <el-input v-model="queryForm.deviceCode" placeholder="请输入设备编码" clearable style="width:180px" />
-        </el-form-item>
-        <el-form-item label="设备名称">
-          <el-input v-model="queryForm.deviceName" placeholder="请输入设备名称" clearable style="width:160px" />
-        </el-form-item>
-        <el-form-item label="绑定状态">
-          <el-select v-model="queryForm.status" placeholder="全部" clearable style="width:110px">
-            <el-option label="已绑定" :value="1" />
-            <el-option label="已解绑" :value="0" />
-          </el-select>
-        </el-form-item>
-        <el-form-item>
-          <el-button type="primary" :icon="Search" @click="handleSearch">搜索</el-button>
-          <el-button :icon="Refresh" @click="handleReset">重置</el-button>
-        </el-form-item>
-      </el-form>
+    <!-- 页头:用户名 + 返回按钮(从用户管理跳转而来时显示) -->
+    <div v-if="userId" class="page-header">
+      <el-button :icon="ArrowLeft" @click="goBack">返回用户列表</el-button>
+      <span class="page-title">用户设备管理 — {{ userName }}</span>
+    </div>
+
+    <!-- 操作按钮区 -->
+    <el-card class="action-card">
+      <div class="action-bar">
+        <div>
+          <el-button type="primary" :icon="Plus" @click="handleAddDevice">添加设备</el-button>
+          <el-button
+            type="danger"
+            :icon="Delete"
+            :disabled="selectedIds.length === 0"
+            @click="handleBatchUnbind"
+          >批量解绑</el-button>
+        </div>
+      </div>
     </el-card>
 
     <!-- 表格区域 -->
     <el-card class="table-card">
-      <template #header>
-        <div class="card-header">
-          <span class="title">设备绑定列表</span>
-        </div>
-      </template>
-
-      <el-table :data="tableData" v-loading="loading" border stripe>
-        <el-table-column type="index" label="#" width="55" align="center" />
-        <el-table-column prop="userId" label="所属用户ID" width="110" align="center" />
-        <el-table-column prop="deviceCode" label="设备编码" />
-        <el-table-column prop="deviceName" label="设备名称" />
-        <el-table-column prop="status" label="绑定状态" width="100" align="center">
+      <el-table
+        :data="tableData"
+        v-loading="loading"
+        border
+        stripe
+        @selection-change="handleSelectionChange"
+      >
+        <el-table-column type="selection" width="50" align="center" />
+        <el-table-column type="index" label="序号" width="60" align="center" />
+        <el-table-column prop="deviceCode" label="设备编号" min-width="120" />
+        <el-table-column prop="deviceName" label="设备名称" min-width="120" />
+        <el-table-column prop="deviceModel" label="设备型号" min-width="110">
+          <template #default="{ row }">{{ row.deviceModel || '-' }}</template>
+        </el-table-column>
+        <el-table-column prop="bindTime" label="绑定时间" width="170" />
+        <el-table-column label="是否主设备" width="105" align="center">
           <template #default="{ row }">
-            <el-tag :type="row.status === 1 ? 'success' : 'info'" size="small">
-              {{ row.status === 1 ? '已绑定' : '已解绑' }}
+            <el-tag :type="row.isPrimary === 1 ? 'warning' : 'info'" size="small">
+              {{ row.isPrimary === 1 ? '是' : '否' }}
             </el-tag>
           </template>
         </el-table-column>
-        <el-table-column prop="bindTime" label="绑定时间" width="170" />
-        <el-table-column prop="createTime" label="创建时间" width="170" />
-        <el-table-column label="操作" width="150" align="center" fixed="right">
+        <el-table-column label="在线状态" width="90" align="center">
+          <template #default="{ row }">
+            <el-badge :is-dot="true" :type="row.onlineStatus === 1 ? 'success' : 'danger'">
+              <el-tag :type="row.onlineStatus === 1 ? 'success' : 'info'" size="small">
+                {{ row.onlineStatus === 1 ? '在线' : '离线' }}
+              </el-tag>
+            </el-badge>
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" width="160" align="center" fixed="right">
           <template #default="{ row }">
+            <el-button
+              size="small"
+              type="primary"
+              link
+              :disabled="row.isPrimary === 1 || row.status === 0"
+              @click="handleSetPrimary(row)"
+            >
+              设为主设备
+            </el-button>
             <el-button
               size="small"
               type="warning"
@@ -58,15 +74,14 @@
             >
               解绑
             </el-button>
-            <el-button size="small" type="danger" link @click="handleDelete(row)">删除</el-button>
           </template>
         </el-table-column>
       </el-table>
 
       <!-- 分页 -->
       <el-pagination
-        v-model:current-page="queryForm.pageNum"
-        v-model:page-size="queryForm.pageSize"
+        v-model:current-page="pageNum"
+        v-model:page-size="pageSize"
         :page-sizes="[10, 20, 50]"
         :total="total"
         layout="total, sizes, prev, pager, next, jumper"
@@ -75,34 +90,69 @@
         @current-change="loadData"
       />
     </el-card>
+
+    <!-- 添加设备弹窗 -->
+    <el-dialog v-model="addDialogVisible" title="添加设备" width="480px" destroy-on-close>
+      <el-form :model="deviceForm" :rules="deviceRules" ref="deviceFormRef" label-width="90px">
+        <el-form-item label="设备编号" prop="deviceCode">
+          <el-input v-model="deviceForm.deviceCode" placeholder="请输入设备编号" maxlength="100" />
+        </el-form-item>
+        <el-form-item label="设备名称" prop="deviceName">
+          <el-input v-model="deviceForm.deviceName" placeholder="请输入设备名称" maxlength="100" />
+        </el-form-item>
+        <el-form-item label="设备型号">
+          <el-input v-model="deviceForm.deviceModel" placeholder="请输入设备型号(选填)" maxlength="100" />
+        </el-form-item>
+      </el-form>
+      <template #footer>
+        <el-button @click="addDialogVisible = false">取消</el-button>
+        <el-button type="primary" :loading="submitLoading" @click="submitAddDevice">确认绑定</el-button>
+      </template>
+    </el-dialog>
   </div>
 </template>
 
 <script setup>
-import { ref, reactive, onMounted } from 'vue'
+import { ref, reactive, onMounted, computed } from 'vue'
+import { useRoute, useRouter } from 'vue-router'
 import { ElMessage, ElMessageBox } from 'element-plus'
-import { Search, Refresh } from '@element-plus/icons-vue'
-import { getDevicePage, unbindDevice, deleteDevice } from '@/api/user'
+import { ArrowLeft, Plus, Delete } from '@element-plus/icons-vue'
+import {
+  getDevicePage,
+  addDevice,
+  unbindDevice,
+  setPrimaryDevice,
+  batchUnbindDevices
+} from '@/api/user'
 
-// 查询表单
-const queryForm = reactive({
-  userId: null,
-  deviceCode: '',
-  deviceName: '',
-  status: null,
-  pageNum: 1,
-  pageSize: 10
-})
+const route = useRoute()
+const router = useRouter()
 
+// 从路由参数获取用户信息(由用户管理页跳转传入)
+const userId = computed(() => route.query.userId ? Number(route.query.userId) : null)
+const userName = computed(() => route.query.userName || '')
+
+// 列表数据
 const tableData = ref([])
 const total = ref(0)
 const loading = ref(false)
+const selectedIds = ref([])
+const pageNum = ref(1)
+const pageSize = ref(10)
 
+/**
+ * 加载设备列表
+ */
 async function loadData() {
   loading.value = true
   try {
-    const params = { ...queryForm }
-    if (!params.userId) delete params.userId
+    const params = {
+      pageNum: pageNum.value,
+      pageSize: pageSize.value
+    }
+    if (userId.value) {
+      params.userId = userId.value
+    }
     const res = await getDevicePage(params)
     tableData.value = res.data?.records || []
     total.value = res.data?.total || 0
@@ -111,33 +161,114 @@ async function loadData() {
   }
 }
 
-function handleSearch() {
-  queryForm.pageNum = 1
-  loadData()
+/**
+ * 多选变化
+ */
+function handleSelectionChange(selection) {
+  selectedIds.value = selection.map(r => r.id)
 }
 
-function handleReset() {
-  queryForm.userId = null
-  queryForm.deviceCode = ''
-  queryForm.deviceName = ''
-  queryForm.status = null
-  queryForm.pageNum = 1
-  loadData()
+/**
+ * 返回用户列表
+ */
+function goBack() {
+  router.push('/user/profile')
+}
+
+// ======================== 添加设备 ========================
+const addDialogVisible = ref(false)
+const submitLoading = ref(false)
+const deviceFormRef = ref(null)
+const deviceForm = reactive({
+  deviceCode: '',
+  deviceName: '',
+  deviceModel: ''
+})
+
+const deviceRules = {
+  deviceCode: [
+    { required: true, message: '请输入设备编号', trigger: 'blur' },
+    { max: 100, message: '设备编号不超过100个字符', trigger: 'blur' }
+  ],
+  deviceName: [
+    { required: true, message: '请输入设备名称', trigger: 'blur' },
+    { max: 100, message: '设备名称不超过100个字符', trigger: 'blur' }
+  ]
 }
 
-// 解绑设备
+/**
+ * 打开添加设备弹窗
+ */
+function handleAddDevice() {
+  Object.assign(deviceForm, { deviceCode: '', deviceName: '', deviceModel: '' })
+  addDialogVisible.value = true
+}
+
+/**
+ * 提交绑定设备
+ */
+async function submitAddDevice() {
+  await deviceFormRef.value.validate()
+  submitLoading.value = true
+  try {
+    await addDevice({
+      userId: userId.value,
+      deviceCode: deviceForm.deviceCode,
+      deviceName: deviceForm.deviceName,
+      deviceModel: deviceForm.deviceModel || undefined
+    })
+    ElMessage.success('绑定成功')
+    addDialogVisible.value = false
+    loadData()
+  } finally {
+    submitLoading.value = false
+  }
+}
+
+// ======================== 解绑 ========================
+
+/**
+ * 解绑单个设备
+ */
 async function handleUnbind(row) {
-  await ElMessageBox.confirm('确认解绑该设备吗?', '提示', { type: 'warning' })
+  await ElMessageBox.confirm(
+    `确认解绑设备「${row.deviceName || row.deviceCode}」吗?`,
+    '提示',
+    { type: 'warning' }
+  )
   await unbindDevice(row.id)
   ElMessage.success('解绑成功')
   loadData()
 }
 
-// 删除记录
-async function handleDelete(row) {
-  await ElMessageBox.confirm('确认删除该设备记录吗?', '提示', { type: 'warning' })
-  await deleteDevice(row.id)
-  ElMessage.success('删除成功')
+/**
+ * 批量解绑设备(需二次确认)
+ */
+async function handleBatchUnbind() {
+  await ElMessageBox.confirm(
+    `确认批量解绑选中的 ${selectedIds.value.length} 台设备吗?`,
+    '批量解绑确认',
+    { type: 'warning', confirmButtonText: '确认解绑', cancelButtonText: '取消' }
+  )
+  await batchUnbindDevices(selectedIds.value)
+  ElMessage.success('批量解绑成功')
+  selectedIds.value = []
+  loadData()
+}
+
+// ======================== 设为主设备 ========================
+
+/**
+ * 设置主设备
+ */
+async function handleSetPrimary(row) {
+  await ElMessageBox.confirm(
+    `确认将「${row.deviceName || row.deviceCode}」设为主设备吗?`,
+    '提示',
+    { type: 'warning' }
+  )
+  await setPrimaryDevice(row.id, userId.value || row.userId)
+  ElMessage.success('设置成功')
   loadData()
 }
 
@@ -151,24 +282,35 @@ onMounted(loadData)
   gap: 16px;
 }
 
-.search-card {
-  :deep(.el-card__body) {
-    padding: 16px 20px 4px;
+.page-header {
+  display: flex;
+  align-items: center;
+  gap: 16px;
+  padding: 4px 0;
+
+  .page-title {
+    font-size: 16px;
+    font-weight: 600;
+    color: #303133;
   }
 }
 
-.table-card {
-  .card-header {
+.action-card {
+  :deep(.el-card__body) {
+    padding: 14px 20px;
+  }
+
+  .action-bar {
     display: flex;
     align-items: center;
     justify-content: space-between;
-    .title {
-      font-weight: 600;
-      font-size: 15px;
-    }
   }
 }
 
+.table-card {
+  flex: 1;
+}
+
 .pagination {
   margin-top: 16px;
   justify-content: flex-end;

+ 220 - 0
openspec/frontend/src/views/user/plan/index.vue

@@ -0,0 +1,220 @@
+<template>
+  <div class="page-container">
+    <!-- 页头:用户名 + 返回按钮 -->
+    <div class="page-header">
+      <el-button :icon="ArrowLeft" @click="goBack">返回用户列表</el-button>
+      <span class="page-title">用户方案管理 — {{ userName }}</span>
+    </div>
+
+    <!-- 表格区域 -->
+    <el-card class="table-card">
+      <template #header>
+        <div class="card-header">
+          <span class="title">方案列表</span>
+        </div>
+      </template>
+
+      <el-table :data="tableData" v-loading="loading" border stripe>
+        <el-table-column type="index" label="序号" width="60" align="center" />
+        <el-table-column prop="createTime" label="时间" width="160">
+          <template #default="{ row }">{{ row.createTime?.substring(0, 16) || '-' }}</template>
+        </el-table-column>
+        <el-table-column label="模式类型" width="110" align="center">
+          <template #default="{ row }">
+            <el-tag :type="modeTypeTag(row.modeType)" size="small">{{ modeTypeLabel(row.modeType) }}</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column prop="planName" label="方案名称" min-width="140" show-overflow-tooltip />
+        <el-table-column prop="planCode" label="方案编码" width="110" />
+        <el-table-column prop="authorName" label="创作人" width="100">
+          <template #default="{ row }">{{ row.authorName || 'ADMIN' }}</template>
+        </el-table-column>
+        <el-table-column prop="stepCount" label="步骤" width="70" align="center" />
+        <el-table-column prop="useCount" label="使用次数" width="90" align="center" />
+        <el-table-column label="操作" width="100" align="center" fixed="right">
+          <template #default="{ row }">
+            <el-button size="small" type="primary" link @click="handleView(row)">查看详情</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+
+      <!-- 分页 -->
+      <el-pagination
+        v-model:current-page="pageNum"
+        v-model:page-size="pageSize"
+        :page-sizes="[10, 20, 50]"
+        :total="total"
+        layout="total, sizes, prev, pager, next, jumper"
+        class="pagination"
+        @size-change="loadData"
+        @current-change="loadData"
+      />
+    </el-card>
+
+    <!-- 方案详情弹窗 -->
+    <el-dialog v-model="detailVisible" title="工艺详情" width="680px" destroy-on-close>
+      <template v-if="detailData">
+        <el-descriptions :column="2" border size="small">
+          <el-descriptions-item label="方案名称">{{ detailData.planName }}</el-descriptions-item>
+          <el-descriptions-item label="方案编码">{{ detailData.planCode }}</el-descriptions-item>
+          <el-descriptions-item label="模式类型">{{ modeTypeLabel(detailData.modeType) }}</el-descriptions-item>
+          <el-descriptions-item label="创作人">{{ detailData.authorName || 'ADMIN' }}</el-descriptions-item>
+          <el-descriptions-item label="订阅时间">{{ detailData.createTime || '-' }}</el-descriptions-item>
+          <el-descriptions-item label="使用次数">{{ detailData.useCount || 0 }}次</el-descriptions-item>
+        </el-descriptions>
+
+        <el-divider>工艺详情</el-divider>
+        <template v-if="parsedSteps.length > 0">
+          <el-table :data="parsedSteps" border size="small">
+            <el-table-column prop="stepOrder" label="步骤" width="60" align="center" />
+            <el-table-column prop="acupointName" label="穴位" width="100" />
+            <el-table-column label="侧别" width="80" align="center">
+              <template #default="{ row }">{{ sideLabel(row.side) }}</template>
+            </el-table-column>
+            <el-table-column prop="temperature" label="温度(°C)" width="90" align="center" />
+            <el-table-column prop="duration" label="时间(分)" width="90" align="center" />
+            <el-table-column prop="techniqueName" label="艾灸手法" min-width="100" />
+          </el-table>
+        </template>
+        <el-empty v-else description="暂无工艺步骤数据" />
+      </template>
+      <template #footer>
+        <el-button @click="detailVisible = false">关闭</el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import { ref, computed, onMounted } from 'vue'
+import { useRoute, useRouter } from 'vue-router'
+import { ArrowLeft } from '@element-plus/icons-vue'
+import { getUserPlanPage, getUserPlanDetail } from '@/api/plan'
+
+const route = useRoute()
+const router = useRouter()
+
+// 从路由参数获取用户信息
+const userId = computed(() => route.query.userId ? Number(route.query.userId) : null)
+const userName = computed(() => route.query.userName || '')
+
+// 列表
+const tableData = ref([])
+const total = ref(0)
+const loading = ref(false)
+const pageNum = ref(1)
+const pageSize = ref(10)
+
+/**
+ * 模式类型标签文字
+ */
+function modeTypeLabel(val) {
+  return ['', '一键艾灸', '专业模式', '自定义模式', '延年圣手'][val] || '-'
+}
+
+/**
+ * 模式类型 Tag 颜色
+ */
+function modeTypeTag(val) {
+  return ['', '', 'success', 'warning', 'danger'][val] || ''
+}
+
+/**
+ * 侧别文字
+ */
+function sideLabel(val) {
+  return ['', '中心', '左侧', '右侧', '双侧'][val] || '-'
+}
+
+/**
+ * 加载用户方案列表
+ */
+async function loadData() {
+  if (!userId.value) return
+  loading.value = true
+  try {
+    const res = await getUserPlanPage({
+      userId: userId.value,
+      pageNum: pageNum.value,
+      pageSize: pageSize.value
+    })
+    tableData.value = res.data?.records || []
+    total.value = res.data?.total || 0
+  } finally {
+    loading.value = false
+  }
+}
+
+/**
+ * 返回用户列表
+ */
+function goBack() {
+  router.push('/user/profile')
+}
+
+// ============ 详情弹窗 ============
+const detailVisible = ref(false)
+const detailData = ref(null)
+
+/**
+ * 解析 steps_json 字段
+ */
+const parsedSteps = computed(() => {
+  if (!detailData.value?.stepsJson) return []
+  try {
+    return JSON.parse(detailData.value.stepsJson)
+  } catch {
+    return []
+  }
+})
+
+/**
+ * 查看方案详情
+ */
+async function handleView(row) {
+  const res = await getUserPlanDetail(row.id)
+  detailData.value = res.data
+  detailVisible.value = true
+}
+
+onMounted(loadData)
+</script>
+
+<style lang="scss" scoped>
+.page-container {
+  display: flex;
+  flex-direction: column;
+  gap: 16px;
+}
+
+.page-header {
+  display: flex;
+  align-items: center;
+  gap: 16px;
+  padding: 0 4px;
+
+  .page-title {
+    font-size: 16px;
+    font-weight: 600;
+    color: #303133;
+  }
+}
+
+.table-card {
+  .card-header {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+
+    .title {
+      font-weight: 600;
+      font-size: 15px;
+    }
+  }
+}
+
+.pagination {
+  margin-top: 16px;
+  justify-content: flex-end;
+}
+</style>

+ 372 - 82
openspec/frontend/src/views/user/profile/index.vue

@@ -3,14 +3,38 @@
     <!-- 搜索区域 -->
     <el-card class="search-card">
       <el-form :model="queryForm" inline>
-        <el-form-item label="所属用户ID">
-          <el-input-number v-model="queryForm.userId" :min="1" placeholder="用户ID" clearable controls-position="right" style="width:150px" />
+        <el-form-item label="姓名/手机号">
+          <el-input v-model="queryForm.keyword" placeholder="请输入姓名或手机号" clearable style="width:200px" />
         </el-form-item>
-        <el-form-item label="姓名">
-          <el-input v-model="queryForm.name" placeholder="请输入姓名" clearable style="width:160px" />
+        <el-form-item label="设备编号">
+          <el-input v-model="queryForm.deviceCode" placeholder="请输入设备编号" clearable style="width:180px" />
+        </el-form-item>
+        <el-form-item label="性别">
+          <el-select v-model="queryForm.gender" placeholder="全部" clearable style="width:100px">
+            <el-option label="男" :value="1" />
+            <el-option label="女" :value="2" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="注册时间">
+          <el-date-picker
+            v-model="queryForm.dateRange"
+            type="daterange"
+            range-separator="至"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            value-format="YYYY-MM-DD HH:mm:ss"
+            :default-time="[new Date(0,0,0,0,0,0), new Date(0,0,0,23,59,59)]"
+            style="width:240px"
+          />
+        </el-form-item>
+        <el-form-item label="穴位表">
+          <el-select v-model="queryForm.acupointStatus" placeholder="全部" clearable style="width:110px">
+            <el-option label="已生成" :value="1" />
+            <el-option label="未生成" :value="0" />
+          </el-select>
         </el-form-item>
         <el-form-item>
-          <el-button type="primary" :icon="Search" @click="handleSearch">搜索</el-button>
+          <el-button type="primary" :icon="Search" @click="handleSearch">查询</el-button>
           <el-button :icon="Refresh" @click="handleReset">重置</el-button>
         </el-form-item>
       </el-form>
@@ -20,14 +44,35 @@
     <el-card class="table-card">
       <template #header>
         <div class="card-header">
-          <span class="title">子用户列表</span>
-          <el-button type="primary" :icon="Plus" @click="handleAdd">新增子用户</el-button>
+          <span class="title">用户管理</span>
+          <div class="btn-group">
+            <ExcelImport :on-import="handleImport" button-text="导入" @success="onImportSuccess" />
+            <ExcelExport
+              :headers="exportHeaders"
+              :data="tableData"
+              file-name="用户列表"
+            />
+            <el-button type="primary" :icon="Plus" @click="handleAdd">新增</el-button>
+            <el-button
+              type="danger"
+              :icon="Delete"
+              :disabled="selectedIds.length === 0"
+              @click="handleBatchDelete"
+            >批量删除</el-button>
+          </div>
         </div>
       </template>
 
-      <el-table :data="tableData" v-loading="loading" border stripe>
-        <el-table-column type="index" label="#" width="55" align="center" />
-        <el-table-column prop="userId" label="所属用户ID" width="110" align="center" />
+      <el-table
+        :data="tableData"
+        v-loading="loading"
+        border
+        stripe
+        @selection-change="handleSelectionChange"
+      >
+        <el-table-column type="selection" width="50" align="center" />
+        <el-table-column type="index" label="序号" width="60" align="center" />
+        <el-table-column prop="id" label="用户ID" width="80" align="center" />
         <el-table-column prop="name" label="姓名" width="100" />
         <el-table-column prop="gender" label="性别" width="70" align="center">
           <template #default="{ row }">
@@ -37,22 +82,33 @@
             <span v-else>-</span>
           </template>
         </el-table-column>
-        <el-table-column prop="age" label="年龄" width="70" align="center">
+        <el-table-column prop="age" label="年龄" width="65" align="center">
           <template #default="{ row }">{{ row.age != null ? row.age + '岁' : '-' }}</template>
         </el-table-column>
+        <el-table-column prop="phone" label="手机号" width="130" />
+        <el-table-column prop="deviceCodes" label="设备编号" min-width="140">
+          <template #default="{ row }">
+            <span v-if="row.deviceCodes">{{ row.deviceCodes }}</span>
+            <span v-else class="text-gray">-</span>
+          </template>
+        </el-table-column>
         <el-table-column prop="shoulderWidth" label="肩宽(cm)" width="90" align="center">
           <template #default="{ row }">{{ row.shoulderWidth ?? '-' }}</template>
         </el-table-column>
         <el-table-column prop="bodyHeight" label="身长(cm)" width="90" align="center">
           <template #default="{ row }">{{ row.bodyHeight ?? '-' }}</template>
         </el-table-column>
-        <el-table-column prop="acupointTableId" label="穴位表ID" width="100" align="center">
-          <template #default="{ row }">{{ row.acupointTableId ?? '-' }}</template>
+        <el-table-column label="穴位表" width="90" align="center">
+          <template #default="{ row }">
+            <el-tag v-if="row.acupointTableId" type="success" size="small">已生成</el-tag>
+            <el-tag v-else type="info" size="small">未生成</el-tag>
+          </template>
         </el-table-column>
         <el-table-column prop="createTime" label="注册时间" width="170" />
-        <el-table-column label="操作" width="130" align="center" fixed="right">
+        <el-table-column label="操作" width="200" align="center" fixed="right">
           <template #default="{ row }">
             <el-button size="small" type="primary" link @click="handleEdit(row)">编辑</el-button>
+            <el-button size="small" type="success" link @click="handleDeviceManager(row)">设备管理</el-button>
             <el-button size="small" type="danger" link @click="handleDelete(row)">删除</el-button>
           </template>
         </el-table-column>
@@ -75,56 +131,129 @@
     <el-dialog
       v-model="dialogVisible"
       :title="dialogTitle"
-      width="520px"
+      width="680px"
       destroy-on-close
     >
-      <el-form :model="formData" :rules="formRules" ref="formRef" label-width="90px">
-        <el-form-item label="所属用户ID" prop="userId">
-          <el-input-number v-model="formData.userId" :min="1" :disabled="!!formData.id" style="width:100%" />
-        </el-form-item>
-        <el-form-item label="姓名" prop="name">
-          <el-input v-model="formData.name" placeholder="请输入姓名" />
-        </el-form-item>
-        <el-form-item label="性别">
-          <el-radio-group v-model="formData.gender">
-            <el-radio :label="1">男</el-radio>
-            <el-radio :label="2">女</el-radio>
-          </el-radio-group>
-        </el-form-item>
-        <el-form-item label="年龄">
-          <el-input-number v-model="formData.age" :min="0" :max="150" style="width:100%" />
-        </el-form-item>
-        <el-form-item label="肩宽(cm)">
-          <el-input-number v-model="formData.shoulderWidth" :min="0" :precision="1" style="width:100%" />
-        </el-form-item>
-        <el-form-item label="身长(cm)">
-          <el-input-number v-model="formData.bodyHeight" :min="0" :precision="1" style="width:100%" />
-        </el-form-item>
-        <el-form-item label="穴位表ID">
-          <el-input-number v-model="formData.acupointTableId" :min="1" style="width:100%" />
-        </el-form-item>
+      <el-form :model="formData" :rules="formRules" ref="formRef" label-width="100px">
+        <el-row :gutter="16">
+          <el-col :span="12">
+            <el-form-item label="姓名" prop="name">
+              <el-input v-model="formData.name" placeholder="请输入姓名" maxlength="50" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="性别" prop="gender">
+              <el-radio-group v-model="formData.gender">
+                <el-radio :label="1">男</el-radio>
+                <el-radio :label="2">女</el-radio>
+              </el-radio-group>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="年龄" prop="age">
+              <el-input-number v-model="formData.age" :min="1" :max="120" style="width:100%" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="手机号" prop="phone">
+              <el-input v-model="formData.phone" placeholder="请输入手机号" maxlength="11" :disabled="!!formData.id" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="肩宽(cm)" prop="shoulderWidth">
+              <el-input-number v-model="formData.shoulderWidth" :min="0" :precision="1" style="width:100%" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="身长(cm)" prop="bodyHeight">
+              <el-input-number v-model="formData.bodyHeight" :min="0" :precision="1" style="width:100%" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-divider content-position="left"><span class="divider-text">指宽(选填,提高穴位精度)</span></el-divider>
+        <el-row :gutter="16">
+          <el-col :span="8">
+            <el-form-item label="1寸(cm)" prop="fingerWidth1" label-width="70px">
+              <el-input-number
+                v-model="formData.fingerWidth1"
+                :min="formData.gender ? fingerLimits.fw1.min : 0"
+                :max="formData.gender ? fingerLimits.fw1.max : 99"
+                :step="0.01"
+                :precision="2"
+                controls-position="right"
+                style="width:100%"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="1.5寸(cm)" prop="fingerWidth15" label-width="75px">
+              <el-input-number
+                v-model="formData.fingerWidth15"
+                :min="formData.gender ? fingerLimits.fw15.min : 0"
+                :max="formData.gender ? fingerLimits.fw15.max : 99"
+                :step="0.01"
+                :precision="2"
+                controls-position="right"
+                style="width:100%"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="3寸(cm)" prop="fingerWidth3" label-width="70px">
+              <el-input-number
+                v-model="formData.fingerWidth3"
+                :min="formData.gender ? fingerLimits.fw3.min : 0"
+                :max="formData.gender ? fingerLimits.fw3.max : 99"
+                :step="0.01"
+                :precision="2"
+                controls-position="right"
+                style="width:100%"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
       </el-form>
       <template #footer>
         <el-button @click="dialogVisible = false">取消</el-button>
-        <el-button type="primary" :loading="submitLoading" @click="handleSubmit">确定</el-button>
+        <el-button
+          v-if="formData.id"
+          type="warning"
+          :loading="generateLoading"
+          @click="handleGenerateAcupoint"
+        >生成用户穴位</el-button>
+        <el-button type="primary" :loading="submitLoading" @click="handleSubmit">保存</el-button>
       </template>
     </el-dialog>
+
   </div>
 </template>
 
 <script setup>
-import { ref, reactive, onMounted } from 'vue'
-import { useRoute } from 'vue-router'
+import { ref, reactive, onMounted, computed, watch } from 'vue'
 import { ElMessage, ElMessageBox } from 'element-plus'
-import { Search, Refresh, Plus } from '@element-plus/icons-vue'
-import { getProfilePage, addProfile, updateProfile, deleteProfile } from '@/api/user'
+import { useRouter } from 'vue-router'
+import { Search, Refresh, Plus, Delete } from '@element-plus/icons-vue'
+import ExcelExport from '@/components/ExcelExport.vue'
+import ExcelImport from '@/components/ExcelImport.vue'
+import {
+  getProfilePage,
+  addProfile,
+  updateProfile,
+  deleteProfile,
+  batchDeleteProfile,
+  batchImportProfile,
+  generateUserAcupoint
+} from '@/api/user'
 
-const route = useRoute()
+const router = useRouter()
 
-// 查询表单(支持从路由参数带入 userId)
+// ======================== 列表查询 ========================
 const queryForm = reactive({
-  userId: route.query.userId ? Number(route.query.userId) : null,
-  name: '',
+  keyword: '',
+  deviceCode: '',
+  gender: null,
+  dateRange: null,
+  acupointStatus: null,
   pageNum: 1,
   pageSize: 10
 })
@@ -132,39 +261,43 @@ const queryForm = reactive({
 const tableData = ref([])
 const total = ref(0)
 const loading = ref(false)
+const selectedIds = ref([])
 
-// 弹窗
-const dialogVisible = ref(false)
-const dialogTitle = ref('')
-const submitLoading = ref(false)
-const formRef = ref(null)
-const formData = reactive({
-  id: null,
-  userId: null,
-  name: '',
-  gender: null,
-  age: null,
-  shoulderWidth: null,
-  bodyHeight: null,
-  acupointTableId: null
-})
-
-const formRules = {
-  userId: [{ required: true, message: '请输入所属用户ID', trigger: 'blur' }],
-  name: [{ required: true, message: '请输入姓名', trigger: 'blur' }]
-}
+// Excel 导出列配置
+const exportHeaders = [
+  { label: '用户ID', prop: 'id' },
+  { label: '姓名', prop: 'name' },
+  { label: '性别', prop: 'genderText' },
+  { label: '年龄', prop: 'age' },
+  { label: '手机号', prop: 'phone' },
+  { label: '设备编号', prop: 'deviceCodes' },
+  { label: '肩宽(cm)', prop: 'shoulderWidth' },
+  { label: '身长(cm)', prop: 'bodyHeight' },
+  { label: '穴位表', prop: 'acupointText' },
+  { label: '注册时间', prop: 'createTime' }
+]
 
 async function loadData() {
   loading.value = true
   try {
     const params = {
-      name: queryForm.name,
+      keyword: queryForm.keyword || undefined,
+      deviceCode: queryForm.deviceCode || undefined,
+      gender: queryForm.gender,
+      startTime: queryForm.dateRange?.[0] || undefined,
+      endTime: queryForm.dateRange?.[1] || undefined,
+      acupointStatus: queryForm.acupointStatus,
       pageNum: queryForm.pageNum,
       pageSize: queryForm.pageSize
     }
-    if (queryForm.userId) params.userId = queryForm.userId
     const res = await getProfilePage(params)
-    tableData.value = res.data?.records || []
+    // 附加显示文本字段(用于 Excel 导出)
+    const records = (res.data?.records || []).map(r => ({
+      ...r,
+      genderText: r.gender === 1 ? '男' : r.gender === 2 ? '女' : '-',
+      acupointText: r.acupointTableId ? '已生成' : '未生成'
+    }))
+    tableData.value = records
     total.value = res.data?.total || 0
   } finally {
     loading.value = false
@@ -177,31 +310,121 @@ function handleSearch() {
 }
 
 function handleReset() {
-  queryForm.userId = null
-  queryForm.name = ''
+  queryForm.keyword = ''
+  queryForm.deviceCode = ''
+  queryForm.gender = null
+  queryForm.dateRange = null
+  queryForm.acupointStatus = null
   queryForm.pageNum = 1
   loadData()
 }
 
+function handleSelectionChange(selection) {
+  selectedIds.value = selection.map(r => r.id)
+}
+
+// ======================== 新增/编辑 ========================
+const dialogVisible = ref(false)
+const dialogTitle = ref('')
+const submitLoading = ref(false)
+const generateLoading = ref(false)
+const formRef = ref(null)
+const formData = reactive({
+  id: null,
+  name: '',
+  gender: null,
+  age: null,
+  phone: '',
+  shoulderWidth: null,
+  bodyHeight: null,
+  fingerWidth1: null,
+  fingerWidth15: null,
+  fingerWidth3: null
+})
+
+// 各指宽字段在不同性别下的有效范围
+const fingerLimits = computed(() => {
+  const male = formData.gender === 1
+  return {
+    fw1:  { label: '1寸',   min: male ? 1.5 : 1.3, max: male ? 2.8 : 2.4 },
+    fw15: { label: '1.5寸', min: male ? 2.2 : 2.0, max: male ? 4.0 : 3.5 },
+    fw3:  { label: '3寸',   min: male ? 4.5 : 4.0, max: male ? 8.0 : 7.0 }
+  }
+})
+
+/**
+ * 生成指宽字段的自定义 validator(选填,填了才按性别范围校验)
+ * @param {string} field fw1 | fw15 | fw3
+ */
+function makeFingerValidator(field) {
+  return (rule, value, callback) => {
+    if (value === null || value === undefined) {
+      return callback()
+    }
+    if (!formData.gender) {
+      return callback(new Error('请先选择性别再填写指宽'))
+    }
+    const { label, min, max } = fingerLimits.value[field]
+    const genderText = formData.gender === 1 ? '男性' : '女性'
+    if (value < min || value > max) {
+      return callback(new Error(`${genderText}${label}指宽应在 ${min}~${max} cm 之间`))
+    }
+    callback()
+  }
+}
+
+const formRules = {
+  name: [
+    { required: true, message: '请输入姓名', trigger: 'blur' },
+    { max: 50, message: '姓名不超过50个字符', trigger: 'blur' }
+  ],
+  gender: [{ required: true, message: '请选择性别', trigger: 'change' }],
+  age: [{ required: true, message: '请输入年龄', trigger: 'blur' }],
+  phone: [
+    { required: true, message: '请输入手机号', trigger: 'blur' },
+    { pattern: /^1[3-9]\d{9}$/, message: '手机号格式不正确', trigger: 'blur' }
+  ],
+  shoulderWidth: [{ required: true, message: '请输入肩宽', trigger: 'blur' }],
+  bodyHeight: [{ required: true, message: '请输入身长', trigger: 'blur' }],
+  fingerWidth1: [{ validator: makeFingerValidator('fw1'), trigger: 'change' }],
+  fingerWidth15: [{ validator: makeFingerValidator('fw15'), trigger: 'change' }],
+  fingerWidth3: [{ validator: makeFingerValidator('fw3'), trigger: 'change' }]
+}
+
 function handleAdd() {
   Object.assign(formData, {
-    id: null, userId: queryForm.userId, name: '', gender: null,
-    age: null, shoulderWidth: null, bodyHeight: null, acupointTableId: null
+    id: null, name: '', gender: null, age: null, phone: '',
+    shoulderWidth: null, bodyHeight: null,
+    fingerWidth1: null, fingerWidth15: null, fingerWidth3: null
   })
-  dialogTitle.value = '新增子用户'
+  dialogTitle.value = '新增用户'
   dialogVisible.value = true
 }
 
 function handleEdit(row) {
   Object.assign(formData, {
-    id: row.id, userId: row.userId, name: row.name, gender: row.gender,
-    age: row.age, shoulderWidth: row.shoulderWidth, bodyHeight: row.bodyHeight,
-    acupointTableId: row.acupointTableId
+    id: row.id,
+    name: row.name,
+    gender: row.gender,
+    age: row.age,
+    phone: row.phone,
+    shoulderWidth: row.shoulderWidth,
+    bodyHeight: row.bodyHeight,
+    fingerWidth1: row.fingerWidth1,
+    fingerWidth15: row.fingerWidth15,
+    fingerWidth3: row.fingerWidth3
   })
-  dialogTitle.value = '编辑子用户'
+  dialogTitle.value = '编辑用户'
   dialogVisible.value = true
 }
 
+// 性别切换时重新校验指宽字段(避免已填值在新性别下超出范围却无提示)
+watch(() => formData.gender, () => {
+  if (formRef.value) {
+    formRef.value.validateField(['fingerWidth1', 'fingerWidth15', 'fingerWidth3'])
+  }
+})
+
 async function handleSubmit() {
   await formRef.value.validate()
   submitLoading.value = true
@@ -219,13 +442,66 @@ async function handleSubmit() {
   }
 }
 
+// ======================== 删除 ========================
 async function handleDelete(row) {
-  await ElMessageBox.confirm('确认删除该子用户吗?', '提示', { type: 'warning' })
+  await ElMessageBox.confirm(`确认删除用户「${row.name}」吗?`, '提示', { type: 'warning' })
   await deleteProfile(row.id)
   ElMessage.success('删除成功')
   loadData()
 }
 
+async function handleBatchDelete() {
+  await ElMessageBox.confirm(`确认批量删除选中的 ${selectedIds.value.length} 条记录吗?`, '提示', { type: 'warning' })
+  await batchDeleteProfile(selectedIds.value)
+  ElMessage.success('批量删除成功')
+  selectedIds.value = []
+  loadData()
+}
+
+// ======================== 导入 ========================
+async function handleImport(data) {
+  // data 为解析后的数组,字段名需与 DTO 对应
+  await batchImportProfile(data)
+}
+
+function onImportSuccess() {
+  ElMessage.success('导入成功')
+  loadData()
+}
+
+// ======================== 设备管理(跳转独立页面) ========================
+
+/**
+ * 跳转到用户设备管理页面
+ */
+function handleDeviceManager(row) {
+  router.push({
+    path: '/user/device',
+    query: { userId: row.id, userName: row.name }
+  })
+}
+
+// ======================== 生成用户穴位 ========================
+
+/**
+ * 手动触发为当前编辑用户生成穴位坐标
+ * 编辑弹窗中点击「生成用户穴位」按钮时调用
+ */
+async function handleGenerateAcupoint() {
+  if (!formData.id) {
+    ElMessage.warning('请先保存用户后再生成穴位')
+    return
+  }
+  generateLoading.value = true
+  try {
+    await generateUserAcupoint(formData.id)
+    ElMessage.success('穴位坐标生成成功')
+    loadData()
+  } finally {
+    generateLoading.value = false
+  }
+}
+
 onMounted(loadData)
 </script>
 
@@ -251,6 +527,11 @@ onMounted(loadData)
       font-weight: 600;
       font-size: 15px;
     }
+    .btn-group {
+      display: flex;
+      gap: 8px;
+      align-items: center;
+    }
   }
 }
 
@@ -258,4 +539,13 @@ onMounted(loadData)
   margin-top: 16px;
   justify-content: flex-end;
 }
+
+.text-gray {
+  color: #aaa;
+}
+
+.divider-text {
+  font-size: 12px;
+  color: #999;
+}
 </style>

+ 236 - 0
openspec/方案管理和用户方案管理.md

@@ -0,0 +1,236 @@
+### 7.3 方案管理
+
+#### 功能说明
+
+管理员管理艾灸方案,包括一键艾灸(默认工艺)、专业模式(8种功效)、自定义模式(用户自选)、延年圣手模式(专家方案)。支持方案的新增、编辑、发布、下架操作,以及查看方案的使用统计。延年圣手模式方案将同步至用户设备,对应设备快捷键1-8。
+
+**使用角色**:系统管理员
+
+**使用场景**:
+- 管理员维护一键艾灸默认方案的穴位组合和参数
+- 管理员审核专家提交的延年圣手方案
+- 管理员发布/下架方案
+- 管理员查看方案使用统计
+
+---
+
+#### 方案列表
+
+| 多选框 | 序号 | 方案ID | 方案名称 | 模式类型 | 功效类型 | 创作人 | 步骤数 | 状态 | 创建时间 | 操作 |
+|--------|------|--------|----------|----------|----------|--------|--------|------|----------|------|
+| ☐ | 1 | S001 | 一键艾灸(默认) | 一键艾灸 | - | ADMIN | 5 | 已发布 | 2026-01-01 | 查看/编辑 |
+| ☐ | 2 | S002 | 春季祛湿方案 | 专业模式 | 祛湿 | ADMIN | 4 | 已发布 | 2026-03-20 | 查看/编辑/下架 |
+| ☐ | 3 | S003 | 个人调理方案 | 自定义模式 | - | 张三 | 3 | 草稿 | 2026-03-25 | 查看/编辑/删除 |
+| ☐ | 4 | S004 | 张专家驱寒方案 | 延年圣手 | 驱寒 | 张专家 | 5 | 已发布 | 2026-03-28 | 查看/下架 |
+
+**创作人显示规则**:
+| 方案模式 | 创作人显示 |
+|----------|-----------|
+| 一键艾灸 | ADMIN(系统默认) |
+| 专业模式 | ADMIN(系统预设)或管理员账号名 |
+| 自定义模式 | 创建该方案的用户姓名 |
+| 延年圣手模式 | 方案所属专家姓名 |
+
+#### 列表查询条件
+
+| 查询字段 | 类型 | 说明 |
+|----------|------|------|
+| 方案名称 | 文本输入 | 支持模糊搜索 |
+| 模式类型 | 下拉选择 | 全部 / 一键艾灸 / 专业模式 / 自定义模式 / 延年圣手 |
+| 功效类型 | 下拉选择 | 全部 / 驱寒 / 祛湿 / 祛风 / 化瘀 / 活血 / 化痰 / 养颜 / 扶阳 |
+| 创作人 | 文本输入 | 支持模糊搜索,可搜索ADMIN或用户/专家姓名 |
+| 状态 | 下拉选择 | 全部 / 已发布 / 草稿 / 已下架 |
+| 创建时间范围 | 日期区间 | 开始日期 ~ 结束日期 |
+
+**查询规则**:
+- 点击【查询】按钮:根据输入条件筛选列表
+- 点击【重置】按钮:清空所有查询条件
+
+#### 列表操作按钮
+
+| 按钮 | 功能说明 |
+|------|----------|
+| 导入 | 批量导入方案数据(提供JSON模板下载) |
+| 导出 | 导出方案数据为JSON文件 |
+| 新增 | 进入新增方案界面(先选择模板类型) |
+| 批量删除 | 选中多条草稿记录后批量删除(需二次确认) |
+| 批量发布 | 选中多条草稿记录后批量发布 |
+| 批量下架 | 选中多条已发布记录后批量下架 |
+
+#### 新增/编辑操作
+
+**步骤1:选择模板类型**
+| 模板类型 | 说明 |
+|----------|------|
+| 一键艾灸 | 系统默认工艺,预设督脉5穴,可编辑参数 |
+| 专业模式 | 选择功效类型,系统预设对应穴位组合,可调整 |
+| 自定义模式 | 自由选择穴位组合,自定义参数 |
+| 延年圣手 | 专家方案模板,可设置发布范围 |
+
+**步骤2:填写方案基本信息**
+
+| 字段名 | 类型 | 必填 | 验证规则 | 说明 |
+|--------|------|------|----------|------|
+| 方案名称 | 文本 | 是 | 最长100字符 | - |
+| 功效类型 | 下拉选择 | 是 | 专业模式时必选 | 驱寒/祛湿/祛风/化瘀/活血/化痰/养颜/扶阳 |
+| 适用症状 | 多选标签 | 是 | 至少选1项 | 怕冷/感冒/咳嗽/痰多/疼痛/腰酸/失眠/疲劳/皮肤暗沉/手脚冰凉/其他 |
+| 适用人群 | 单选 | 是 | 不限 / 仅男 / 仅女 | - |
+| 适用年龄范围 | 数字区间 | 是 | 最小1岁,最大120岁 | - |
+| 方案描述 | 文本域 | 否 | 最长200字符 | 专家可填写方案原理、注意事项等 |
+
+**步骤3:配置治疗步骤**
+
+| 步骤 | 字段名 | 类型 | 必填 | 说明 |
+|------|--------|------|------|------|
+| - | 步骤序号 | 数字 | 是 | 自动生成,可拖拽排序 |
+| 1 | 穴位选择 | 下拉搜索 | 是 | 从穴位库选择 |
+| 2 | 侧别 | 单选 | 是 | 单侧 / 双侧 / 左侧 / 右侧 |
+| 3 | 温度 | 数字 | 是 | 35-50°C |
+| 4 | 时间 | 数字 | 是 | 1-30分钟 |
+| 5 | 艾灸手法 | 下拉选择 | 是 | 一键艾灸/温和灸/雀啄灸/回旋灸/麻雀灸 |
+| 6 | 备注 | 文本 | 否 | 最长100字符 |
+
+**操作按钮**:
+| 按钮 | 功能说明 |
+|------|----------|
+| + 添加步骤 | 新增一个治疗步骤 |
+| - 删除步骤 | 删除当前步骤(至少保留1个) |
+| 预览方案 | 查看方案完整步骤和预计总时长 |
+| 保存为草稿 | 保存但不发布 |
+| 发布方案 | 发布后用户可见 |
+| 取消 | 放弃编辑,返回列表 |
+
+---
+
+#### 方案详情查看(独立页面)
+
+**功能说明**:查看方案的详细信息,包括基本信息、治疗步骤列表、预计总时长、使用统计等。支持从方案列表点击"查看"按钮进入。
+
+**页面布局**:
+
+**第一部分:方案基本信息**
+
+| 字段 | 显示内容 |
+|------|----------|
+| 方案ID | S001 |
+| 方案名称 | 一键艾灸(默认) |
+| 模式类型 | 一键艾灸 |
+| 功效类型 | - |
+| 创作人 | ADMIN |
+| 状态 | 已发布 |
+| 创建时间 | 2026-01-01 10:00:00 |
+| 更新时间 | 2026-03-15 14:30:00 |
+| 适用症状 | - |
+| 适用人群 | 不限 |
+| 适用年龄 | 1-120岁 |
+| 方案描述 | 系统默认一键艾灸方案,针对督脉5穴进行温和艾灸... |
+
+**第二部分:治疗步骤列表**
+
+| 步骤序号 | 穴位名称 | 侧别 | 温度 | 时间 | 艾灸手法 | 备注 |
+|----------|----------|------|------|------|----------|------|
+| 1 | 大椎穴 | 中心 | 42°C | 5分钟 | 温和灸 | 基准穴位 |
+| 2 | 身柱穴 | 中心 | 43°C | 5分钟 | 温和灸 | - |
+| 3 | 至阳穴 | 中心 | 44°C | 6分钟 | 温和灸 | - |
+| 4 | 命门穴 | 中心 | 44°C | 7分钟 | 温和灸 | - |
+| 5 | 腰阳关穴 | 中心 | 45°C | 7分钟 | 温和灸 | - |
+
+**第三部分:方案统计**
+
+| 统计项 | 数值 |
+|--------|------|
+| 总时长 | 30分钟 |
+| 使用人数 | 156人 |
+| 平均评分 | 4.8分 |
+| 最后使用时间 | 2026-04-01 09:30:00 |
+
+**第四部分:使用记录(最近10条)**
+
+| 序号 | 用户 | 设备 | 使用时间 | 时长 | 评分 |
+|------|------|------|----------|------|------|
+| 1 | 张三 | AJY001 | 2026-04-01 09:00:00 | 30分钟 | 5分 |
+| 2 | 李四 | AJY002 | 2026-03-31 20:00:00 | 30分钟 | 4分 |
+
+**操作按钮**:
+| 按钮 | 功能说明 |
+|------|----------|
+| 编辑 | 进入编辑界面(草稿状态可用) |
+| 发布/下架 | 切换方案状态 |
+| 导出 | 导出方案数据为JSON文件 |
+| 返回 | 返回方案列表 |
+
+---
+
+
+#### 用户方案表(独立页面)
+
+**功能说明**:用户方案表记录该用户下所有的艾灸方案。方案通过算法计算后,生成专属该用户的工艺参数和穴位坐标。每个用户的一键艾灸、专业模式、自定义模式、延年圣手模式中的所有订阅方案都经过算法处理后保存到此表中。
+
+**方案来源**:
+| 模式类型 | 方案来源 | 算法处理 |
+|----------|----------|----------|
+| 一键艾灸 | 系统默认工艺 | 根据用户穴位坐标生成专属工艺参数 |
+| 专业模式 | 8种功效方案 | 根据用户穴位坐标生成专属穴位组合 |
+| 自定义模式 | 用户自选方案 | 根据用户选择生成工艺参数 |
+| 延年圣手 | 专家方案订阅 | 根据用户穴位坐标生成专属工艺参数 |
+
+**使用次数更新规则**:
+- 用户在APP或设备上执行方案时,使用次数+1
+- 每次治疗会话开始时更新
+
+**方案列表**:
+
+| 序号 | 时间 | 模式类型 | 方案名称 | 方案编码 | 创作人 | 步骤 | 使用次数 | 操作 |
+|------|------|----------|----------|----------|--------|------|----------|------|
+| 1 | 2026-03-15 10:30 | 一键艾灸 | 一键艾灸(默认) | S001 | ADMIN | 5 | 15 | 查看详情 |
+| 2 | 2026-03-16 14:20 | 专业模式 | 春季祛湿方案 | S002 | ADMIN | 4 | 8 | 查看详情 |
+| 3 | 2026-03-18 09:00 | 自定义模式 | 个人调理方案 | S003 | 张三 | 3 | 3 | 查看详情 |
+| 4 | 2026-03-20 16:45 | 延年圣手 | 张专家驱寒方案 | S004 | 张专家 | 5 | 2 | 查看详情 |
+
+**列表字段说明**:
+| 字段 | 说明 |
+|------|------|
+| 时间 | 一键艾灸和专业模式按用户创建时间;自定义模式和延年圣手按方案订阅时间 |
+| 模式类型 | 一键艾灸 / 专业模式 / 自定义模式 / 延年圣手 |
+| 方案名称 | 方案的具体名称 |
+| 方案编码 | 方案的唯一标识符 |
+| 创作人 | ADMIN / 管理员账号名 / 用户姓名 / 专家姓名 |
+| 步骤 | 方案包含的治疗步骤数量 |
+| 使用次数 | 用户实际使用该方案的次数 |
+| 操作 | 查看工艺详情按钮 |
+
+**操作按钮**:
+| 按钮 | 功能说明 |
+|------|----------|
+| 查看详情 | 打开方案详情弹窗/页面 |
+| 返回 | 返回用户列表 |
+
+---
+
+#### 方案详情界面
+
+**显示内容**:
+| 字段 | 说明 |
+|------|------|
+| 方案名称 | 方案的具体名称 |
+| 方案编码 | 方案的唯一标识符 |
+| 模式类型 | 一键艾灸 / 专业模式 / 自定义模式 / 延年圣手 |
+| 创作人 | 方案创建者 |
+| 创建时间 | 方案生成时间 |
+| 使用次数 | 用户使用该方案的次数 |
+| 工艺详情 | 包含步骤序列、温度、时间、手法等 |
+
+**工艺详情结构**:
+
+| 步骤序号 | 穴位名称 | 侧别 | 温度(°C) | 时间(分钟) | 艾灸手法 |
+|----------|----------|------|----------|------------|----------|
+| 1 | 大椎穴 | 中心 | 43 | 5 | 一键艾灸 |
+| 2 | 身柱穴 | 中心 | 43 | 5 | 一键艾灸 |
+| 3 | 肺俞穴 | 左侧 | 42 | 5 | 温和灸 |
+| 4 | 肺俞穴 | 右侧 | 42 | 5 | 温和灸 |
+| 5 | 脾俞穴 | 雙側 | 45 | 10 | 回旋灸 |
+
+**操作按钮**:
+| 按钮 | 功能说明 |
+|------|----------|
+| 关闭 | 关闭详情弹窗/页面 |

+ 12 - 0
openspec/日志管理.md

@@ -0,0 +1,12 @@
+页面要有
+序号	操作人 操作人类型	操作类型	操作模块	操作内容	IP地址 参数(点击后显示)  响应(点击后显示)	操作时间
+
+**查询条件**:
+| 查询字段 | 类型 | 说明 |
+|----------|------|------|
+| 操作人 | 下拉选择 | 全部 / 各管理员 |
+| 操作类型 | 下拉选择 | 全部 / 新增 / 编辑 / 删除 / 导入 / 导出 |
+| 操作模块 | 下拉选择 | 全部 / 用户管理 / 穴位管理 / 方案管理 / 设备管理 |
+| 操作时间范围 | 日期区间 | 开始日期 ~ 结束日期 |
+
+**操作按钮**:导出(导出日志为Excel文件)

+ 42 - 0
openspec/用户穴位管理.md

@@ -0,0 +1,42 @@
+
+#### 用户穴位表(数据库层)
+
+**功能说明**:用户穴位表根据穴位管理中维护的穴位信息,自动按照每个用户生成对应的穴位坐标数据。穴位坐标通过核心算法计算而来。
+
+**数据生成规则**:
+- 当用户档案首次创建时,根据用户体型数据(肩宽、身长、指寸)自动生成穴位对照表
+- 当用户体型数据更新时,自动重新计算穴位坐标
+- 当穴位管理中新增穴位时,自动为所有用户重新计算并新增穴位坐标
+
+**触发自动更新场景**:
+| 触发条件 | 自动执行操作 |
+|----------|--------------|
+| 创建用户档案 | 根据体型数据生成穴位对照表 |
+| 更新用户体型数据(肩宽/身长/指寸) | 重新计算所有穴位坐标 |
+| 穴位管理新增穴位 | 为所有用户新增该穴位坐标 |
+
+**数据库表结构**(仅存储,不展示在后台管理界面):
+
+```typescript
+interface UserAcupointTable {
+  id: string;                    // 主键
+  userId: string;                // 用户ID
+  acupointId: string;           // 穴位ID(关联穴位管理)
+  acupointName: string;         // 穴位名称
+  acupointSide: string;         // 侧别(center/left/right/both)
+  cunValue: number;            // 相对大椎穴偏移值(寸)
+  cunType: string;             // 寸类型(1寸/1.5寸/3寸)
+  coordinateX: number;         // 计算后的X坐标(mm,相对大椎穴)
+  coordinateY: number;         // 计算后的Y坐标(mm,相对大椎穴)
+  createdAt: Date;             // 首次生成时间
+  updatedAt: Date;             // 最后更新时间
+}
+```
+
+**算法调用说明**:
+- 核心算法模块提供穴位坐标计算服务
+- 后台调用算法接口生成用户专属穴位坐标
+- 计算公式参考"四、核心算法设计"章节
+
+---
+在用户管理新增和编辑弹窗下面再加一个按钮是生成用户穴位按钮

+ 73 - 0
openspec/用户管理.md

@@ -0,0 +1,73 @@
+登录用户通过手机号验证码登录,登录进来以后可以建立子用户信息。子用户信息有姓名、性别、年龄、肩宽(cm)、身长(cm)、注册时间、用户穴位表id信息。
+用户通过手机号登录后可以绑定设备。
+如果绑定了设备的其他用户登录后扫码可以看到子用户信息。
+后台管理有管理员可以登录进来看到所有人信息和所有操作。刚刚说的登录用户通过手机号验证码登录,登录进来以后可以建立子用户信息。子用户信息有姓名、、性别、年龄、肩宽(cm)、身长(cm)、注册时间、用户穴位表id信息。
+                               用户通过手机号登录后可以绑定设备。
+                               如果绑定了设备的其他用户登录后扫码可以看到子用户信息。这种是客户的操作。我管理员可以对这些进行管理、增加、修改、删除、查看操作
+还有一种用户是专家可以发表文章等。(专家的功能和菜单也不用实现)
+现在按这种模式设计一下表结构和之前的日志框架。以及用户管理功能
+
+
+
+这样改。 应用用户和设备绑定。
+子用户和设备绑定。
+管理端前端叫用户管理有这些字段还有个字段是指宽
+| 1寸 | 数字 | 否 | 男性1.5-2.8cm / 女性1.3-2.4cm | 选填,提高精度 |
+| 1.5寸 | 数字 | 否 | 男性2.2-4.0cm / 女性2.0-3.5cm | 选填 |
+| 3寸 | 数字 | 否 | 男性4.5-8.0cm / 女性4.0-7.0cm | 选填 |
+| 多选框 | 序号 | 用户ID | 姓名 | 性别 | 年龄 | 手机号 | 设备编号 | 肩宽(cm) | 身长(cm) | 穴位表 | 注册时间 | 操作 |
+|--------|------|--------|------|------|------|--------|----------|----------|----------|------------|----------|------|
+| ☐ | 1 | U001 | 张三 | 男 | 35 | 138****1234 | AJY001,AJY002 | 42 | 85 | 查看 | 2026-03-15 | 查看/编辑/删除 |
+| ☐ | 2 | U002 | 李四 | 女 | 33 | 139****5678 | AJY001 | 36 | 78 | 查看 | 2026-03-18 | 查看/编辑/删除 |
+| ☐ | 3 | U003 | 王五 | 男 | 62 | 137****9012 | - | 40 | 82 | 查看 | 2026-03-20 | 查看/编辑/删除 |
+穴位表不用管
+
+
+
+#### 列表查询条件
+
+| 查询字段 | 类型 | 说明 |
+|----------|------|------|
+| 姓名/手机号 | 文本输入 | 支持模糊搜索 |
+| 设备编号 | 文本输入 | 支持模糊搜索,可查该设备关联的所有用户 |
+| 性别 | 下拉选择 | 全部 / 男 / 女 |
+| 注册时间范围 | 日期区间 | 开始日期 ~ 结束日期 |
+| 穴位表状态 | 下拉选择 | 全部 / 已生成 / 未生成 |
+
+**查询规则**:
+- 支持多条件组合查询
+- 点击【查询】按钮:根据输入条件筛选列表
+- 点击【重置】按钮:清空所有查询条件,恢复默认列表
+
+#### 列表操作按钮
+
+| 按钮 | 功能说明 |
+|------|----------|
+| 导入 | 批量导入用户数据(提供Excel模板下载) |
+| 导出 | 导出当前筛选结果为Excel文件 |
+| 新增 | 进入新增用户界面 |
+| 批量删除 | 选中多条记录后批量删除(需二次确认) |
+| 设备管理 | 管理用户绑定的设备列表(支持多设备绑定) |
+
+#### 新增/编辑操作
+
+**新增界面表单字段**:
+
+| 字段名 | 类型 | 必填 | 验证规则 | 说明 |
+|--------|------|------|----------|------|
+| 姓名 | 文本 | 是 | 最长50字符 | 用户真实姓名 |
+| 性别 | 单选 | 是 | 男 / 女 | - |
+| 年龄 | 数字 | 是 | 1-120 | - |
+| 手机号 | 文本 | 是 | 11位手机号格式,唯一值 | - |
+| 肩宽 | 数字 | 是 | 男性36-52cm / 女性32-46cm | 单位:厘米 |
+| 身长 | 数字 | 是 | 男性75-95cm / 女性70-88cm | 单位:厘米(坐高) |
+| 1寸 | 数字 | 否 | 男性1.5-2.8cm / 女性1.3-2.4cm | 选填,提高精度 |
+| 1.5寸 | 数字 | 否 | 男性2.2-4.0cm / 女性2.0-3.5cm | 选填 |
+| 3寸 | 数字 | 否 | 男性4.5-8.0cm / 女性4.0-7.0cm | 选填 |
+
+**操作按钮**:
+| 按钮 | 功能说明 |
+|------|----------|
+| 保存 | 保存用户档案 |
+| 取消 | 放弃编辑,返回列表 |
+| 生成穴位坐标 | 根据体型数据计算穴位对照表并保存 |

+ 17 - 0
openspec/用户设备管理.md

@@ -0,0 +1,17 @@
+#### 用户设备管理(独立页面)
+
+**功能说明**:管理单个用户绑定的设备列表,支持添加设备、移除设备、设置主设备。
+
+**设备列表**:
+
+| 多选框 | 序号 | 设备编号 | 设备名称 | 设备型号 | 绑定时间 | 是否主设备 | 在线状态 | 操作 |
+|--------|------|----------|----------|----------|----------|------------|----------|------|
+| ☐ | 1 | AJY001 | 艾灸椅-001 | AJY-2026 | 2026-03-15 | 是 | 在线 | 设为主设备/解绑 |
+| ☐ | 2 | AJY002 | 艾灸椅-002 | AJY-2026 | 2026-03-18 | 否 | 离线 | 设为主设备/解绑 |
+
+**操作按钮**:
+| 按钮 | 功能说明 |
+|------|----------|
+| 添加设备 | 从设备列表选择设备绑定到该用户 |
+| 批量解绑 | 选中多条记录后批量解除绑定(需二次确认) |
+| 返回 | 返回用户列表 |

+ 70 - 0
openspec/穴位管理.md

@@ -0,0 +1,70 @@
+### 7.2 穴位管理
+
+#### 功能说明
+
+管理员维护系统穴位库,包括基础穴位信息(穴位名称、经络、功效、定位参数)和艾灸手法(一键艾灸、温和灸、雀啄灸、回旋灸等)。支持新增穴位、编辑穴位信息、设置穴位定位参数。专家方案中出现的新穴位会自动添加(状态:待完善),管理员需补充完善穴位信息后方可正式启用。
+
+**使用角色**:系统管理员
+
+**使用场景**:
+- 管理员维护基础穴位库(12个常用穴位)
+- 管理员审核自动新增的穴位(待完善状态),补充经络、功效、定位参数
+- 管理员配置艾灸手法参数(温度范围、运动模式)
+- 管理员扩展新增穴位以支持更多治疗方案
+
+---
+
+#### 穴位列表
+
+| 多选框 | 序号 | 穴位ID | 穴位名称 | 所属经络 | 功效 | 定位方式 | 状态 | 操作 |
+|--------|------|--------|----------|----------|------|----------|------|------|
+| ☐ | 1 | dazhui | 大椎穴 | 督脉 | 驱寒、祛湿 | 相对定位 | 活跃 | 查看/编辑/删除 |
+| ☐ | 2 | fengmen | 风门穴 | 足太阳膀胱经 | 祛风解表 | 相对定位 | 活跃 | 查看/编辑/删除 |
+| ☐ | 3 | weizhong | 委中穴 | - | 待完善 | 待完善 | 待完善 | 完善/编辑/删除 |
+
+#### 列表查询条件
+
+| 查询字段 | 类型 | 说明 |
+|----------|------|------|
+| 穴位名称 | 文本输入 | 支持模糊搜索 |
+| 所属经络 | 下拉选择 | 全部 / 督脉 / 足太阳膀胱经 / 手太阳小肠经 / 其他 |
+| 定位方式 | 下拉选择 | 全部 / 相对定位 / 绝对定位 |
+| 状态 | 下拉选择 | 全部 / 活跃 / 待完善 |
+
+**查询规则**:
+- 点击【查询】按钮:根据输入条件筛选列表
+- 点击【重置】按钮:清空所有查询条件
+
+#### 列表操作按钮
+
+| 按钮 | 功能说明 |
+|------|----------|
+| 导入 | 批量导入穴位数据(提供Excel模板下载) |
+| 导出 | 导出穴位库数据为Excel文件 |
+| 新增 | 进入新增穴位界面 |
+| 批量删除 | 选中多条记录后批量删除(需二次确认) |
+
+#### 新增/编辑操作
+
+**新增穴位表单字段**:
+
+| 字段名 | 类型 | 必填 | 验证规则 | 说明 |
+|--------|------|------|----------|------|
+| 穴位名称 | 文本 | 是 | 最长50字符 | 如:合谷穴 |
+| 所属经络 | 下拉选择 | 是 | 从经络库选择 | 督脉/膀胱经/小肠经/胃经/其他 |
+| 功效描述 | 多选标签 | 是 | 至少选1项 | 驱寒/祛湿/祛风/化瘀/活血/化痰/养颜/扶阳 |
+| 定位方式 | 单选 | 是 | 相对定位 / 绝对定位 | - |
+| 相对大椎穴纵向偏移 | 数字 | 定位方式为相对时必填 | - | 单位:寸(一寸类型) |
+| 相对大椎穴横向偏移 | 数字 | 否 | - | 单位:寸(一寸类型),双侧穴位必填 |
+| 侧别 | 单选 | 是 | 中心 / 左侧 / 右侧 / 双侧 | - |
+| 指寸类型 | 下拉选择 | 定位方式为相对时必填 | 一寸 / 1.5寸 / 三寸 | - |
+| 绝对坐标X | 数字 | 定位方式为绝对时必填 | - | 单位:mm |
+| 绝对坐标Y | 数字 | 定位方式为绝对时必填 | - | 单位:mm |
+| 绝对坐标Z | 数字 | 定位方式为绝对时必填 | - | 单位:mm |
+| 适用性别 | 单选 | 是 | 不限 / 仅男 / 仅女 | - |
+
+**操作按钮**:
+| 按钮 | 功能说明 |
+|------|----------|
+| 保存 | 保存穴位信息 |
+| 取消 | 放弃编辑,返回列表 |

+ 31 - 0
openspec/艾灸手法管理.md

@@ -0,0 +1,31 @@
+#### 艾灸手法列表
+
+| 多选框 | 序号 | 手法ID | 手法名称 | 运动模式 | 温度范围 | 时间范围 | 状态 | 操作 |
+|--------|------|--------|----------|----------|----------|----------|------|------|
+| ☐ | 1 | oneclick | 一键艾灸 | 默认工艺 | 42-45°C | 30分钟 | 启用 | 编辑/禁用 |
+| ☐ | 2 | gentle | 温和灸 | 固定不动 | 35-50°C | 1-30分钟 | 启用 | 编辑/禁用 |
+| ☐ | 3 | pecking | 雀啄灸 | 上下移动 | 35-50°C | 1-30分钟 | 启用 | 编辑/禁用 |
+| ☐ | 4 | circular | 回旋灸 | 圆周运动 | 35-50°C | 1-30分钟 | 启用 | 编辑/禁用 |
+| ☐ | 5 | sparrow | 麻雀灸 | 点状移动 | 35-50°C | 1-30分钟 | 启用 | 编辑/禁用 |
+
+#### 新增/编辑艾灸手法表单
+
+| 字段名 | 类型 | 必填 | 验证规则 | 说明 |
+|--------|------|------|----------|------|
+| 手法名称 | 文本 | 是 | 最长50字符 | - |
+| 运动模式 | 下拉选择 | 是 | 固定不动 / 上下移动 / 圆周运动 / 点状移动 | - |
+| 温度范围最小值 | 数字 | 是 | 35-50°C | - |
+| 温度范围最大值 | 数字 | 是 | ≥最小值,35-50°C | - |
+| 时间范围最小值 | 数字 | 是 | 1-30分钟 | - |
+| 时间范围最大值 | 数字 | 是 | ≥最小值,1-30分钟 | - |
+| 运动幅度 | 数字 | 否 | 1-20mm | 运动模式非"固定不动"时必填 |
+| 运动速度 | 数字 | 否 | 1-10mm/s | 运动模式非"固定不动"时必填 |
+| 状态 | 单选 | 是 | 启用 / 禁用 | - |
+| 备注 | 文本域 | 否 | 最长200字符 | - |
+
+**操作按钮**:
+| 按钮 | 功能说明 |
+|------|----------|
+| 保存 | 保存手法配置 |
+| 取消 | 放弃编辑,返回列表 |
+注意:删除是软删除

+ 2 - 1
openspec/规范说明.md

@@ -1,4 +1,4 @@
-# 爱久医管理后台 — 框架规范说明
+# 艾灸椅管理后台 — 框架规范说明
 
 > 本文档供 AI 写代码时遵循,描述框架封装位置和编码规范。
 
@@ -399,3 +399,4 @@ LogAspect 异步保存操作日志到 sys_log 表
     ↓
 TokenInterceptor afterCompletion(清理 ThreadLocal + MDC)
 ```
+所有涉及数据库删除都是软删除

+ 93 - 0
openspec/设备管理和用户设备管理.md

@@ -0,0 +1,93 @@
+---
+
+###  设备管理
+
+#### 功能说明
+
+管理员管理艾灸椅设备信息,包括设备绑定用户(支持多用户绑定)、设备状态监控、设备固件版本管理。支持设备的新增、编辑、删除,以及查看设备与用户的多对多绑定关系。一个设备可以被多个用户绑定使用,一个用户也可以绑定多个设备。
+
+**使用角色**:系统管理员
+
+**使用场景**:
+- 管理员绑定设备与用户关系(支持一个设备绑定多个用户)
+- 管理员查看设备在线状态
+- 管理员管理设备固件版本
+- 管理员查看设备关联的用户列表
+
+---
+
+#### 设备列表
+
+| 多选框 | 序号 | 设备编号 | 设备名称 | 设备型号 | 绑定用户数 | 绑定用户列表 | 在线状态 | 固件版本 | 最后在线时间 | 操作 |
+|--------|------|----------|----------|----------|------------|--------------|----------|----------|--------------|------|
+| ☐ | 1 | AJY001 | 艾灸椅-001 | AJY-2026 | 2 | 张三、李四 | 在线 | v1.2.0 | 2026-04-01 | 查看/编辑/用户管理 |
+| ☐ | 2 | AJY002 | 艾灸椅-002 | AJY-2026 | 1 | 王五 | 离线 | v1.1.0 | 2026-03-30 | 查看/编辑/用户管理 |
+
+#### 列表查询条件
+
+| 查询字段 | 类型 | 说明 |
+|----------|------|------|
+| 设备编号 | 文本输入 | 支持模糊搜索,设备编号为主键 |
+| 设备名称 | 文本输入 | 支持模糊搜索 |
+| 绑定用户 | 文本输入 | 支持模糊搜索,可查询该设备关联的所有用户 |
+| 在线状态 | 下拉选择 | 全部 / 在线 / 离线 |
+| 固件版本 | 下拉选择 | 全部 / v1.2.0 / v1.1.0 |
+
+**查询规则**:
+- 点击【查询】按钮:根据输入条件筛选列表
+- 点击【重置】按钮:清空所有查询条件
+
+#### 列表操作按钮
+
+| 按钮 | 功能说明 |
+|------|----------|
+| 导入 | 批量导入设备信息 |
+| 导出 | 导出设备列表为Excel文件 |
+| 新增 | 进入新增设备界面 |
+| 批量删除 | 选中多条记录后批量删除(需二次确认) |
+| 用户管理 | 管理设备绑定的用户列表(支持多用户绑定) |
+
+#### 新增/编辑操作
+
+**新增设备表单字段**:
+
+| 字段名 | 类型 | 必填 | 验证规则 | 说明 |
+|--------|------|------|----------|------|
+| 设备编号 | 文本 | 是 | 唯一值,如AJY001 | 设备编号为主键,不可修改 |
+| 设备名称 | 文本 | 是 | 最长100字符 | 如:艾灸椅-001 |
+| 设备型号 | 下拉选择 | 是 | AJY-2026 / AJY-2025 | - |
+| 设备序列号 | 文本 | 是 | 唯一值,最长50字符 | 设备唯一标识 |
+| 绑定用户 | 多选下拉 | 否 | 从用户列表选择,可多选 | 支持一个设备绑定多个用户 |
+| 固件版本 | 文本 | 是 | 如:v1.2.0 | - |
+| 备注 | 文本域 | 否 | 最长200字符 | - |
+
+**操作按钮**:
+| 按钮 | 功能说明 |
+|------|----------|
+| 保存 | 保存设备信息 |
+| 取消 | 放弃编辑,返回列表 |
+| 用户管理 | 管理该设备绑定的用户列表(添加/移除用户) |
+
+---
+
+#### 设备用户管理(独立页面)
+
+**功能说明**:管理单个设备绑定的用户列表,支持添加用户、移除用户、设置主用户。
+
+**用户列表**:
+
+| 多选框 | 序号 | 用户ID | 用户姓名 | 手机号 | 绑定时间 | 是否主用户 | 操作 |
+|--------|------|--------|----------|--------|----------|------------|------|
+| ☐ | 1 | U001 | 张三 | 138****1234 | 2026-03-15 | 是 | 设为主用户/解绑 |
+| ☐ | 2 | U002 | 李四 | 139****5678 | 2026-03-18 | 否 | 设为主用户/解绑 |
+
+**操作按钮**:
+| 按钮 | 功能说明 |
+|------|----------|
+| 添加用户 | 从用户列表选择用户绑定到该设备 |
+| 批量解绑 | 选中多条记录后批量解除绑定(需二次确认) |
+| 返回 | 返回设备列表 |
+
+---
+
+注意:用户指的是user_profile

+ 426 - 310
需求工作区/需求设计文档/智能穴位定位系统设计文档.md

@@ -199,10 +199,10 @@
 │   └── 四种艾灸模式接口
 │
 └── 4. 专家端(小程序/公众号)
-    ├── 专家登录
-    ├── 方案创建(使用系统模板)
-    ├── 工艺语言生成
-    └── 方案发布(指定用户/公开)
+├── 专家登录
+├── 方案创建(使用系统模板)
+├── 工艺语言生成
+└── 方案发布(指定用户/公开)
 
 ### 3.5 专家方案模板设计
 
@@ -251,19 +251,19 @@
 
 ```typescript
 interface TemplateValidation {
-  // 基本信息验证
-  name: { required: true; maxLength: 50 };
-  efficacyType: { required: true; options: ['驱寒','祛湿','祛风','化瘀','活血','化痰','养颜','扶阳'] };
-  symptoms: { required: true; minSelect: 1 };
-  targetGender: { required: true; options: ['all','male','female'] };
-  ageRange: { required: true; min: 1; max: 120 };
-  
-  // 步骤验证
-  minSteps: 1;
-  maxSteps: 10;
-  temperature: { min: 35; max: 50; unit: '°C' };
-  duration: { min: 1; max: 30; unit: '分钟' };
-  totalDurationLimit: 60;  // 总时长限制(分钟)
+    // 基本信息验证
+    name: { required: true; maxLength: 50 };
+    efficacyType: { required: true; options: ['驱寒','祛湿','祛风','化瘀','活血','化痰','养颜','扶阳'] };
+    symptoms: { required: true; minSelect: 1 };
+    targetGender: { required: true; options: ['all','male','female'] };
+    ageRange: { required: true; min: 1; max: 120 };
+
+    // 步骤验证
+    minSteps: 1;
+    maxSteps: 10;
+    temperature: { min: 35; max: 50; unit: '°C' };
+    duration: { min: 1; max: 30; unit: '分钟' };
+    totalDurationLimit: 60;  // 总时长限制(分钟)
 }
 ```
 
@@ -309,36 +309,36 @@ interface TemplateValidation {
 ```typescript
 // 延年圣手模式 - 用户级存储
 interface ExpertModeStorage {
-  userId: string;
-  schemes: ExpertScheme[];        // 用户接收的专家方案列表(可超过8个)
-  syncedSchemes: SyncedScheme[];  // 同步到设备的最新8个方案
-  updatedAt: Date;
+    userId: string;
+    schemes: ExpertScheme[];        // 用户接收的专家方案列表(可超过8个)
+    syncedSchemes: SyncedScheme[];  // 同步到设备的最新8个方案
+    updatedAt: Date;
 }
 
 // 同步到设备的方案(最新8个)
 interface SyncedScheme {
-  slot: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;  // 快捷键槽位(1-8)
-  schemeId: string;
-  schemeName: string;
-  processId: string;             // 对应工艺语言ID
-  syncedAt: Date;
+    slot: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;  // 快捷键槽位(1-8)
+    schemeId: string;
+    schemeName: string;
+    processId: string;             // 对应工艺语言ID
+    syncedAt: Date;
 }
 
 // 设备快捷键映射
 interface DeviceHotkeyMap {
-  userId: string;
-  deviceId: string;
-  hotkeys: {
-    '1': { schemeId: string; schemeName: string };  // 快捷键1
-    '2': { schemeId: string; schemeName: string };  // 快捷键2
-    '3': { schemeId: string; schemeName: string };  // 快捷键3
-    '4': { schemeId: string; schemeName: string };  // 快捷键4
-    '5': { schemeId: string; schemeName: string };  // 快捷键5
-    '6': { schemeId: string; schemeName: string };  // 快捷键6
-    '7': { schemeId: string; schemeName: string };  // 快捷键7
-    '8': { schemeId: string; schemeName: string };  // 快捷键8
-  };
-  updatedAt: Date;
+    userId: string;
+    deviceId: string;
+    hotkeys: {
+        '1': { schemeId: string; schemeName: string };  // 快捷键1
+        '2': { schemeId: string; schemeName: string };  // 快捷键2
+        '3': { schemeId: string; schemeName: string };  // 快捷键3
+        '4': { schemeId: string; schemeName: string };  // 快捷键4
+        '5': { schemeId: string; schemeName: string };  // 快捷键5
+        '6': { schemeId: string; schemeName: string };  // 快捷键6
+        '7': { schemeId: string; schemeName: string };  // 快捷键7
+        '8': { schemeId: string; schemeName: string };  // 快捷键8
+    };
+    updatedAt: Date;
 }
 ```
 
@@ -455,26 +455,26 @@ interface DeviceHotkeyMap {
 ```typescript
 // 专家端方案推送格式
 interface ExpertSchemePush {
-  expertId: string;              // 专家ID(由专家端系统分配)
-  expertName: string;            // 专家名称
-  schemeName: string;            // 方案名称
-  efficacyType: string;          // 功效类型
-  symptoms: string[];            // 适用症状
-  targetGender: 'male' | 'female' | 'all';
-  ageRange: { min: number; max: number };
-  steps: ExpertStep[];           // 治疗步骤
-  publishType: 'public' | 'private';
-  targetUserIds?: string[];      // 指定用户(私有发布时)
+    expertId: string;              // 专家ID(由专家端系统分配)
+    expertName: string;            // 专家名称
+    schemeName: string;            // 方案名称
+    efficacyType: string;          // 功效类型
+    symptoms: string[];            // 适用症状
+    targetGender: 'male' | 'female' | 'all';
+    ageRange: { min: number; max: number };
+    steps: ExpertStep[];           // 治疗步骤
+    publishType: 'public' | 'private';
+    targetUserIds?: string[];      // 指定用户(私有发布时)
 }
 
 // 专家端治疗步骤
 interface ExpertStep {
-  stepOrder: number;
-  acupointName: string;          // 穴位名称
-  temperature: number;           // 温度
-  duration: number;              // 时间(分钟)
-  techniqueName: string;         // 手法名称
-  side: 'single' | 'both' | 'left' | 'right';
+    stepOrder: number;
+    acupointName: string;          // 穴位名称
+    temperature: number;           // 温度
+    duration: number;              // 时间(分钟)
+    techniqueName: string;         // 手法名称
+    side: 'single' | 'both' | 'left' | 'right';
 }
 ```
 
@@ -551,46 +551,46 @@ interface ExpertStep {
 
 ```typescript
 function estimateFingerWidth(
-  shoulderWidth: number,
-  bodyLength: number,
-  gender: 'male' | 'female'
+    shoulderWidth: number,
+    bodyLength: number,
+    gender: 'male' | 'female'
 ): FingerWidth {
-  const STANDARD = {
-    male: {
-      shoulderWidth: 42,      // 男性平均肩宽(厘米)
-      bodyLength: 85,         // 男性平均坐高(厘米)
-      cun1: 2.2,              // 男性一寸约2.2cm
-      cun1_5: 3.3,            // 男性1.5寸约3.3cm
-      cun3: 6.5,              // 男性三寸约6.5cm
-      shoulderWeight: 0.6,    // 肩宽权重
-      lengthWeight: 0.4       // 身长权重
-    },
-    female: {
-      shoulderWidth: 36,      // 女性平均肩宽(厘米)
-      bodyLength: 78,         // 女性平均坐高(厘米)
-      cun1: 1.9,              // 女性一寸约1.9cm
-      cun1_5: 2.8,            // 女性1.5寸约2.8cm
-      cun3: 5.6,              // 女性三寸约5.6cm
-      shoulderWeight: 0.4,    // 肩宽权重
-      lengthWeight: 0.6       // 身长权重
-    }
-  };
-
-  const ref = STANDARD[gender];
-  const widthScale = shoulderWidth / ref.shoulderWidth;
-  const lengthScale = bodyLength / ref.bodyLength;
-  
-  const weightedScale = 
-    widthScale * ref.shoulderWeight + 
-    lengthScale * ref.lengthWeight;
-
-  const estimatedCun1 = ref.cun1 * weightedScale;
-  
-  return {
-    cun1: estimatedCun1,
-    cun1_5: estimatedCun1 * 1.5,
-    cun3: estimatedCun1 * 3
-  };
+    const STANDARD = {
+        male: {
+            shoulderWidth: 42,      // 男性平均肩宽(厘米)
+            bodyLength: 85,         // 男性平均坐高(厘米)
+            cun1: 2.2,              // 男性一寸约2.2cm
+            cun1_5: 3.3,            // 男性1.5寸约3.3cm
+            cun3: 6.5,              // 男性三寸约6.5cm
+            shoulderWeight: 0.6,    // 肩宽权重
+            lengthWeight: 0.4       // 身长权重
+        },
+        female: {
+            shoulderWidth: 36,      // 女性平均肩宽(厘米)
+            bodyLength: 78,         // 女性平均坐高(厘米)
+            cun1: 1.9,              // 女性一寸约1.9cm
+            cun1_5: 2.8,            // 女性1.5寸约2.8cm
+            cun3: 5.6,              // 女性三寸约5.6cm
+            shoulderWeight: 0.4,    // 肩宽权重
+            lengthWeight: 0.6       // 身长权重
+        }
+    };
+
+    const ref = STANDARD[gender];
+    const widthScale = shoulderWidth / ref.shoulderWidth;
+    const lengthScale = bodyLength / ref.bodyLength;
+
+    const weightedScale =
+        widthScale * ref.shoulderWeight +
+        lengthScale * ref.lengthWeight;
+
+    const estimatedCun1 = ref.cun1 * weightedScale;
+
+    return {
+        cun1: estimatedCun1,
+        cun1_5: estimatedCun1 * 1.5,
+        cun3: estimatedCun1 * 3
+    };
 }
 ```
 
@@ -598,45 +598,45 @@ function estimateFingerWidth(
 
 ```typescript
 function generateAcupointReferenceTable(
-  bodyData: UserBodyData,
-  gender: 'male' | 'female'
+    bodyData: UserBodyData,
+    gender: 'male' | 'female'
 ): AcupointReferenceTable {
-  const { shoulderWidth, bodyLength, fingerWidth } = bodyData;
-
-  // 获取或估算指寸
-  const cun: FingerWidth = fingerWidth 
-    ? fingerWidth 
-    : estimateFingerWidth(shoulderWidth, bodyLength, gender);
-
-  // 计算各穴位位置
-  const acupoints: CalculatedAcupoint[] = ACUPOINT_OFFSETS.map(ap => {
-    // Y方向偏移:指寸数 × 对应指寸值
-    const distanceY = ap.cun * cun[ap.cunType];
-
-    // X方向偏移:横向指寸 × 一寸值
-    const distanceX = ap.side === 'center' 
-      ? 0 
-      : (ap.side === 'left' ? -1 : 1) * (ap.lateralOffset || 0) * cun.cun1;
+    const { shoulderWidth, bodyLength, fingerWidth } = bodyData;
+
+    // 获取或估算指寸
+    const cun: FingerWidth = fingerWidth
+        ? fingerWidth
+        : estimateFingerWidth(shoulderWidth, bodyLength, gender);
+
+    // 计算各穴位位置
+    const acupoints: CalculatedAcupoint[] = ACUPOINT_OFFSETS.map(ap => {
+        // Y方向偏移:指寸数 × 对应指寸值
+        const distanceY = ap.cun * cun[ap.cunType];
+
+        // X方向偏移:横向指寸 × 一寸值
+        const distanceX = ap.side === 'center'
+            ? 0
+            : (ap.side === 'left' ? -1 : 1) * (ap.lateralOffset || 0) * cun.cun1;
+
+        return {
+            id: ap.id + (ap.side !== 'center' ? '_' + ap.side : ''),
+            name: ap.name,
+            side: ap.side,
+            offsetFromDazhui: {
+                x: distanceX,
+                y: -distanceY  // 负值表示向下
+            },
+            offsetInCun: ap.cun,
+            cunType: ap.cunType
+        };
+    });
 
     return {
-      id: ap.id + (ap.side !== 'center' ? '_' + ap.side : ''),
-      name: ap.name,
-      side: ap.side,
-      offsetFromDazhui: {
-        x: distanceX,
-        y: -distanceY  // 负值表示向下
-      },
-      offsetInCun: ap.cun,
-      cunType: ap.cunType
+        bodyData,
+        fingerWidthUsed: cun,
+        acupoints,
+        createdAt: new Date()
     };
-  });
-
-  return {
-    bodyData,
-    fingerWidthUsed: cun,
-    acupoints,
-    createdAt: new Date()
-  };
 }
 ```
 
@@ -689,66 +689,66 @@ function generateAcupointReferenceTable(
  */
 
 interface DeviceCoordinate {
-  x: number;  // 横向偏移(mm)
-  y: number;  // 纵向偏移(mm)
-  z: number;  // 深度偏移(mm)
+    x: number;  // 横向偏移(mm)
+    y: number;  // 纵向偏移(mm)
+    z: number;  // 深度偏移(mm)
 }
 
 interface AcupointOffset {
-  x: number;  // 相对大椎穴横向偏移(cm)
-  y: number;  // 相对大椎穴纵向偏移(cm)
+    x: number;  // 相对大椎穴横向偏移(cm)
+    y: number;  // 相对大椎穴纵向偏移(cm)
 }
 
 /**
  * 将穴位相对偏移转换为设备坐标
  * 注意:此算法在设备端执行
- * 
+ *
  * @param dazhuiPosition 设备传感器检测的大椎穴位置(设备坐标系,mm)
  * @param acupointOffset 穴位相对偏移(相对大椎穴,cm)
  * @param userBodyData 用户体型数据(用于精度修正)
  * @returns 穴位在设备坐标系中的位置(mm)
  */
 function convertToDeviceCoordinate(
-  dazhuiPosition: DeviceCoordinate,
-  acupointOffset: AcupointOffset,
-  userBodyData: UserBodyData
+    dazhuiPosition: DeviceCoordinate,
+    acupointOffset: AcupointOffset,
+    userBodyData: UserBodyData
 ): DeviceCoordinate {
-  // 将厘米转换为毫米
-  const offsetXmm = acupointOffset.x * 10;
-  const offsetYmm = acupointOffset.y * 10;
-  
-  // 坐标转换
-  // 注意:人体坐标系Y轴向下为负,设备坐标系Y轴向下为正
-  return {
-    x: dazhuiPosition.x + offsetXmm,
-    y: dazhuiPosition.y - offsetYmm,  // 转换方向
-    z: dazhuiPosition.z  // 深度通常不变
-  };
+    // 将厘米转换为毫米
+    const offsetXmm = acupointOffset.x * 10;
+    const offsetYmm = acupointOffset.y * 10;
+
+    // 坐标转换
+    // 注意:人体坐标系Y轴向下为负,设备坐标系Y轴向下为正
+    return {
+        x: dazhuiPosition.x + offsetXmm,
+        y: dazhuiPosition.y - offsetYmm,  // 转换方向
+        z: dazhuiPosition.z  // 深度通常不变
+    };
 }
 
 /**
  * 批量转换所有穴位坐标
- * 
+ *
  * @param dazhuiPosition 设备传感器检测的大椎穴位置
  * @param acupointTable 用户穴位对照表(相对偏移)
  * @returns 所有穴位在设备坐标系中的位置
  */
 function convertAllAcupoints(
-  dazhuiPosition: DeviceCoordinate,
-  acupointTable: AcupointReferenceTable
+    dazhuiPosition: DeviceCoordinate,
+    acupointTable: AcupointReferenceTable
 ): Map<string, DeviceCoordinate> {
-  const positions = new Map<string, DeviceCoordinate>();
-  
-  for (const acupoint of acupointTable.acupoints) {
-    const deviceCoord = convertToDeviceCoordinate(
-      dazhuiPosition,
-      acupoint.offsetFromDazhui,
-      acupointTable.bodyData
-    );
-    positions.set(acupoint.id, deviceCoord);
-  }
-  
-  return positions;
+    const positions = new Map<string, DeviceCoordinate>();
+
+    for (const acupoint of acupointTable.acupoints) {
+        const deviceCoord = convertToDeviceCoordinate(
+            dazhuiPosition,
+            acupoint.offsetFromDazhui,
+            acupointTable.bodyData
+        );
+        positions.set(acupoint.id, deviceCoord);
+    }
+
+    return positions;
 }
 ```
 
@@ -806,54 +806,54 @@ function convertAllAcupoints(
 
 ```typescript
 interface UserProfile {
-  id: string;
-  name: string;
-  gender: 'male' | 'female';
-  age: number;
-  phone: string;
-  bodyData: {
-    shoulderWidth: number;     // 肩宽(厘米)
-    bodyLength: number;        // 身长(厘米)
-    fingerWidth?: {
-      cun1: number;            // 一寸
-      cun1_5: number;          // 1.5寸
-      cun3: number;            // 三寸
+    id: string;
+    name: string;
+    gender: 'male' | 'female';
+    age: number;
+    phone: string;
+    bodyData: {
+        shoulderWidth: number;     // 肩宽(厘米)
+        bodyLength: number;        // 身长(厘米)
+        fingerWidth?: {
+            cun1: number;            // 一寸
+            cun1_5: number;          // 1.5寸
+            cun3: number;            // 三寸
+        };
     };
-  };
-  fingerprints: string[];      // 指纹ID列表
-  devices: DeviceBinding[];    // 关联的设备列表(多对多)
-  createdAt: Date;
-  updatedAt: Date;
+    fingerprints: string[];      // 指纹ID列表
+    devices: DeviceBinding[];    // 关联的设备列表(多对多)
+    createdAt: Date;
+    updatedAt: Date;
 }
 
 // 用户-设备绑定关系
 interface DeviceBinding {
-  deviceId: string;            // 设备编号(主键)
-  deviceName: string;          // 设备名称
-  boundAt: Date;               // 绑定时间
-  isPrimary: boolean;          // 是否为主设备
+    deviceId: string;            // 设备编号(主键)
+    deviceName: string;          // 设备名称
+    boundAt: Date;               // 绑定时间
+    isPrimary: boolean;          // 是否为主设备
 }
 
 // 设备信息
 interface Device {
-  deviceId: string;            // 设备编号(主键,如:AJY001)
-  deviceName: string;          // 设备名称
-  model: string;               // 设备型号
-  serialNumber: string;        // 设备序列号(唯一标识)
-  firmwareVersion: string;     // 固件版本
-  status: 'online' | 'offline'; // 在线状态
-  users: UserBinding[];        // 关联的用户列表(多对多)
-  lastOnlineAt: Date;          // 最后在线时间
-  createdAt: Date;
-  updatedAt: Date;
+    deviceId: string;            // 设备编号(主键,如:AJY001)
+    deviceName: string;          // 设备名称
+    model: string;               // 设备型号
+    serialNumber: string;        // 设备序列号(唯一标识)
+    firmwareVersion: string;     // 固件版本
+    status: 'online' | 'offline'; // 在线状态
+    users: UserBinding[];        // 关联的用户列表(多对多)
+    lastOnlineAt: Date;          // 最后在线时间
+    createdAt: Date;
+    updatedAt: Date;
 }
 
 // 设备-用户绑定关系
 interface UserBinding {
-  userId: string;              // 用户ID
-  userName: string;            // 用户姓名
-  boundAt: Date;               // 绑定时间
-  isPrimary: boolean;          // 是否为主用户
+    userId: string;              // 用户ID
+    userName: string;            // 用户姓名
+    boundAt: Date;               // 绑定时间
+    isPrimary: boolean;          // 是否为主用户
 }
 ```
 
@@ -862,41 +862,41 @@ interface UserBinding {
 ```typescript
 // 穴位基础信息
 interface Acupoint {
-  id: string;
-  name: string;
-  meridian: string;            // 所属经络
-  efficacy: string[];          // 功效列表
-  positioning: 'relative' | 'absolute';  // 定位方式
-  offset?: {                   // 相对定位偏移
-    cun: number;
-    cunType: 'cun1' | 'cun1_5' | 'cun3';
-    side: 'center' | 'left' | 'right';
-    lateralOffset?: number;
-  };
-  absolutePosition?: {         // 绝对定位坐标
-    x: number;
-    y: number;
-    z: number;
-  };
-  status: 'active' | 'pending';  // 状态
-  source: 'preset' | 'expert';   // 数据来源
-  createdAt: Date;
-  updatedAt: Date;
+    id: string;
+    name: string;
+    meridian: string;            // 所属经络
+    efficacy: string[];          // 功效列表
+    positioning: 'relative' | 'absolute';  // 定位方式
+    offset?: {                   // 相对定位偏移
+        cun: number;
+        cunType: 'cun1' | 'cun1_5' | 'cun3';
+        side: 'center' | 'left' | 'right';
+        lateralOffset?: number;
+    };
+    absolutePosition?: {         // 绝对定位坐标
+        x: number;
+        y: number;
+        z: number;
+    };
+    status: 'active' | 'pending';  // 状态
+    source: 'preset' | 'expert';   // 数据来源
+    createdAt: Date;
+    updatedAt: Date;
 }
 
 // 艾灸手法
 interface MoxaTechnique {
-  id: string;
-  name: string;                // 手法名称(一键艾灸[默认]、温和灸、雀啄灸、回旋灸)
-  isDefault: boolean;          // 是否为默认手法(一键艾灸为默认)
-  description: string;         // 手法描述
-  parameters: {
-    temperatureRange: { min: number; max: number };  // 温度范围
-    durationRange: { min: number; max: number };     // 时间范围(秒)
-    movementPattern: 'fixed' | 'vertical' | 'circular' | 'oneclick';  // 运动模式
-  };
-  createdAt: Date;
-  updatedAt: Date;
+    id: string;
+    name: string;                // 手法名称(一键艾灸[默认]、温和灸、雀啄灸、回旋灸)
+    isDefault: boolean;          // 是否为默认手法(一键艾灸为默认)
+    description: string;         // 手法描述
+    parameters: {
+        temperatureRange: { min: number; max: number };  // 温度范围
+        durationRange: { min: number; max: number };     // 时间范围(秒)
+        movementPattern: 'fixed' | 'vertical' | 'circular' | 'oneclick';  // 运动模式
+    };
+    createdAt: Date;
+    updatedAt: Date;
 }
 ```
 
@@ -904,23 +904,23 @@ interface MoxaTechnique {
 
 ```typescript
 interface AcupointReferenceTable {
-  userId: string;
-  bodyData: UserBodyData;
-  fingerWidthUsed: FingerWidth;
-  acupoints: CalculatedAcupoint[];
-  createdAt: Date;
+    userId: string;
+    bodyData: UserBodyData;
+    fingerWidthUsed: FingerWidth;
+    acupoints: CalculatedAcupoint[];
+    createdAt: Date;
 }
 
 interface CalculatedAcupoint {
-  id: string;
-  name: string;
-  side: 'center' | 'left' | 'right';
-  offsetFromDazhui: {
-    x: number;          // 相对大椎穴的横向偏移(厘米)
-    y: number;          // 相对大椎穴的纵向偏移(厘米)
-  };
-  offsetInCun: number;
-  cunType: 'cun1' | 'cun1_5' | 'cun3';
+    id: string;
+    name: string;
+    side: 'center' | 'left' | 'right';
+    offsetFromDazhui: {
+        x: number;          // 相对大椎穴的横向偏移(厘米)
+        y: number;          // 相对大椎穴的纵向偏移(厘米)
+    };
+    offsetInCun: number;
+    cunType: 'cun1' | 'cun1_5' | 'cun3';
 }
 ```
 
@@ -929,112 +929,112 @@ interface CalculatedAcupoint {
 ```typescript
 // 方案模式枚举
 enum SchemeMode {
-  ONE_CLICK = '一键艾灸',
-  PROFESSIONAL = '专业模式',
-  CUSTOM = '自定义模式',
-  EXPERT = '延年圣手模式'
+    ONE_CLICK = '一键艾灸',
+    PROFESSIONAL = '专业模式',
+    CUSTOM = '自定义模式',
+    EXPERT = '延年圣手模式'
 }
 
 // 用户模式存储(每个用户独立存储四种模式数据)
 interface UserModeStorage {
-  userId: string;
-  oneClickMode: OneClickScheme;          // 一键艾灸(默认工艺)
-  professionalMode: ProfessionalScheme[]; // 专业模式(8种功效)
-  customMode: CustomScheme[];            // 自定义模式
-  expertMode: ExpertModeStorage;         // 延年圣手模式(含8个同步方案)
-  updatedAt: Date;
+    userId: string;
+    oneClickMode: OneClickScheme;          // 一键艾灸(默认工艺)
+    professionalMode: ProfessionalScheme[]; // 专业模式(8种功效)
+    customMode: CustomScheme[];            // 自定义模式
+    expertMode: ExpertModeStorage;         // 延年圣手模式(含8个同步方案)
+    updatedAt: Date;
 }
 
 // 方案基础结构
 interface Scheme {
-  id: string;
-  schemeName: string;
-  mode: SchemeMode;
-  creatorType: 'admin' | 'user' | 'expert';  // 创作人类型
-  creatorId: string;          // 创作人ID(ADMIN/用户ID/专家ID)
-  creatorName: string;        // 创作人显示名称(ADMIN/用户姓名/专家姓名)
-  symptoms: string[];          // 适用症状
-  targetGender: 'male' | 'female' | 'all';
-  ageRange: { min: number; max: number };
-  steps: SchemeStep[];
-  status: 'draft' | 'published' | 'archived';
-  createdAt: Date;
-  updatedAt: Date;
+    id: string;
+    schemeName: string;
+    mode: SchemeMode;
+    creatorType: 'admin' | 'user' | 'expert';  // 创作人类型
+    creatorId: string;          // 创作人ID(ADMIN/用户ID/专家ID)
+    creatorName: string;        // 创作人显示名称(ADMIN/用户姓名/专家姓名)
+    symptoms: string[];          // 适用症状
+    targetGender: 'male' | 'female' | 'all';
+    ageRange: { min: number; max: number };
+    steps: SchemeStep[];
+    status: 'draft' | 'published' | 'archived';
+    createdAt: Date;
+    updatedAt: Date;
 }
 
 // 一键艾灸方案(默认艾灸工艺)
 interface OneClickScheme extends Scheme {
-  mode: SchemeMode.ONE_CLICK;
-  isDefault: true;             // 始终为true,是默认工艺
-  processId: string;           // 关联的工艺语言ID
+    mode: SchemeMode.ONE_CLICK;
+    isDefault: true;             // 始终为true,是默认工艺
+    processId: string;           // 关联的工艺语言ID
 }
 
 // 专业模式方案
 interface ProfessionalScheme extends Scheme {
-  mode: SchemeMode.PROFESSIONAL;
-  efficacyType: '驱寒' | '祛湿' | '祛风' | '化瘀' | '活血' | '化痰' | '养颜' | '扶阳';
+    mode: SchemeMode.PROFESSIONAL;
+    efficacyType: '驱寒' | '祛湿' | '祛风' | '化瘀' | '活血' | '化痰' | '养颜' | '扶阳';
 }
 
 // 自定义模式方案
 interface CustomScheme extends Scheme {
-  mode: SchemeMode.CUSTOM;
-  userId: string;              // 用户ID
-  isPersonal: boolean;         // 是否个人方案
+    mode: SchemeMode.CUSTOM;
+    userId: string;              // 用户ID
+    isPersonal: boolean;         // 是否个人方案
 }
 
 // 延年圣手模式方案(专家)
 interface ExpertScheme extends Scheme {
-  mode: SchemeMode.EXPERT;
-  expertId: string;            // 专家ID(来自专家端系统)
-  expertName: string;          // 专家名称
-  publishType: 'public' | 'private';  // 公开/指定
-  targetUsers?: string[];      // 指定用户ID列表
+    mode: SchemeMode.EXPERT;
+    expertId: string;            // 专家ID(来自专家端系统)
+    expertName: string;          // 专家名称
+    publishType: 'public' | 'private';  // 公开/指定
+    targetUsers?: string[];      // 指定用户ID列表
 }
 
 // 延年圣手模式存储(含8个同步方案到设备)
 interface ExpertModeStorage {
-  userId: string;
-  schemes: ExpertScheme[];                // 用户接收的所有专家方案
-  syncedSchemes: SyncedScheme[];          // 同步到设备的最新8个方案
-  updatedAt: Date;
+    userId: string;
+    schemes: ExpertScheme[];                // 用户接收的所有专家方案
+    syncedSchemes: SyncedScheme[];          // 同步到设备的最新8个方案
+    updatedAt: Date;
 }
 
 // 同步到设备的方案(最新8个,对应设备快捷键1-8)
 interface SyncedScheme {
-  slot: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;  // 快捷键槽位(1-8)
-  schemeId: string;                        // 方案ID
-  schemeName: string;                      // 方案名称
-  processId: string;                       // 关联工艺语言ID
-  syncedAt: Date;                          // 同步时间
+    slot: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;  // 快捷键槽位(1-8)
+    schemeId: string;                        // 方案ID
+    schemeName: string;                      // 方案名称
+    processId: string;                       // 关联工艺语言ID
+    syncedAt: Date;                          // 同步时间
 }
 
 // 设备快捷键映射(推送到设备的数据结构)
 interface DeviceHotkeyMap {
-  userId: string;
-  deviceId: string;
-  hotkeys: {
-    '1': { schemeId: string; schemeName: string; processId: string };
-    '2': { schemeId: string; schemeName: string; processId: string };
-    '3': { schemeId: string; schemeName: string; processId: string };
-    '4': { schemeId: string; schemeName: string; processId: string };
-    '5': { schemeId: string; schemeName: string; processId: string };
-    '6': { schemeId: string; schemeName: string; processId: string };
-    '7': { schemeId: string; schemeName: string; processId: string };
-    '8': { schemeId: string; schemeName: string; processId: string };
-  };
-  updatedAt: Date;
+    userId: string;
+    deviceId: string;
+    hotkeys: {
+        '1': { schemeId: string; schemeName: string; processId: string };
+        '2': { schemeId: string; schemeName: string; processId: string };
+        '3': { schemeId: string; schemeName: string; processId: string };
+        '4': { schemeId: string; schemeName: string; processId: string };
+        '5': { schemeId: string; schemeName: string; processId: string };
+        '6': { schemeId: string; schemeName: string; processId: string };
+        '7': { schemeId: string; schemeName: string; processId: string };
+        '8': { schemeId: string; schemeName: string; processId: string };
+    };
+    updatedAt: Date;
 }
 
 // 方案步骤
 interface SchemeStep {
-  stepOrder: number;
-  acupointId: string;
-  acupointName: string;
-  sides?: ('left' | 'right')[];  // 双侧穴位
-  temperature: number;
-  duration: number;            // 秒
-  techniqueId: string;         // 艾灸手法ID(含 oneclick)
-  techniqueName: string;       // 手法名称(一键艾灸、温和灸、雀啄灸、回旋灸)
+    stepOrder: number;
+    acupointId: string;
+    acupointName: string;
+    sides?: ('left' | 'right')[];  // 双侧穴位
+    temperature: number;
+    duration: number;            // 秒
+    techniqueId: string;         // 艾灸手法ID(含 oneclick)
+    techniqueName: string;       // 手法名称(一键艾灸、温和灸、雀啄灸、回旋灸)
 }
 ```
 
@@ -1250,6 +1250,122 @@ interface SchemeStep {
 
 ---
 
+#### 用户穴位表(数据库层)
+
+**功能说明**:用户穴位表根据穴位管理中维护的穴位信息,自动按照每个用户生成对应的穴位坐标数据。穴位坐标通过核心算法计算而来。
+
+**数据生成规则**:
+- 当用户档案首次创建时,根据用户体型数据(肩宽、身长、指寸)自动生成穴位对照表
+- 当用户体型数据更新时,自动重新计算穴位坐标
+- 当穴位管理中新增穴位时,自动为所有用户重新计算并新增穴位坐标
+
+**触发自动更新场景**:
+| 触发条件 | 自动执行操作 |
+|----------|--------------|
+| 创建用户档案 | 根据体型数据生成穴位对照表 |
+| 更新用户体型数据(肩宽/身长/指寸) | 重新计算所有穴位坐标 |
+| 穴位管理新增穴位 | 为所有用户新增该穴位坐标 |
+
+**数据库表结构**(仅存储,不展示在后台管理界面):
+
+```typescript
+interface UserAcupointTable {
+  id: string;                    // 主键
+  userId: string;                // 用户ID
+  acupointId: string;           // 穴位ID(关联穴位管理)
+  acupointName: string;         // 穴位名称
+  acupointSide: string;         // 侧别(center/left/right/both)
+  cunValue: number;            // 相对大椎穴偏移值(寸)
+  cunType: string;             // 寸类型(1寸/1.5寸/3寸)
+  coordinateX: number;         // 计算后的X坐标(mm,相对大椎穴)
+  coordinateY: number;         // 计算后的Y坐标(mm,相对大椎穴)
+  createdAt: Date;             // 首次生成时间
+  updatedAt: Date;             // 最后更新时间
+}
+```
+
+**算法调用说明**:
+- 核心算法模块提供穴位坐标计算服务
+- 后台调用算法接口生成用户专属穴位坐标
+- 计算公式参考"四、核心算法设计"章节
+
+---
+
+#### 用户方案表(独立页面)
+
+**功能说明**:用户方案表记录该用户下所有的艾灸方案。方案通过算法计算后,生成专属该用户的工艺参数和穴位坐标。每个用户的一键艾灸、专业模式、自定义模式、延年圣手模式中的所有订阅方案都经过算法处理后保存到此表中。
+
+**方案来源**:
+| 模式类型 | 方案来源 | 算法处理 |
+|----------|----------|----------|
+| 一键艾灸 | 系统默认工艺 | 根据用户穴位坐标生成专属工艺参数 |
+| 专业模式 | 8种功效方案 | 根据用户穴位坐标生成专属穴位组合 |
+| 自定义模式 | 用户自选方案 | 根据用户选择生成工艺参数 |
+| 延年圣手 | 专家方案订阅 | 根据用户穴位坐标生成专属工艺参数 |
+
+**使用次数更新规则**:
+- 用户在APP或设备上执行方案时,使用次数+1
+- 每次治疗会话开始时更新
+
+**方案列表**:
+
+| 序号 | 时间 | 模式类型 | 方案名称 | 方案编码 | 创作人 | 步骤 | 使用次数 | 操作 |
+|------|------|----------|----------|----------|--------|------|----------|------|
+| 1 | 2026-03-15 10:30 | 一键艾灸 | 一键艾灸(默认) | S001 | ADMIN | 5 | 15 | 查看详情 |
+| 2 | 2026-03-16 14:20 | 专业模式 | 春季祛湿方案 | S002 | ADMIN | 4 | 8 | 查看详情 |
+| 3 | 2026-03-18 09:00 | 自定义模式 | 个人调理方案 | S003 | 张三 | 3 | 3 | 查看详情 |
+| 4 | 2026-03-20 16:45 | 延年圣手 | 张专家驱寒方案 | S004 | 张专家 | 5 | 2 | 查看详情 |
+
+**列表字段说明**:
+| 字段 | 说明 |
+|------|------|
+| 时间 | 一键艾灸和专业模式按用户创建时间;自定义模式和延年圣手按方案订阅时间 |
+| 模式类型 | 一键艾灸 / 专业模式 / 自定义模式 / 延年圣手 |
+| 方案名称 | 方案的具体名称 |
+| 方案编码 | 方案的唯一标识符 |
+| 创作人 | ADMIN / 管理员账号名 / 用户姓名 / 专家姓名 |
+| 步骤 | 方案包含的治疗步骤数量 |
+| 使用次数 | 用户实际使用该方案的次数 |
+| 操作 | 查看工艺详情按钮 |
+
+**操作按钮**:
+| 按钮 | 功能说明 |
+|------|----------|
+| 查看详情 | 打开方案详情弹窗/页面 |
+| 返回 | 返回用户列表 |
+
+---
+
+#### 方案详情界面
+
+**显示内容**:
+| 字段 | 说明 |
+|------|------|
+| 方案名称 | 方案的具体名称 |
+| 方案编码 | 方案的唯一标识符 |
+| 模式类型 | 一键艾灸 / 专业模式 / 自定义模式 / 延年圣手 |
+| 创作人 | 方案创建者 |
+| 创建时间 | 方案生成时间 |
+| 使用次数 | 用户使用该方案的次数 |
+| 工艺详情 | 包含步骤序列、温度、时间、手法等 |
+
+**工艺详情结构**:
+
+| 步骤序号 | 穴位名称 | 侧别 | 温度(°C) | 时间(分钟) | 艾灸手法 |
+|----------|----------|------|----------|------------|----------|
+| 1 | 大椎穴 | 中心 | 43 | 5 | 一键艾灸 |
+| 2 | 身柱穴 | 中心 | 43 | 5 | 一键艾灸 |
+| 3 | 肺俞穴 | 左侧 | 42 | 5 | 温和灸 |
+| 4 | 肺俞穴 | 右侧 | 42 | 5 | 温和灸 |
+| 5 | 脾俞穴 | 雙側 | 45 | 10 | 回旋灸 |
+
+**操作按钮**:
+| 按钮 | 功能说明 |
+|------|----------|
+| 关闭 | 关闭详情弹窗/页面 |
+
+---
+
 ### 7.2 穴位管理
 
 #### 功能说明

+ 9 - 0
需求工作区/需求设计文档/用户管理

@@ -0,0 +1,9 @@
+登录用户通过手机号验证码登录,登录进来以后可以建立子用户信息。子用户信息有姓名、、性别、年龄、肩宽(cm)、身长(cm)、注册时间、用户穴位表id信息。
+用户通过手机号登录后可以绑定设备。
+如果绑定了设备的其他用户登录后扫码可以看到子用户信息。
+后台管理有管理员可以登录进来看到所有人信息和所有操作。刚刚说的登录用户通过手机号验证码登录,登录进来以后可以建立子用户信息。子用户信息有姓名、、性别、年龄、肩宽(cm)、身长(cm)、注册时间、用户穴位表id信息。
+                               用户通过手机号登录后可以绑定设备。
+                               如果绑定了设备的其他用户登录后扫码可以看到子用户信息。这种是客户的操作。我管理员可以对这些进行管理、增加、修改、删除、查看操作
+还有一种用户是专家可以发表文章等。(专家的功能和菜单也不用实现)
+现在按这种模式设计一下表结构和之前的日志框架。以及用户管理功能
+

部分文件因为文件数量过多而无法显示