Selaa lähdekoodia

1、用户预约测评后,小程序端可以看到规划师

jiapu 3 kuukautta sitten
vanhempi
sitoutus
afee0ba627

+ 35 - 3
cfc-backend/src/main/java/com/etotem/cfc/controller/DanAssessmentController.java

@@ -32,6 +32,8 @@ public class DanAssessmentController {
     private AssessmentPermissionService permissionService;
     @Resource
     private com.etotem.cfc.mapper.DanAssessmentResultMapper danAssessmentResultMapper;
+    @Resource
+    private com.etotem.cfc.mapper.UserMapper userMapper;
 
     @Resource
     private DanReportParseService danReportParseService;
@@ -215,10 +217,40 @@ public class DanAssessmentController {
         return ok ? Result.success("取消成功") : Result.error("取消失败");
     }
 
-@Operation(summary = "获取用户的预约列表")
+    @Operation(summary = "获取用户的预约列表")
     @PostMapping("/appointment/user")
-    public Result<List<AssessmentAppointment>> getUserAppointments(@RequestParam Long userId) {
-        return Result.success(appointmentService.getByUserId(userId));
+    public Result<List<Map<String, Object>>> getUserAppointments(@RequestBody Map<String, Object> body) {
+        Long userId = body.get("userId") != null ? Long.valueOf(body.get("userId").toString()) : null;
+        if (userId == null) return Result.error("userId 不能为空");
+        List<AssessmentAppointment> list = appointmentService.getByUserId(userId);
+        List<Map<String, Object>> result = new java.util.ArrayList<>();
+        for (AssessmentAppointment app : list) {
+            Map<String, Object> item = new java.util.LinkedHashMap<>();
+            item.put("id", app.getId());
+            item.put("userId", app.getUserId());
+            item.put("familyId", app.getFamilyId());
+            item.put("childId", app.getChildId());
+            item.put("guideId", app.getGuideId());
+            item.put("packageId", app.getPackageId());
+            item.put("appointmentDate", app.getAppointmentDate());
+            item.put("appointmentTime", app.getAppointmentTime());
+            item.put("durationMinutes", app.getDurationMinutes());
+            item.put("status", app.getStatus());
+            item.put("appointmentType", app.getAppointmentType());
+            item.put("notes", app.getNotes());
+            item.put("contactPhone", app.getContactPhone());
+            item.put("meetLink", app.getMeetLink());
+            item.put("createdAt", app.getCreatedAt());
+            // 关联查询规划师名称
+            if (app.getGuideId() != null) {
+                com.etotem.cfc.entity.User guide = userMapper.selectById(app.getGuideId());
+                item.put("guideName", guide != null ? guide.getNickname() : "");
+            } else {
+                item.put("guideName", "");
+            }
+            result.add(item);
+        }
+        return Result.success(result);
     }
 
     @Operation(summary = "获取规划师的预约列表")

+ 6 - 0
cfc-frontend/pages.json

@@ -362,6 +362,12 @@
             "navigationBarTitleText": "心愿管理"
           }
         },
+        {
+          "path": "appointments",
+          "style": {
+            "navigationBarTitleText": "我的预约"
+          }
+        },
         {
           "path": "child-detail",
           "style": {

+ 9 - 0
cfc-frontend/pages/parent/appointments.vue

@@ -28,6 +28,14 @@
             <text class="label">备注</text>
             <text class="value">{{ item.notes }}</text>
           </view>
+          <view class="info-row" v-if="item.guideName">
+            <text class="label">规划师</text>
+            <text class="value guide-name">{{ item.guideName }}</text>
+          </view>
+          <view class="info-row" v-if="item.status === 1 && !item.guideName">
+            <text class="label">规划师</text>
+            <text class="value">待分配</text>
+          </view>
           <view class="info-row">
             <text class="label">创建时间</text>
             <text class="value">{{ formatTime(item.createdAt) }}</text>
@@ -189,6 +197,7 @@ export default {
 
 .label { color: #999; }
 .value { color: #333; }
+.guide-name { color: #F97316; font-weight: bold; }
 
 .card-footer {
   padding-top: 16rpx;

+ 7 - 0
cfc-frontend/pages/profile/components/ProfileMenu.vue

@@ -8,6 +8,10 @@
           <text>👨‍👩‍👧‍👦 家庭成员</text>
           <text class="arrow">›</text>
         </view>
+        <view class="menu-item" v-if="role === 'parent'" @click="goToAppointments">
+          <text>📅 测评预约</text>
+          <text class="arrow">›</text>
+        </view>
         <view class="menu-item" @click="goToDailyTasks">
           <text>📋 每日任务</text>
           <text class="arrow">›</text>
@@ -133,6 +137,9 @@ export default {
     goToFamilyMembers() {
       uni.navigateTo({ url: '/pages/profile/family-members' })
     },
+    goToAppointments() {
+      uni.navigateTo({ url: '/pages/parent/appointments' })
+    },
     goToDailyTasks() {
       uni.navigateTo({ url: '/pages/tasks/daily-tasks' })
     },

+ 11 - 0
cfc-frontend/utils/api.js

@@ -1858,4 +1858,15 @@ export const queryFoodKnowledge = (name) => {
 // 获取KB v3章节数据
 export const getKnowledgeSection = (section) => {
   return request('/api/health/knowledge/v3/section', 'POST', { section: section || '' })
+}
+
+// 获取我的测评预约列表
+export const getMyAppointments = () => {
+  var userId = uni.getStorageSync('userId')
+  return request('/api/dan-assessment/appointment/user', 'POST', { userId: userId })
+}
+
+// 取消测评预约
+export const cancelAppointment = (id) => {
+  return request('/api/dan-assessment/appointment/cancel', 'POST', { id: id })
 }