HosptailController.java 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. package com.imed.costaccount.web;
  2. import java.util.Arrays;
  3. import com.imed.costaccount.common.util.PageUtils;
  4. import com.imed.costaccount.common.util.Result;
  5. import com.imed.costaccount.model.Hospital;
  6. import com.imed.costaccount.model.User;
  7. import com.imed.costaccount.model.dto.HosptailDto;
  8. import com.imed.costaccount.service.HosptailService;
  9. import com.sun.xml.internal.bind.v2.TODO;
  10. import io.swagger.annotations.Api;
  11. import io.swagger.annotations.ApiOperation;
  12. import org.apache.shiro.SecurityUtils;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.web.bind.annotation.*;
  15. /**
  16. * 医院表
  17. *
  18. * @author KCYG
  19. * @date 2021-07-26 08:52:56
  20. */
  21. @RestController
  22. @RequestMapping("/costAccount/hosptail")
  23. @Api(tags = "医院相关操作")
  24. public class HosptailController {
  25. @Autowired
  26. private HosptailService hosptailService;
  27. // /**
  28. // * 列表
  29. // */
  30. // @RequestMapping("/list")
  31. // public Result list(@RequestParam Map<String, Object> params){
  32. // PageUtils page = hosptailService.queryPage(params);
  33. // return CommonResponse.success(page);
  34. // }
  35. /**
  36. * 用户信息列表查询 分页查询
  37. * @return
  38. */
  39. @GetMapping("/list")
  40. @ApiOperation("分页查询医院信息")
  41. public Result list(@RequestParam(defaultValue = "1", value = "page") Integer page,
  42. @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
  43. @RequestParam(value = "name",required = false) String name){
  44. User user = (User) SecurityUtils.getSubject().getPrincipal();
  45. Integer hospId = user.getHospId();
  46. PageUtils pageUtils = hosptailService.queryList(page,pageSize,hospId,name);
  47. return Result.ok(pageUtils);
  48. }
  49. /**
  50. * 信息
  51. */
  52. @GetMapping("/getById")
  53. @ApiOperation("根据Id查询医院信息")
  54. public Result info(Integer id){
  55. Hospital hospital = hosptailService.getById(id);
  56. return Result.ok(hospital);
  57. }
  58. /**
  59. * 保存
  60. */
  61. @PostMapping("/save")
  62. @ApiOperation("保存医院信息")
  63. public Result save(@RequestBody HosptailDto hosptailDto){
  64. hosptailService.saveHosptail(hosptailDto);
  65. return Result.ok();
  66. }
  67. /**
  68. * 修改
  69. * 修改的操作是作废新增
  70. */
  71. @PutMapping("/update")
  72. @ApiOperation("修改医院信息")
  73. public Result update(@RequestBody HosptailDto hosptailDto){
  74. // 作废操作
  75. hosptailService.updateByHosptail(hosptailDto);
  76. return Result.ok();
  77. }
  78. /**
  79. * 删除
  80. */
  81. @DeleteMapping("/delete")
  82. @ApiOperation("删除医院信息")
  83. public Result delete(@RequestBody Integer[] ids){
  84. hosptailService.removeByIds(Arrays.asList(ids));
  85. return Result.ok();
  86. }
  87. }