package thyyxxk.webserver.controller.zhuyuanyizheng;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
import thyyxxk.webserver.entity.dictionary.CodeName;
import thyyxxk.webserver.entity.zhuyuanyisheng.query.ChaXunJianChaHeJianYan;
import thyyxxk.webserver.entity.zhuyuanyisheng.shoushu.OpRecord;
import thyyxxk.webserver.entity.zhuyuanyisheng.shoushu.ShouShuFanHui;
import thyyxxk.webserver.entity.zhuyuanyisheng.shoushu.XinZengShouShu;
import thyyxxk.webserver.entity.zhuyuanyisheng.shoushu.ZdIcd9Cm3;
import thyyxxk.webserver.service.zhuyuanyisheng.ShouShuShenQingService;

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

/**
 * <p>
 * 描述： 手术申请
 * </p>
 *
 * @author xc
 * @date 2022-02-22 15:45
 */
@RestController
@RequestMapping("/shouShuShenQing")
public class ShouShuShenQingController {
    private final ShouShuShenQingService server;

    public ShouShuShenQingController(ShouShuShenQingService server) {
        this.server = server;
    }


    @GetMapping("/obtainSurgicalItems")
    public ResultVo<List<ZdIcd9Cm3>> obtainSurgicalItems(@RequestParam("name") String name,
                                                         @RequestParam("type") Integer type) {
        return server.obtainSurgicalItems(name, type);
    }


    @GetMapping("/getDoctorByOpCode")
    public ResultVo<List<CodeName>> getDoctorByOpCode(@RequestParam("opCode") String opCode) {
        return server.getDoctorByOpCode(opCode);
    }

    @GetMapping("/preoperativeDiscussion")
    public ResultVo<Boolean> preoperativeDiscussion(@RequestParam("patNo") String patNo,
                                                    @RequestParam("times") Integer times,
                                                    @RequestParam("count") Integer count) {
        return server.preoperativeDiscussion(patNo, times, count);
    }

    @GetMapping("/shouShuShenQingCeBianLan")
    public ResultVo<List<GetDropdownBox>> shouShuShenQingCeBianLan() {
        return server.shouShuShenQingCeBianLan();
    }

    @GetMapping("/huoQuShouShuMingCheng")
    public ResultVo<List<Map<String, String>>> huoQuShouShuMingCheng(@RequestParam("patNo") String patNo, @RequestParam("times") Integer times, @RequestParam("name") String name) {
        return server.huoQuShouShuMingCheng(patNo, times, name);
    }

    @PostMapping("/huoQuShouShu")
    public ResultVo<IPage<OpRecord>> huoQuShouShu(@RequestBody @Validated ChaXunJianChaHeJianYan param) {
        return server.huoQuShouShu(param);
    }

    @GetMapping("/huoQuShouShuShenQingDaYing")
    public ResultVo<OpRecord> huoQuShouShuShenQingDaYing(@RequestParam("patNo") String patNo, @RequestParam("times") Integer times, @RequestParam("recordId") Integer recordId) {
        return server.huoQuShouShuShenQingDaYing(patNo, times, recordId);
    }

    @GetMapping("/fenLeiXiangQing")
    public ResultVo<IPage<ShouShuFanHui>> fenLeiXiangQing(@RequestParam("code") String code, @RequestParam("name") String name, @RequestParam("total") long total, @RequestParam("currentPage") long currentPage, @RequestParam("pageSize") long pageSize) {
        return server.fenLeiXiangQing(code, name, total, currentPage, pageSize);
    }

    @GetMapping("/huoQuShouShuBuWei")
    public ResultVo<List<GetDropdownBox>> huoQuShouShuBuWei(@RequestParam("name") String name) {
        return server.huoQuShouShuBuWei(name);
    }

    @PostMapping("/xinZengShouShuShenQing")
    public ResultVo<Map<String, String>> xinZengShouShuShenQing(@RequestBody XinZengShouShu param) {
        return server.xinZengShouShuShenQing(param);
    }

    @GetMapping("/shanChuShouShu")
    public ResultVo<String> shanChuShouShu(@RequestParam("recordId") Integer recordId) {
        return server.shanChuShouShu(recordId);
    }

    @GetMapping("/addASurgicalSite")
    public ResultVo<String> addASurgicalSite(@RequestParam("name") String name) {
        name = name.trim();
        return server.addASurgicalSite(name);
    }

    @GetMapping("/removeSurgicalSite")
    public ResultVo<String> removeSurgicalSite(String code) {
        return server.removeSurgicalSite(code);
    }

}
