package cn.iocoder.yudao.module.system.controller.admin.extra;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.controller.admin.extra.vo.PhysicalExamReportPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.extra.vo.PhysicalExamReportRespVO;
import cn.iocoder.yudao.module.system.dal.dataobject.extra.ElderlyExtraPhysicalExamReportDO;
import cn.iocoder.yudao.module.system.service.extra.ElderlyExtraPhysicalExamReportService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 体检报告项目说明")
@RestController @RequestMapping("/elderly/extra/physicalExamReport") @Validated
public class ElderlyExtraPhysicalExamReportController {
    @Resource private ElderlyExtraPhysicalExamReportService service;
    @PostMapping("/create") @Operation(summary = "创建体检报告项目说明") public CommonResult<Long> create(@Valid @RequestBody ElderlyExtraPhysicalExamReportDO r) { return success(service.create(r)); }
    @PostMapping("/update") @Operation(summary = "编辑体检报告项目说明") public CommonResult<Boolean> update(@Valid @RequestBody ElderlyExtraPhysicalExamReportDO r) { service.update(r); return success(true); }
    @DeleteMapping("/delete") @Operation(summary = "删除体检报告项目说明") @Parameter(name = "id", required = true) public CommonResult<Boolean> delete(@RequestParam("id") Long id) { service.delete(id); return success(true); }
    @GetMapping("/findPage") @Operation(summary = "体检报告项目说明分页列表") public CommonResult<PageResult<PhysicalExamReportRespVO>> findPage(@Valid PhysicalExamReportPageReqVO r) { return success(BeanUtils.toBean(service.findPage(r), PhysicalExamReportRespVO.class)); }
    @GetMapping("/getListByElderId") @Operation(summary = "根据长者ID获取体检报告项目说明列表") @Parameter(name = "elderId", required = true) public CommonResult<List<ElderlyExtraPhysicalExamReportDO>> getListByElderId(@RequestParam("elderId") Long elderId) { return success(service.getListByElderId(elderId)); }
    @GetMapping("/getDetail") @Operation(summary = "获取体检报告项目说明详情") @Parameter(name = "id", required = true) public CommonResult<ElderlyExtraPhysicalExamReportDO> getDetail(@RequestParam("id") Long id) { return success(service.getDetail(id)); }
}
