Commit 50dedd90 by 吴迪

【新增】医疗接口

parent ec2a8369
......@@ -8,6 +8,7 @@ import io.office.modules.manage.service.MedicalService;
import io.office.modules.manage.utils.IdKeysConstant;
import io.office.modules.manage.utils.IdWorkerUtils;
import io.office.modules.sys.controller.AbstractController;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -16,12 +17,11 @@ import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
/**
* ${comments}
*
* @author wudi
* @email
* @email
* @date 2021-11-21 12:15:48
*/
@RestController
......@@ -34,8 +34,8 @@ public class MedicalController extends AbstractController {
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("manage:medical:list")
public R list(@RequestParam Map<String, Object> params){
// @RequiresPermissions("manage:medical:list")
public R list(@RequestParam Map<String, Object> params) {
PageUtils page = medicalService.queryPage(params);
return R.ok().put("page", page);
}
......@@ -45,9 +45,9 @@ public class MedicalController extends AbstractController {
* 信息
*/
@RequestMapping("/info/{id}")
// @RequiresPermissions("manage:medical:info")
public R info(@PathVariable("id") String id){
MedicalEntity medical = medicalService.getById(id);
// @RequiresPermissions("manage:medical:info")
public R info(@PathVariable("id") String id) {
MedicalEntity medical = medicalService.getById(id);
return R.ok().put("medical", medical);
}
......@@ -56,8 +56,8 @@ public class MedicalController extends AbstractController {
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("manage:medical:save")
public R save(@RequestBody MedicalEntity medical){
// @RequiresPermissions("manage:medical:save")
public R save(@RequestBody MedicalEntity medical) {
medical.setId(IdWorkerUtils.getSEQByKey(IdKeysConstant.ID_SEQ_KEY));
String username = getUser().getUsername();
medical.setInputDate(new Date());
......@@ -71,13 +71,13 @@ public class MedicalController extends AbstractController {
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("manage:medical:update")
public R update(@RequestBody MedicalEntity medical){
// @RequiresPermissions("manage:medical:update")
public R update(@RequestBody MedicalEntity medical) {
String username = getUser().getUsername();
medical.setEditor(username);
medical.setLasteditor(username);
medical.setUpdatetime(new Date());
medicalService.updateById(medical);
medicalService.updateById(medical);
return R.ok("修改成功!");
}
......@@ -85,8 +85,8 @@ public class MedicalController extends AbstractController {
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("manage:medical:delete")
public R delete(@RequestBody List<String> ids){
// @RequiresPermissions("manage:medical:delete")
public R delete(@RequestBody List<String> ids) {
MedicalEntity medical = new MedicalEntity();
String username = getUser().getUsername();
medical.setEditor(username);
......@@ -94,20 +94,20 @@ public class MedicalController extends AbstractController {
medical.setUpdatetime(new Date());
medical.setLevel(0);
QueryWrapper<MedicalEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("id",ids);
medicalService.update(medical,queryWrapper);
queryWrapper.in("id", ids);
medicalService.update(medical, queryWrapper);
return R.ok("删除成功!");
}
@GetMapping("/getMedicalTypeList")
public R getMedicalTypeList(){
List<Map<String,Object>> list = medicalService.getMedicalTypeList();
return R.ok().put("list",list);
public R getMedicalTypeList() {
List<Map<String, Object>> list = medicalService.getMedicalTypeList();
return R.ok().put("list", list);
}
@PostMapping("/verifyMedical")
public R verifyMedical(@RequestBody MedicalEntity medical){
public R verifyMedical(@RequestBody MedicalEntity medical) {
String username = getUser().getUsername();
medical.setEditor(username);
medical.setLasteditor(username);
......@@ -115,9 +115,33 @@ public class MedicalController extends AbstractController {
medical.setCheckname(username);
medical.setChecktime(new Date());
QueryWrapper<MedicalEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id",medical.getId());
medicalService.update(medical,queryWrapper);
queryWrapper.eq("id", medical.getId());
medicalService.update(medical, queryWrapper);
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