package com.openhis.web.check.controller;

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

import javax.annotation.Resource;

@RestController
@Slf4j
@RequestMapping("/check/part")
public class CheckPartController {
    @Resource
    private ICheckPartAppService checkPartAppService;

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

    /*
     * 新增检查部位
     * @Param
     */
    @PostMapping("/add")
    public R<?> addCheckPart(@RequestBody CheckPartDto checkPartDto){
        return R.ok(checkPartAppService.addCheckPart(checkPartDto));
    }

    /*
     * 删除检查部位
     * @Param code代码
     */
    @DeleteMapping("/delete/{code}")
    public R<?> deleteCheckPart(@PathVariable Long code){
        return R.ok(checkPartAppService.removeCheckPart(code));
    }

    /*
     * 更新检查部位
     * @Param
     */
    @PutMapping("/update")
    public R<?> updateCheckPart(@RequestBody CheckPartDto checkPartDto){
        return R.ok(checkPartAppService.updateCheckPart(checkPartDto));
    }
}
