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.config.auth.PassToken;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
import thyyxxk.webserver.entity.zhuyuanyisheng.caoyaoyizhu.CaoYaoChaXunTiaoJian;
import thyyxxk.webserver.entity.zhuyuanyisheng.caoyaoyizhu.YzActOrderCy;
import thyyxxk.webserver.entity.zhuyuanyisheng.caoyaoyizhu.YzActOrderCyDetail;
import thyyxxk.webserver.entity.zhuyuanyisheng.caoyaoyizhu.YzOrderPatternCy;
import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.YiZhuMingChen;
import thyyxxk.webserver.service.zhuyuanyisheng.CaoYaoYiZhuService;

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

/**
 * <p>
 * 描述： 草药医嘱
 * </p>
 *
 * @author xc
 * @date 2022-02-26 08:37
 */
@RestController
@RequestMapping("/caoYaoYiZhu")
public class CaoYaoYiZhuController {
    private final CaoYaoYiZhuService server;

    public CaoYaoYiZhuController(CaoYaoYiZhuService server) {
        this.server = server;
    }

    @PostMapping("/huoQuCaoYaoShuJu")
    @PassToken
    public ResultVo<List<YzActOrderCy>> huoQuCaoYaoShuJu(@RequestBody @Validated CaoYaoChaXunTiaoJian param) {
        return server.huoQuCaoYaoShuJu(param);
    }

    @GetMapping("/huoQuChaoYaoMingXi")
    public ResultVo<List<YzActOrderCyDetail>> huoQuChaoYaoMingXi(@RequestParam("orderNo") BigDecimal orderNo) {
        return server.huoQuChaoYaoMingXi(orderNo);
    }

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

    @GetMapping("/huoQuCaoYao")
    public ResultVo<List<YiZhuMingChen>> huoQuCaoYao(@RequestParam("queryName") String queryName,
                                                     @RequestParam("groupNo") Integer groupNo) {
        return server.huoQuCaoYao(queryName, groupNo);
    }

    @GetMapping("/huoQuMuBan")
    public ResultVo<IPage<YzOrderPatternCy>> huoQuMuBan(@RequestParam("queryName") String queryName,
                                                        @RequestParam("deptCode") String deptCode,
                                                        @RequestParam("currentPage") long currentPage,
                                                        @RequestParam("pageSize") long pageSize,
                                                        @RequestParam("total") long total) {
        return server.huoQuMuBan(queryName, deptCode, currentPage, pageSize, total);
    }

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

    @GetMapping("/muBanXiangQing")
    public ResultVo<List<YzOrderPatternCy>> muBanXiangQing(@RequestParam("name") String name,
                                                           @RequestParam("deptCode") String deptCode) {
        return server.muBanXiangQing(name, deptCode);
    }

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


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

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

    @GetMapping("/shanChuCaoYao")
    public ResultVo<String> shanChuCaoYao(@RequestParam("patNo") String patNo,
                                          @RequestParam("times") Integer times,
                                          @RequestParam("orderNo") BigDecimal orderNo) {
        return server.shanChuCaoYao(patNo, times, orderNo);
    }

}
