ClientCustomerController.java
3.58 KB
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
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.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 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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
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 LoginService loginService;
@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 = "小程序:根据code获取openId")
@GetMapping("/wx/miniprogram/customers/openid/{code}")
@ResponseStatus(HttpStatus.OK)
public WxUserOpenIdDto getOpenIdByCode(@PathVariable String code) {
return wxMiniProgramService.getWxUserOpenIdByCode(code);
}
@ApiOperation(value = "小程序:根据code获取手机号")
@GetMapping("/wx/miniprogram/customers/phone/{code}")
@ResponseStatus(HttpStatus.OK)
public WxUserPhoneResponseDto getPhoneByCode(@PathVariable String code) {
return wxMiniProgramService.getUserPhoneInfoByCode(code);
}
@SaIgnore
@ApiOperation(value = "登陆")
@PostMapping("/login")
@ResponseStatus(HttpStatus.OK)
public SaTokenInfo login(@Valid@RequestBody LoginDto loginDto) {
return loginService.login(loginDto);
}
}