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.datamodify.YzActOrder;
import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.*;
import thyyxxk.webserver.service.zhuyuanyisheng.YiZhuLuRuServer;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 描述： 医嘱录入
 * </p>
 *
 * @author xc
 * @date 2022-01-04 17:02
 */
@RestController
@RequestMapping("/yiZhuLuRu")
public class YizhuLuRuController {
    private final YiZhuLuRuServer server;

    public YizhuLuRuController(YiZhuLuRuServer server) {
        this.server = server;
    }


    @GetMapping("/huoQuYiZhuMingCheng")
    public ResultVo<List<GetDropdownBox>> huoQuYiZhuMingCheng(@RequestParam("inpatientNo") String inpatientNo,
                                                              @RequestParam("admissTimes") Integer admissTimes,
                                                              @RequestParam("orderName") String orderName) {
        return server.huoQuYiZhuMingCheng(inpatientNo, admissTimes, orderName);
    }

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

    @PostMapping("/huoQuYiZhuShuJu")
    public ResultVo<IPage<YzActOrder>> huoQuYiZhuShuJu(@RequestBody @Validated YiZhuFeiYongChaXunTiaoJian param) {
        return server.huoQuYiZhuShuJu(param);
    }

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

    @GetMapping("/huoQuFeiYongXinXi")
    public ResultVo<Map<String, Object>> huoQuFeiYongXinXi(@RequestParam("code") String code,
                                                           @RequestParam("serial") String serial,
                                                           @RequestParam("deptCode") String deptCode) {
        return server.huoQuFeiYongXinXi(code, serial, deptCode);
    }

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

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

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

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

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

    @PostMapping("/saveTemplate")
    public ResultVo<String> saveTemplate(@RequestBody YzOrderPattern param) {
        return server.saveTemplate(param);
    }

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

    @GetMapping("/huoQuYiZhuMuBan")
    public ResultVo<IPage<YzOrderPattern>> huoQuYiZhuMuBan(@RequestParam("code") String code,
                                                           @RequestParam("deptCode") String deptCode,
                                                           @RequestParam("muBanLeiXing") Integer muBanLeiXing,
                                                           @RequestParam("currentPage") long currentPage,
                                                           @RequestParam("total") long total) {
        return server.huoQuYiZhuMuBan(code, deptCode, muBanLeiXing, currentPage, total);
    }

    @GetMapping("/huoQuMuBanShuJu")
    public ResultVo<List<YzActOrder>> huoQuMuBanShuJu(@RequestParam("code") String code) {
        return server.huoQuMuBanShuJu(code);
    }

    @DeleteMapping("/deleteADoctorSOrderTemplate")
    public ResultVo<String> deleteADoctorsOrderTemplate(@RequestParam("patternCode") String patternCode) {
        return server.deleteADoctorSOrderTemplate(patternCode);
    }

    @GetMapping("/collectDoctorSOrderTemplate")
    public ResultVo<String> collectDoctorsOrderTemplate(@RequestParam("patternCode") String patternCode) {
        return server.collectDoctorSOrderTemplate(patternCode);
    }

    @GetMapping("/muBanCaoZuo")
    public ResultVo<String> muBanCaoZuo(@RequestParam("patternCode") String patternCode,
                                        @RequestParam("patternName") String patternName,
                                        @RequestParam("deptCode") String deptCode,
                                        @RequestParam("sortNo") Integer sortNo,
                                        @RequestParam("flag") Integer flag) {
        return server.muBanCaoZuo(patternCode, patternName, deptCode, sortNo, flag);
    }


    @GetMapping("/yiZhuChaoZuo")
    public ResultVo<String> yiZhuChaoZuo(@RequestParam("actOrderNo") BigDecimal actOrderNo,
                                         @RequestParam("flag") Integer flag,
                                         @RequestParam("content") String content) {
        return server.yiZhuChaoZuo(actOrderNo, flag, content);
    }

    @PostMapping("/piLiangXiuGaiTingZhiShiJian")
    public ResultVo<String> piLiangXiuGaiTingZhiShiJian(@RequestBody @Validated YiZhuTingZhiShiJian param) {
        return server.piLiangXiuGaiTingZhiShiJian(param);
    }

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

}
