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,7 +17,6 @@ import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
/**
* ${comments}
*
......@@ -35,7 +35,7 @@ public class MedicalController extends AbstractController {
*/
@RequestMapping("/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);
return R.ok().put("page", page);
}
......@@ -46,7 +46,7 @@ public class MedicalController extends AbstractController {
*/
@RequestMapping("/info/{id}")
// @RequiresPermissions("manage:medical:info")
public R info(@PathVariable("id") String id){
public R info(@PathVariable("id") String id) {
MedicalEntity medical = medicalService.getById(id);
return R.ok().put("medical", medical);
......@@ -57,7 +57,7 @@ public class MedicalController extends AbstractController {
*/
@RequestMapping("/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));
String username = getUser().getUsername();
medical.setInputDate(new Date());
......@@ -72,7 +72,7 @@ public class MedicalController extends AbstractController {
*/
@RequestMapping("/update")
// @RequiresPermissions("manage:medical:update")
public R update(@RequestBody MedicalEntity medical){
public R update(@RequestBody MedicalEntity medical) {
String username = getUser().getUsername();
medical.setEditor(username);
medical.setLasteditor(username);
......@@ -86,7 +86,7 @@ public class MedicalController extends AbstractController {
*/
@RequestMapping("/delete")
// @RequiresPermissions("manage:medical:delete")
public R delete(@RequestBody List<String> ids){
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