package thyyxxk.webserver.controller.dictionary.diagnoseReqTemplate;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.entity.CodeName;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.dictionary.diagnoseReqTemplate.req.CreatePatientJyJcReq;
import thyyxxk.webserver.entity.dictionary.diagnoseReqTemplate.req.ReqTemplateReq;
import thyyxxk.webserver.entity.dictionary.diagnoseReqTemplate.req.SelectByDiagnose;
import thyyxxk.webserver.entity.dictionary.diagnoseReqTemplate.vo.DiagnoseTemplateContent;
import thyyxxk.webserver.entity.dictionary.diagnoseReqTemplate.vo.DiagnoseToReqVo;
import thyyxxk.webserver.service.dictionary.diagnoseReqTemplate.DiagnoseReqTemplateService;

import javax.validation.Valid;
import java.util.List;


@RequestMapping("/diagnoseJyJcReqTemplate")
@RestController
@RequiredArgsConstructor
public class DiagnoseReqTemplateController {
    private final DiagnoseReqTemplateService service;

    @PostMapping("/getDiagnoseReqTemplateList")
    public ResultVo<Page<DiagnoseToReqVo>> getDiagnoseReqTemplateList(@RequestBody ReqTemplateReq value) {
        return service.getDiagnoseReqTemplateList(value);
    }

    @GetMapping("/createTemplate")
    public ResultVo<String> createTemplate(@RequestParam("name") String name) {
        return service.createTemplate(name);
    }


    @GetMapping("/getTemplateContentById")
    public ResultVo<DiagnoseTemplateContent> getTemplateContentById(@RequestParam("id") String id) {
        return service.getTemplateContentById(id);
    }

    @PostMapping("/saveTemplateContent")
    public ResultVo<String> saveTemplateContent(@RequestBody DiagnoseTemplateContent data) {
        return service.saveTemplateContent(data);
    }

    @GetMapping("/delTemplate")
    public ResultVo<String> delTemplate(@RequestParam("id") String id) {
        return service.delTemplate(id);
    }

    @PostMapping("/selectByDiagnose")
    public ResultVo<List<CodeName>> selectByDiagnose(@RequestBody SelectByDiagnose params) {
        return service.selectByDiagnose(params);
    }

    @PostMapping("/createPatientJyJcReq")
    public ResultVo<List<Integer>> createPatientJyJcReq(@RequestBody @Valid CreatePatientJyJcReq params) {
        return service.createPatientJyJcReq(params);
    }

}
