Commit 50dedd90 by 吴迪

【新增】医疗接口

parent ec2a8369
...@@ -8,6 +8,7 @@ import io.office.modules.manage.service.MedicalService; ...@@ -8,6 +8,7 @@ import io.office.modules.manage.service.MedicalService;
import io.office.modules.manage.utils.IdKeysConstant; import io.office.modules.manage.utils.IdKeysConstant;
import io.office.modules.manage.utils.IdWorkerUtils; import io.office.modules.manage.utils.IdWorkerUtils;
import io.office.modules.sys.controller.AbstractController; import io.office.modules.sys.controller.AbstractController;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -16,12 +17,11 @@ import io.office.common.utils.PageUtils; ...@@ -16,12 +17,11 @@ import io.office.common.utils.PageUtils;
import io.office.common.utils.R; import io.office.common.utils.R;
/** /**
* ${comments} * ${comments}
* *
* @author wudi * @author wudi
* @email * @email
* @date 2021-11-21 12:15:48 * @date 2021-11-21 12:15:48
*/ */
@RestController @RestController
...@@ -34,8 +34,8 @@ public class MedicalController extends AbstractController { ...@@ -34,8 +34,8 @@ public class MedicalController extends AbstractController {
* 列表 * 列表
*/ */
@RequestMapping("/list") @RequestMapping("/list")
// @RequiresPermissions("manage:medical:list") // @RequiresPermissions("manage:medical:list")
public R list(@RequestParam Map<String, Object> params){ public R list(@RequestParam Map<String, Object> params) {
PageUtils page = medicalService.queryPage(params); PageUtils page = medicalService.queryPage(params);
return R.ok().put("page", page); return R.ok().put("page", page);
} }
...@@ -45,9 +45,9 @@ public class MedicalController extends AbstractController { ...@@ -45,9 +45,9 @@ public class MedicalController extends AbstractController {
* 信息 * 信息
*/ */
@RequestMapping("/info/{id}") @RequestMapping("/info/{id}")
// @RequiresPermissions("manage:medical:info") // @RequiresPermissions("manage:medical:info")
public R info(@PathVariable("id") String id){ public R info(@PathVariable("id") String id) {
MedicalEntity medical = medicalService.getById(id); MedicalEntity medical = medicalService.getById(id);
return R.ok().put("medical", medical); return R.ok().put("medical", medical);
} }
...@@ -56,8 +56,8 @@ public class MedicalController extends AbstractController { ...@@ -56,8 +56,8 @@ public class MedicalController extends AbstractController {
* 保存 * 保存
*/ */
@RequestMapping("/save") @RequestMapping("/save")
// @RequiresPermissions("manage:medical:save") // @RequiresPermissions("manage:medical:save")
public R save(@RequestBody MedicalEntity medical){ public R save(@RequestBody MedicalEntity medical) {
medical.setId(IdWorkerUtils.getSEQByKey(IdKeysConstant.ID_SEQ_KEY)); medical.setId(IdWorkerUtils.getSEQByKey(IdKeysConstant.ID_SEQ_KEY));
String username = getUser().getUsername(); String username = getUser().getUsername();
medical.setInputDate(new Date()); medical.setInputDate(new Date());
...@@ -71,13 +71,13 @@ public class MedicalController extends AbstractController { ...@@ -71,13 +71,13 @@ public class MedicalController extends AbstractController {
* 修改 * 修改
*/ */
@RequestMapping("/update") @RequestMapping("/update")
// @RequiresPermissions("manage:medical:update") // @RequiresPermissions("manage:medical:update")
public R update(@RequestBody MedicalEntity medical){ public R update(@RequestBody MedicalEntity medical) {
String username = getUser().getUsername(); String username = getUser().getUsername();
medical.setEditor(username); medical.setEditor(username);
medical.setLasteditor(username); medical.setLasteditor(username);
medical.setUpdatetime(new Date()); medical.setUpdatetime(new Date());
medicalService.updateById(medical); medicalService.updateById(medical);
return R.ok("修改成功!"); return R.ok("修改成功!");
} }
...@@ -85,8 +85,8 @@ public class MedicalController extends AbstractController { ...@@ -85,8 +85,8 @@ public class MedicalController extends AbstractController {
* 删除 * 删除
*/ */
@RequestMapping("/delete") @RequestMapping("/delete")
// @RequiresPermissions("manage:medical:delete") // @RequiresPermissions("manage:medical:delete")
public R delete(@RequestBody List<String> ids){ public R delete(@RequestBody List<String> ids) {
MedicalEntity medical = new MedicalEntity(); MedicalEntity medical = new MedicalEntity();
String username = getUser().getUsername(); String username = getUser().getUsername();
medical.setEditor(username); medical.setEditor(username);
...@@ -94,20 +94,20 @@ public class MedicalController extends AbstractController { ...@@ -94,20 +94,20 @@ public class MedicalController extends AbstractController {
medical.setUpdatetime(new Date()); medical.setUpdatetime(new Date());
medical.setLevel(0); medical.setLevel(0);
QueryWrapper<MedicalEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<MedicalEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("id",ids); queryWrapper.in("id", ids);
medicalService.update(medical,queryWrapper); medicalService.update(medical, queryWrapper);
return R.ok("删除成功!"); return R.ok("删除成功!");
} }
@GetMapping("/getMedicalTypeList") @GetMapping("/getMedicalTypeList")
public R getMedicalTypeList(){ public R getMedicalTypeList() {
List<Map<String,Object>> list = medicalService.getMedicalTypeList(); List<Map<String, Object>> list = medicalService.getMedicalTypeList();
return R.ok().put("list",list); return R.ok().put("list", list);
} }
@PostMapping("/verifyMedical") @PostMapping("/verifyMedical")
public R verifyMedical(@RequestBody MedicalEntity medical){ public R verifyMedical(@RequestBody MedicalEntity medical) {
String username = getUser().getUsername(); String username = getUser().getUsername();
medical.setEditor(username); medical.setEditor(username);
medical.setLasteditor(username); medical.setLasteditor(username);
...@@ -115,9 +115,33 @@ public class MedicalController extends AbstractController { ...@@ -115,9 +115,33 @@ public class MedicalController extends AbstractController {
medical.setCheckname(username); medical.setCheckname(username);
medical.setChecktime(new Date()); medical.setChecktime(new Date());
QueryWrapper<MedicalEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<MedicalEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id",medical.getId()); queryWrapper.eq("id", medical.getId());
medicalService.update(medical,queryWrapper); medicalService.update(medical, queryWrapper);
return R.ok("审核成功!"); return R.ok("审核成功!");
} }
@PostMapping("/api/getList10ByType")
public R getList10ByType(@RequestBody MedicalEntity medical) {
QueryWrapper<MedicalEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.select("top 10 id,title ");
queryWrapper.gt("level","0");
if(StringUtils.isBlank(medical.getType())) {
return R.error("请输入分类");
}
queryWrapper.eq("type",medical.getType());
queryWrapper.orderByDesc("releaseTime");
return R.ok().put("data",medicalService.list(queryWrapper));
}
@PostMapping("/api/getDetailById")
public R getDetailById(@RequestBody MedicalEntity medical) {
return R.ok().put("data",medicalService.getById(medical.getId()));
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment