package thyyxxk.webserver.controller.zhuyuanyizheng;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.config.auth.PassToken;
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();
    }


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

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

    @GetMapping("/getSurgeryDetail")
    public ResultVo<JSONObject> getSurgeryDetail(@RequestParam("patNo") String patNo,
                                                 @RequestParam("times") Integer times,
                                                 @RequestParam("recordId") Integer recordId) {
        return server.getSurgeryDetail(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("/applicationOpRecord")
    public ResultVo<String> applicationOpRecord(@RequestBody XinZengShouShu param) {
        return server.applicationOpRecord(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);
    }

}
