|
|
@@ -0,0 +1,71 @@
|
|
|
+package com.fs.app.controller;
|
|
|
+
|
|
|
+import com.fs.app.annotation.Login;
|
|
|
+import com.fs.chronic.domain.MedicationReminder;
|
|
|
+import com.fs.chronic.service.IMedicationReminderService;
|
|
|
+import com.fs.common.core.domain.R;
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 用药提醒接口
|
|
|
+ */
|
|
|
+@Api("用药提醒接口")
|
|
|
+@RestController
|
|
|
+@RequestMapping(value = "/app/medicationReminder")
|
|
|
+public class MedicationReminderController extends AppBaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IMedicationReminderService medicationReminderService;
|
|
|
+
|
|
|
+ @Login
|
|
|
+ @ApiOperation("获取用药提醒列表")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public R list(MedicationReminder medicationReminder) {
|
|
|
+ startPage();
|
|
|
+ List<MedicationReminder> list = medicationReminderService.selectMedicationReminderList(medicationReminder);
|
|
|
+ PageInfo<MedicationReminder> pageInfo = new PageInfo<>(list);
|
|
|
+ return R.ok().put("data", pageInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Login
|
|
|
+ @ApiOperation("获取用药提醒详情")
|
|
|
+ @GetMapping("/{id}")
|
|
|
+ public R getById(@PathVariable Long id) {
|
|
|
+ MedicationReminder reminder = medicationReminderService.selectMedicationReminderById(id);
|
|
|
+ return R.ok().put("data", reminder);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Login
|
|
|
+ @ApiOperation("新增用药提醒")
|
|
|
+ @PostMapping
|
|
|
+ public R add(@Validated @RequestBody MedicationReminder medicationReminder) {
|
|
|
+ medicationReminder.setCreateBy(getUserId());
|
|
|
+ int rows = medicationReminderService.insertMedicationReminder(medicationReminder);
|
|
|
+ return rows > 0 ? R.ok("新增成功") : R.error("新增失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Login
|
|
|
+ @ApiOperation("修改用药提醒")
|
|
|
+ @PutMapping
|
|
|
+ public R edit(@Validated @RequestBody MedicationReminder medicationReminder) {
|
|
|
+ medicationReminder.setUpdateBy(getUserId());
|
|
|
+ int rows = medicationReminderService.updateMedicationReminder(medicationReminder);
|
|
|
+ return rows > 0 ? R.ok("修改成功") : R.error("修改失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Login
|
|
|
+ @ApiOperation("删除用药提醒")
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
+ public R remove(@PathVariable Long[] ids) {
|
|
|
+ int rows = medicationReminderService.deleteMedicationReminderByIds(ids);
|
|
|
+ return rows > 0 ? R.ok("删除成功") : R.error("删除失败");
|
|
|
+ }
|
|
|
+}
|