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

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.system.controller.admin.biz.vo.NurseChangeDetailRespVO;
import cn.iocoder.yudao.module.system.controller.admin.biz.vo.NurseChangeyEvaluationRespVO;
import cn.iocoder.yudao.module.system.service.biz.ElderlyChangeRecordService;
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.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import java.util.List;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

/**
 * @Author: jinyd
 * @CreateTime: 2024/8/19  11:17
 * @Description:
 * @Version: 4.0
 */

@Tag(name = "管理后台 - 护理变更记录")
@RestController
@RequestMapping("/elderly/nurseChangeRecord")
@Validated
public class NurseChangeRecordController {

    @Resource
    private ElderlyChangeRecordService changeRecordService;
    @GetMapping("/getNurseDetail")
    @Operation(summary = "获得护理变更记录详情")
    @Parameter(name = "id", description = "编号", required = true, example = "1024")
    @PreAuthorize("@ss.hasPermission('nurse-change:detail')")
    @TenantIgnore
    public CommonResult<NurseChangeDetailRespVO> getNurseDetail(@RequestParam("id") Long id,@RequestParam("isDetail") Boolean isDetail) {
        NurseChangeDetailRespVO bedChangeRecord = changeRecordService.getNurseDetail(id,isDetail);
        return success(bedChangeRecord);
    }

    @GetMapping("/getEvaluationByElderId")
    @Operation(summary = "根据长者id查询评估表")
    @Parameter(name = "elderId", description = "长者id", required = true, example = "1024")
    @TenantIgnore
    public CommonResult<List<NurseChangeyEvaluationRespVO>> getEvaluationByElderId(@RequestParam("elderId") Long elderId) {
        List<NurseChangeyEvaluationRespVO> result = changeRecordService.getEvaluationByElderId(elderId);
        return success(result);
    }

}
