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);
|
}
|
}
|