package thyyxxk.webserver.controller.dictionary;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.config.auth.PassToken;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.nationalmatch.QueryParam;
import thyyxxk.webserver.entity.nationalmatch.StandardLocalItem;
import thyyxxk.webserver.service.dictionary.NationalMatchService;

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

/**
 * @description: 新医保国家目录匹配
 * @author: DingJie
 * @create: 2021-06-10 14:49:29
 **/
@RestController
@RequestMapping("/nationalMatch")
public class NationalMatchController {
    private final NationalMatchService service;

    @Autowired
    public NationalMatchController(NationalMatchService service) {
        this.service = service;
    }

    @PostMapping("/selectLocalItems")
    public ResultVo<Map<String, Object>> selectLocalItems(@RequestBody QueryParam param) {
        return service.selectLocalItems(param);
    }

    @GetMapping("/asyncNewNameForServicesOrItems")
    public ResultVo<String> asyncNewNameForServices() {
        return service.asyncNewNameForServicesOrItems();
    }

    @PostMapping("/selectNationalItems")
    public ResultVo<List> selectNationalItems(@RequestBody StandardLocalItem param) {
        return service.selectNationalItems(param);
    }

    @PostMapping("/executeMatch")
    public ResultVo<String> executeMatch(@RequestBody StandardLocalItem param) {
        return service.executeMatch(param);
    }

    @PostMapping("/cancelMatch")
    public ResultVo<String> cancelMatch(@RequestBody StandardLocalItem param) {
        return service.cancelMatch(param);
    }

    @PostMapping("/updateLocalItem")
    public ResultVo<String> updateLocalItem(@RequestBody StandardLocalItem param) {
        return service.updateLocalItem(param);
    }

    @PassToken
    @GetMapping("/queryPsnPayProp")
    public String queryPsnPayProp(@RequestParam("hiListCode") String hiListCode) {
        return service.queryPsnPayProp(hiListCode, true);
    }
}
