|
@@ -1,31 +1,27 @@
|
|
|
-package com.ruoyi.web.controller.info;
|
|
|
+package com.ruoyi.api.controller.info;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-import java.util.Arrays;
|
|
|
-
|
|
|
-import lombok.RequiredArgsConstructor;
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
-import javax.validation.constraints.*;
|
|
|
-import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
-import org.springframework.validation.annotation.Validated;
|
|
|
+import com.ruoyi.api.controller.common.AbstractApiController;
|
|
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
|
|
-import com.ruoyi.common.annotation.Log;
|
|
|
-import com.ruoyi.common.core.controller.BaseController;
|
|
|
import com.ruoyi.common.core.domain.PageQuery;
|
|
|
import com.ruoyi.common.core.domain.R;
|
|
|
+import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
import com.ruoyi.common.core.validate.AddGroup;
|
|
|
import com.ruoyi.common.core.validate.EditGroup;
|
|
|
import com.ruoyi.common.core.validate.QueryGroup;
|
|
|
-import com.ruoyi.common.enums.BusinessType;
|
|
|
-import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
-import com.ruoyi.info.patient.domain.vo.PatientVo;
|
|
|
import com.ruoyi.info.patient.domain.bo.PatientBo;
|
|
|
+import com.ruoyi.info.patient.domain.vo.PatientVo;
|
|
|
import com.ruoyi.info.patient.service.IPatientService;
|
|
|
-import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiParam;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.validation.constraints.NotEmpty;
|
|
|
+import javax.validation.constraints.NotNull;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* 就诊人Controller
|
|
@@ -37,8 +33,8 @@ import io.swagger.annotations.ApiOperation;
|
|
|
@Api(value = "就诊人控制器", tags = {"就诊人管理"})
|
|
|
@RequiredArgsConstructor
|
|
|
@RestController
|
|
|
-@RequestMapping("/patient/patient")
|
|
|
-public class PatientController extends BaseController {
|
|
|
+@RequestMapping("/api/patient/patient")
|
|
|
+public class ApiPatientController extends AbstractApiController {
|
|
|
|
|
|
private final IPatientService iPatientService;
|
|
|
|
|
@@ -46,17 +42,26 @@ public class PatientController extends BaseController {
|
|
|
* 分页查询就诊人列表
|
|
|
*/
|
|
|
@ApiOperation("查询就诊人列表")
|
|
|
- @SaCheckPermission("patient:patient:list")
|
|
|
@GetMapping("/page")
|
|
|
public TableDataInfo<PatientVo> page(@Validated(QueryGroup.class) PatientBo bo, PageQuery pageQuery) {
|
|
|
+ bo.setUserId(getUserId());
|
|
|
return iPatientService.queryPageList(bo, pageQuery);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询就诊人列表
|
|
|
+ */
|
|
|
+ @ApiOperation("查询就诊人列表")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public R<List<PatientVo>> list(@Validated(QueryGroup.class) PatientBo bo) {
|
|
|
+ bo.setUserId(getUserId());
|
|
|
+ return R.ok(iPatientService.queryList(bo));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取就诊人详细信息
|
|
|
*/
|
|
|
@ApiOperation("获取就诊人详细信息")
|
|
|
- @SaCheckPermission("patient:patient:query")
|
|
|
@GetMapping("/info/{id}")
|
|
|
public R<PatientVo> getInfo(@ApiParam("主键")
|
|
|
@NotNull(message = "主键不能为空")
|
|
@@ -68,11 +73,10 @@ public class PatientController extends BaseController {
|
|
|
* 新增就诊人
|
|
|
*/
|
|
|
@ApiOperation("新增就诊人")
|
|
|
- @SaCheckPermission("patient:patient:add")
|
|
|
- @Log(title = "就诊人", businessType = BusinessType.INSERT)
|
|
|
@RepeatSubmit()
|
|
|
@PostMapping("/add")
|
|
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody PatientBo bo) {
|
|
|
+ bo.setUserId(getUserId());
|
|
|
return toAjax(iPatientService.insertByBo(bo) ? 1 : 0);
|
|
|
}
|
|
|
|
|
@@ -80,11 +84,10 @@ public class PatientController extends BaseController {
|
|
|
* 修改就诊人
|
|
|
*/
|
|
|
@ApiOperation("修改就诊人")
|
|
|
- @SaCheckPermission("patient:patient:edit")
|
|
|
- @Log(title = "就诊人", businessType = BusinessType.UPDATE)
|
|
|
@RepeatSubmit()
|
|
|
@PostMapping("/edit")
|
|
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody PatientBo bo) {
|
|
|
+ bo.setUserId(getUserId());
|
|
|
return toAjax(iPatientService.updateByBo(bo) ? 1 : 0);
|
|
|
}
|
|
|
|
|
@@ -92,8 +95,6 @@ public class PatientController extends BaseController {
|
|
|
* 删除就诊人
|
|
|
*/
|
|
|
@ApiOperation("删除就诊人")
|
|
|
- @SaCheckPermission("patient:patient:remove")
|
|
|
- @Log(title = "就诊人", businessType = BusinessType.DELETE)
|
|
|
@PostMapping("/del/{ids}")
|
|
|
public R<Void> remove(@ApiParam("主键串")
|
|
|
@NotEmpty(message = "主键不能为空")
|
|
@@ -102,15 +103,23 @@ public class PatientController extends BaseController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 导出就诊人列表
|
|
|
+ * 设置用户就诊人是否默认
|
|
|
*/
|
|
|
- @ApiOperation("导出就诊人列表")
|
|
|
- @SaCheckPermission("patient:patient:export")
|
|
|
- @Log(title = "就诊人", businessType = BusinessType.EXPORT)
|
|
|
- @PostMapping("/export")
|
|
|
- public void export(@Validated PatientBo bo, HttpServletResponse response) {
|
|
|
- List<PatientVo> list = iPatientService.queryList(bo);
|
|
|
- ExcelUtil.exportExcel(list, "就诊人", PatientVo.class, response);
|
|
|
+ @ApiOperation("设置用户就诊人是否默认")
|
|
|
+ @RepeatSubmit()
|
|
|
+ @PostMapping("/setDefaulted/{patientId}")
|
|
|
+ public R<Void> setDefaulted(@PathVariable("patientId") Long patientId) {
|
|
|
+ iPatientService.setDefaulted(getUserId(),patientId);
|
|
|
+ return R.ok();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取用户默认就诊人
|
|
|
+ */
|
|
|
+ @ApiOperation("获取用户默认就诊人")
|
|
|
+ @GetMapping("/getDefaulted")
|
|
|
+ public R<PatientVo> getDefaulted() {
|
|
|
+ return R.ok(iPatientService.getDefaulted(getUserId()));
|
|
|
+ }
|
|
|
}
|