“mitao”
2026-04-17 d699da385dda6257677ee93bef47388c0635f64e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package com.tcm.training.admin.app.patient.controller;
 
import com.tcm.training.admin.app.patient.service.AppMyPatientService;
import com.tcm.training.admin.app.patient.vo.AppMyPatientExchangeItemVO;
import com.tcm.training.admin.app.patient.vo.AppMyPatientExchangeOrderItemVO;
import com.tcm.training.admin.app.patient.vo.AppMyPatientItemVO;
import com.tcm.training.admin.app.patient.vo.AppMyPatientLiveItemVO;
import com.tcm.training.admin.common.ApiResponse;
import com.tcm.training.admin.common.PageResponse;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
/**
 * APP 我的患者接口。
 */
@Validated
@RestController
@RequestMapping({"/api/app/my-patients", "/api/v1/app/my-patients"})
public class AppMyPatientController {
 
    private final AppMyPatientService appMyPatientService;
 
    /**
     * 注入 APP 我的患者服务。
     */
    public AppMyPatientController(AppMyPatientService appMyPatientService) {
        this.appMyPatientService = appMyPatientService;
    }
 
    /**
     * 分页查询当前医生的直属患者列表。
     */
    @GetMapping("/patients")
    public ApiResponse<PageResponse<AppMyPatientItemVO>> patients(
            @RequestParam(required = false) String keyword,
            @RequestParam(required = false, defaultValue = "1") int page,
            @RequestParam(required = false, defaultValue = "10") int pageSize) {
        return ApiResponse.ok(appMyPatientService.pagePatients(page, pageSize, keyword));
    }
 
    /**
     * 分页查询当前医生直属患者的直播积分记录。
     */
    @GetMapping("/live-records")
    public ApiResponse<PageResponse<AppMyPatientLiveItemVO>> liveRecords(
            @RequestParam(required = false) String keyword,
            @RequestParam(required = false) String startDate,
            @RequestParam(required = false) String endDate,
            @RequestParam(required = false, defaultValue = "1") int page,
            @RequestParam(required = false, defaultValue = "10") int pageSize) {
        return ApiResponse.ok(appMyPatientService.pageLiveRecords(page, pageSize, keyword, startDate, endDate));
    }
 
    /**
     * 分页查询当前医生直属患者的兑换数据列表。
     */
    @GetMapping("/exchange-records")
    public ApiResponse<PageResponse<AppMyPatientExchangeItemVO>> exchangeRecords(
            @RequestParam(required = false) String keyword,
            @RequestParam(required = false) String status,
            @RequestParam(required = false, defaultValue = "1") int page,
            @RequestParam(required = false, defaultValue = "10") int pageSize) {
        return ApiResponse.ok(appMyPatientService.pageExchangeRecords(page, pageSize, keyword, status));
    }
 
    /**
     * 查询当前医生可查看的兑换主订单子订单列表。
     */
    @GetMapping("/exchange-orders/{orderId}/items")
    public ApiResponse<PageResponse<AppMyPatientExchangeOrderItemVO>> exchangeOrderItems(
            @PathVariable("orderId") Long orderId,
            @RequestParam(required = false, defaultValue = "1") int page,
            @RequestParam(required = false, defaultValue = "10") int pageSize) {
        return ApiResponse.ok(appMyPatientService.pageExchangeOrderItems(orderId, page, pageSize));
    }
 
    /**
     * 确认当前医生可查看的兑换主订单已收货。
     */
    @PostMapping("/exchange-orders/{orderId}/confirm-received")
    public ApiResponse<Void> confirmExchangeOrderReceived(@PathVariable("orderId") Long orderId) {
        appMyPatientService.confirmExchangeOrderReceived(orderId);
        return ApiResponse.ok(null);
    }
}