package thyyxxk.webserver.controller.medicine;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.medicine.YpPlanDetail;
import thyyxxk.webserver.entity.medicine.YpPlanInfo;
import thyyxxk.webserver.service.medicine.YpPlanService;

import java.util.List;
import java.util.Map;

/**
 * @ClassName YpPlanController
 * @Author hsh
 * @Date 2025/2/20 9:19
 * @Version 1.0
 * @Description 药品计划申请与审核
 **/
@RestController
@RequestMapping("/ypPlan")
public class YpPlanController {

    private final YpPlanService service;

    public YpPlanController(YpPlanService service) {
        this.service = service;
    }

    @PostMapping("/selectYpPlanInfo")
    public ResultVo<List<YpPlanInfo>> selectYpPlanInfo(@RequestBody @Validated YpPlanInfo info){
        return service.selectYpPlanInfo(info);
    }

    @PostMapping("/selectYpPlanDetail")
    public ResultVo<List<YpPlanDetail>> selectYpPlanDetail(@RequestBody @Validated YpPlanDetail detail){
        return service.selectYpPlanDetail(detail);
    }

    @PostMapping("/selectYpPlanDetailById")
    public ResultVo<List<YpPlanDetail>> selectYpPlanDetailById(@RequestBody @Validated YpPlanDetail detail){
        return service.selectYpPlanDetailById(detail);
    }

    @PostMapping("/saveYpPlanFile")
    public ResultVo<Map<String, Object>> saveYpPlanFile(@Validated YpPlanInfo info){
        return service.saveYpPlanFile(info);
    }

    @PostMapping("/updateYpPlanAuditData")
    public ResultVo<Map<String, Object>> updateYpPlanAuditData(@RequestBody @Validated YpPlanInfo info){
        return service.updateYpPlanAuditData(info);
    }

    @PostMapping("/saveYpPlanDetail")
    public ResultVo<Map<String, Object>> saveYpPlanDetail(@RequestBody @Validated List<YpPlanDetail> list){
        return service.saveYpPlanDetail(list);
    }

}
