LabelController.java
4.14 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
package com.infoloop.tianting.controller;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.infoloop.tianting.model.dto.ClientLabelDTO;
import com.infoloop.tianting.model.dto.ClientLabelDTO.BatchCreateCustomerLabelRefResponseDto;
import com.infoloop.tianting.model.dto.ClientLabelDTO.BatchDeleteCustomerLabelRefResponseDto;
import com.infoloop.tianting.model.dto.ClientLabelDTO.CustomerLabelRefDetailDto;
import com.infoloop.tianting.model.dto.ClientLabelDTO.HisAllergy;
import com.infoloop.tianting.model.dto.ClientLabelDTO.HisMedicalAdviceDto;
import com.infoloop.tianting.model.dto.ClientLabelDTO.LabelDto;
import com.infoloop.tianting.service.ClientCustomerService;
import com.infoloop.tianting.service.DeliveryRuleService;
import com.infoloop.tianting.service.MeiZhongYiHeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.DeleteMapping;
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;
import javax.validation.Valid;
import java.util.List;
@Api(tags = "标签")
@ApiSupport(order = -1)
@Slf4j
@Validated
@RestController
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class LabelController {
private final DeliveryRuleService deliveryRuleService;
private final ClientCustomerService clientCustomerService;
private final MeiZhongYiHeService meiZhongYiHeService;
@ApiOperation(value = "按类型获取标签")
@PostMapping("/labels")
@ResponseStatus(HttpStatus.OK)
public List<LabelDto> getMiniProgramLabels(@Valid @RequestBody ClientLabelDTO.QueryLabelsDto queryLabelsDto) {
return deliveryRuleService.getLabelsByTypes(queryLabelsDto);
}
@ApiOperation(value = "批量创建用户绑定标签")
@PostMapping("/labels/batch")
@ResponseStatus(HttpStatus.OK)
public BatchCreateCustomerLabelRefResponseDto batchCreateCustomerLabelRef(@Valid @RequestBody ClientLabelDTO.BatchCreateCustomerLabelRefDto batchCreateCustomerLabelRefDto) {
return clientCustomerService.batchCreateClientCustomerLabelRefs(batchCreateCustomerLabelRefDto);
}
@ApiOperation(value = "获取用户已绑定的标签")
@PostMapping("/enterprises/{enterpriseId}/labels/customers/{customerId}")
@ResponseStatus(HttpStatus.OK)
public List<CustomerLabelRefDetailDto> getCustomerLabelsByCustomerId(@PathVariable Integer enterpriseId, @PathVariable Integer customerId) {
return clientCustomerService.getCustomerLabelsByCustomerId(enterpriseId, customerId);
}
@ApiOperation(value = "批量删除用户绑定的标签")
@DeleteMapping("/customer/label/refs")
@ResponseStatus(HttpStatus.OK)
public BatchDeleteCustomerLabelRefResponseDto getCustomerLabelsByCustomerId(@Valid @RequestBody ClientLabelDTO.BatchDeleteCustomerLabelRefRequestDto request) {
return clientCustomerService.deleteClientCustomerLabelRefsByIds(request);
}
@ApiOperation(value = "根据hisCustomerId查询用户绑定过敏源标签")
@GetMapping("/allergy/hisCustomer/{hisCustomerId}")
@ResponseStatus(HttpStatus.OK)
public List<HisAllergy> getHisCustomerAllergiesByCustomerId(@PathVariable String hisCustomerId) {
return meiZhongYiHeService.getHisCustomerAllergiesByCustomerId(hisCustomerId);
}
@ApiOperation(value = "根据contractNo查询His用户医嘱")
@GetMapping("/medicalAdvice/hisCustomer/{contractNo}")
@ResponseStatus(HttpStatus.OK)
public List<HisMedicalAdviceDto> getHisCustomerMedicalAdviceByContractNo(@PathVariable String contractNo) {
return meiZhongYiHeService.getHisCustomerMedicalAdvicesByContractNo(contractNo);
}
}