package com.openhis.web.check.controller;

import com.core.common.core.domain.R;
import com.openhis.web.check.appservice.ICheckMethodAppService;
import com.openhis.web.check.dto.CheckMethodDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


@RestController
@Slf4j
@RequestMapping("/check/method")
public class CheckMethodController {
    @Resource
    private ICheckMethodAppService checkMethodAppService;

    /*
     * 获取检查方法
     * @Param检查方法    此处参数注释有问题，完全是按照需求给的图来注释的
     */
    @GetMapping("/list")
    public R<?> getCheckMethodList(){
        return R.ok(checkMethodAppService.getCheckMethodList());
    }

    /*
     * 新增检查方法
     * @Param
     */
    @PostMapping("/add")
    public R<?> addCheckMethod(@RequestBody CheckMethodDto checkMethodDto){
        return R.ok(checkMethodAppService.addCheckMethod(checkMethodDto));
    }

    /*
     * 删除检查方法
     * @Param code代码
     */
    @DeleteMapping("/delete/{code}")
    public R<?> deleteCheckMethod(@PathVariable Long  code){
        return R.ok(checkMethodAppService.removeCheckMethod(code));
    }

    /*
     * 更新检查方法
     * @Param
     */
    @PutMapping("/update")
    public R<?> updateCheckMethod(@RequestBody CheckMethodDto checkMethodDto){
        return R.ok(checkMethodAppService.updateCheckMethod(checkMethodDto));
    }
}
