|
|
@@ -2,6 +2,9 @@ package work.baiyun.chronicdiseaseapp.controller;
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.media.Content;
|
|
|
+import io.swagger.v3.oas.annotations.media.Schema;
|
|
|
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.MediaType;
|
|
|
@@ -16,6 +19,7 @@ import work.baiyun.chronicdiseaseapp.model.vo.CreateUserBindingRequest;
|
|
|
import work.baiyun.chronicdiseaseapp.model.vo.DeleteUserBindingRequest;
|
|
|
import work.baiyun.chronicdiseaseapp.model.vo.CheckUserBindingResponse;
|
|
|
import work.baiyun.chronicdiseaseapp.model.vo.CheckUserBindingRequest;
|
|
|
+import work.baiyun.chronicdiseaseapp.model.vo.UserBindingPageResult;
|
|
|
import work.baiyun.chronicdiseaseapp.service.UserBindingService;
|
|
|
|
|
|
@RestController
|
|
|
@@ -28,6 +32,12 @@ public class UserBindingController {
|
|
|
|
|
|
@Operation(summary = "创建用户绑定关系", description = "创建患者与医生或家属的绑定关系")
|
|
|
@PostMapping(path = "/create", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ @ApiResponse(responseCode = "200", description = "OK",
|
|
|
+ content = @Content(mediaType = "application/json",
|
|
|
+ schema = @Schema(implementation = Void.class)))
|
|
|
+ @ApiResponse(responseCode = "500", description = "Internal Server Error",
|
|
|
+ content = @Content(mediaType = "application/json",
|
|
|
+ schema = @Schema(implementation = Void.class)))
|
|
|
public R<?> create(@RequestBody CreateUserBindingRequest req) {
|
|
|
try {
|
|
|
userBindingService.createUserBinding(req);
|
|
|
@@ -39,6 +49,12 @@ public class UserBindingController {
|
|
|
|
|
|
@Operation(summary = "删除用户绑定关系", description = "解除患者与医生或家属的绑定关系")
|
|
|
@PostMapping(path = "/delete", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ @ApiResponse(responseCode = "200", description = "OK",
|
|
|
+ content = @Content(mediaType = "application/json",
|
|
|
+ schema = @Schema(implementation = Void.class)))
|
|
|
+ @ApiResponse(responseCode = "500", description = "Internal Server Error",
|
|
|
+ content = @Content(mediaType = "application/json",
|
|
|
+ schema = @Schema(implementation = Void.class)))
|
|
|
public R<?> delete(@RequestBody DeleteUserBindingRequest req) {
|
|
|
try {
|
|
|
userBindingService.deleteUserBinding(req.getPatientUserId(), req.getBoundUserId());
|
|
|
@@ -50,6 +66,12 @@ public class UserBindingController {
|
|
|
|
|
|
@Operation(summary = "分页查询患者的绑定关系列表", description = "根据患者ID和绑定类型查询绑定关系列表")
|
|
|
@PostMapping(path = "/list-by-patient", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ @ApiResponse(responseCode = "200", description = "OK",
|
|
|
+ content = @Content(mediaType = "application/json",
|
|
|
+ schema = @Schema(implementation = UserBindingPageResult.class)))
|
|
|
+ @ApiResponse(responseCode = "500", description = "Internal Server Error",
|
|
|
+ content = @Content(mediaType = "application/json",
|
|
|
+ schema = @Schema(implementation = Void.class)))
|
|
|
public R<?> listByPatient(Long patientUserId, String bindingType, @RequestBody BaseQueryRequest req) {
|
|
|
try {
|
|
|
Page<UserBindingResponse> page = userBindingService.listBindingsByPatient(patientUserId, bindingType, req);
|
|
|
@@ -61,6 +83,12 @@ public class UserBindingController {
|
|
|
|
|
|
@Operation(summary = "分页查询用户被绑定的关系列表", description = "根据被绑定用户ID和绑定类型查询被绑定关系列表")
|
|
|
@PostMapping(path = "/list-by-bound-user", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ @ApiResponse(responseCode = "200", description = "OK",
|
|
|
+ content = @Content(mediaType = "application/json",
|
|
|
+ schema = @Schema(implementation = UserBindingPageResult.class)))
|
|
|
+ @ApiResponse(responseCode = "500", description = "Internal Server Error",
|
|
|
+ content = @Content(mediaType = "application/json",
|
|
|
+ schema = @Schema(implementation = Void.class)))
|
|
|
public R<?> listByBoundUser(Long boundUserId, String bindingType, @RequestBody BaseQueryRequest req) {
|
|
|
try {
|
|
|
Page<UserBindingResponse> page = userBindingService.listBindingsByBoundUser(boundUserId, bindingType, req);
|
|
|
@@ -72,6 +100,12 @@ public class UserBindingController {
|
|
|
|
|
|
@Operation(summary = "检查用户绑定关系", description = "检查患者与医生或家属是否存在绑定关系")
|
|
|
@PostMapping(path = "/check", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ @ApiResponse(responseCode = "200", description = "OK",
|
|
|
+ content = @Content(mediaType = "application/json",
|
|
|
+ schema = @Schema(implementation = CheckUserBindingResponse.class)))
|
|
|
+ @ApiResponse(responseCode = "500", description = "Internal Server Error",
|
|
|
+ content = @Content(mediaType = "application/json",
|
|
|
+ schema = @Schema(implementation = Void.class)))
|
|
|
public R<?> check(@RequestBody CheckUserBindingRequest req) {
|
|
|
try {
|
|
|
CheckUserBindingResponse response = userBindingService.checkUserBinding(req);
|