ClientCustomerController.java 3.57 KB
package com.infoloop.tianting.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import cn.dev33.satoken.stp.SaTokenInfo;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.infoloop.tianting.model.dto.ClientCustomerDbDTO.ClientCustomerDto;
import com.infoloop.tianting.model.dto.ClientCustomerDbDTO.HospitalRecordDto;
import com.infoloop.tianting.model.dto.ClientCustomerDbDTO.TodayOrderDto;
import com.infoloop.tianting.model.dto.PermissionDTO.LoginDto;
import com.infoloop.tianting.model.dto.WxUserDto.WxUserOpenIdDto;
import com.infoloop.tianting.model.dto.WxUserDto.WxUserPhoneResponseDto;
import com.infoloop.tianting.service.ClientCustomerService;
import com.infoloop.tianting.service.LoginService;
import com.infoloop.tianting.service.WxMiniProgramService;
import com.infoloop.tianting.service.client.ClientCustomerServiceHttpClient;
import io.lettuce.core.dynamic.annotation.Param;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "ClientCustomer")
@ApiSupport(order = -1)
@Slf4j
@Validated
@RestController
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class ClientCustomerController {
  private final ClientCustomerService clientCustomerService;
  private final WxMiniProgramService wxMiniProgramService;
  private final ClientCustomerServiceHttpClient clientCustomerServiceHttpClient;

  @ApiOperation(value = "根据hisCustomerId获取ClientCustomer")
  @GetMapping("/customers/his/{hisCustomerId}")
  @ResponseStatus(HttpStatus.OK)
  public ClientCustomerDto getClientCustomerByHISCustomerId(@PathVariable String hisCustomerId) {
    return  clientCustomerService.getClientCustomerByHISCustomerId(hisCustomerId);
  }

  @ApiOperation(value = "根据phone获取ClientCustomer")
  @GetMapping("/customers/phone/{phone}")
  @ResponseStatus(HttpStatus.OK)
  public ClientCustomerDto getClientCustomerByPhone(@PathVariable String phone) {
    return  clientCustomerService.getClientCustomerByPhone(phone);
  }

  @ApiOperation(value = "根据customerId获取住院记录")
  @GetMapping("/enterprise/{enterpriseId}/hospitalRecords/customers/{customerId}")
  @ResponseStatus(HttpStatus.OK)
  public List<HospitalRecordDto> getHospitalRecords(@PathVariable Integer enterpriseId,
      @PathVariable Integer customerId) {
    return  clientCustomerService.getClientCustomerHospitalRecordsByCustomerId(
        enterpriseId, customerId);
  }

  @ApiOperation(value = "获取今日在住")
  @GetMapping("/clientCustomers/today/statistic")
  @ResponseStatus(HttpStatus.OK)
  public TodayOrderDto getClientCustomerTodayOrderStatistic(@RequestParam String customerToken) {
    return clientCustomerService.getTodayOrderStatistic(customerToken);
  }

  @ApiOperation(value = "获取his今日在住")
  @GetMapping("/hisClientCustomers/today/statistic")
  @ResponseStatus(HttpStatus.OK)
  public TodayOrderDto getHisClientCustomerTodayOrderStatistic(@RequestParam String customerToken) {
    return clientCustomerService.getTodayOrderStatisticForHis(customerToken);
  }

}