package thyyxxk.webserver.controller.medicaladvice.patientinfo;

import org.springframework.beans.factory.annotation.Autowired;
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.config.exception.ExceptionEnum;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.medicaladvice.medicamanage.patientinfo.BabyInfoVo;
import thyyxxk.webserver.service.medicaladvice.patientinfo.BaByInfoService;
import thyyxxk.webserver.utils.ResultVoUtil;

import java.util.List;

/**
 * @Description:
 * @Author:lihong
 * @Date: 2023/12/19
 */
@RestController
@RequestMapping("/medicalAdvice/addBabyInfo/")
public class BaByInfoController {
    @Autowired
    private BaByInfoService service;
    @PostMapping("queryInfo")
    public ResultVo<List<BabyInfoVo>> queryInfo(@RequestBody BabyInfoVo query){
        return ResultVoUtil.success(service.queryInfo(query));
    }

    @PostMapping("deleteBaby")
    public ResultVo<String> deleteBaby(@RequestBody BabyInfoVo query){
        service.deleteBaby(query);
        return ResultVoUtil.success();
    }

    @PostMapping("saveBabyInfo")
    public ResultVo<String> saveBabyInfo(@RequestBody BabyInfoVo query){
        service.saveBabyInfo(query);
        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_MESSAGE,"保存成功");
    }


}
