package thyyxxk.webserver.controller.medicine;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.dictionary.CodeName;
import thyyxxk.webserver.entity.inpatient.YpZdDict;
import thyyxxk.webserver.entity.medicine.YpPrintName;
import thyyxxk.webserver.entity.medicine.YpZdChargeGroup;
import thyyxxk.webserver.entity.medicine.YpZdClass;
import thyyxxk.webserver.entity.medicine.YpZdDictVo;
import thyyxxk.webserver.entity.medicine.YpZdDosage;
import thyyxxk.webserver.entity.medicine.YpZdDrugKind;
import thyyxxk.webserver.entity.medicine.YpZdManuFactory;
import thyyxxk.webserver.entity.medicine.YpZdSupply;
import thyyxxk.webserver.entity.medicine.YpZdUnit;
import thyyxxk.webserver.service.medicine.YpDictService;

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

/**
 * @ClassName YpDictController
 * @Author Administrator
 * @Date 2023/12/27 16:23
 * @Version 1.0
 * @Description 药品字典
 **/
@RestController
@RequestMapping("/ypDict")
public class YpDictController {

    private final YpDictService service;

    public YpDictController(YpDictService service) {
        this.service = service;
    }

    @GetMapping("/selectYpClass")
    public ResultVo<List<YpZdClass>> selectYpClass(@RequestParam("text") String text){
        return service.selectYpClass(text);
    }

    @PostMapping("/saveYpClass")
    public ResultVo<Map<String, Object>> saveYpClass(@RequestBody @Validated YpZdClass ypZdClass){
        return service.saveYpClass(ypZdClass);
    }

    @GetMapping("/delYpClassByCode")
    public ResultVo<Map<String, Object>> delYpClassByCode(@RequestParam("code") String code){
        return service.delYpClassByCode(code);
    }

    @GetMapping("/selectDrugKind")
    public ResultVo<List<YpZdDrugKind>> selectDrugKind(@RequestParam("text") String text){
        return service.selectDrugKind(text);
    }

    @PostMapping("/saveDrugKind")
    public ResultVo<Map<String, Object>> saveDrugKind(@RequestBody @Validated YpZdDrugKind drugKind){
        return service.saveDrugKind(drugKind);
    }

    @GetMapping("/delDrugKindByCode")
    public ResultVo<Map<String, Object>> delDrugKindByCode(@RequestParam("code") String code){
        return service.delDrugKindByCode(code);
    }

    @GetMapping("/selectYpDosage")
    public ResultVo<List<YpZdDosage>> selectYpDosage(@RequestParam("text") String text){
        return service.selectYpDosage(text);
    }

    @PostMapping("/saveYpDosage")
    public ResultVo<Map<String, Object>> saveYpDosage(@RequestBody @Validated YpZdDosage ypDosage){
        return service.saveYpDosage(ypDosage);
    }

    @GetMapping("/delYpDosageByCode")
    public ResultVo<Map<String, Object>> delYpDosageByCode(@RequestParam("code") String code){
        return service.delYpDosageByCode(code);
    }

    @GetMapping("/selectYpUnit")
    public ResultVo<List<YpZdUnit>> selectYpUnit(@RequestParam("text") String text){
        return service.selectYpUnit(text);
    }

    @PostMapping("/saveYpUnit")
    public ResultVo<Map<String, Object>> saveYpUnit(@RequestBody @Validated YpZdUnit ypUnit){
        return service.saveYpUnit(ypUnit);
    }

    @GetMapping("/delYpUnitByCode")
    public ResultVo<Map<String, Object>> delYpUnitByCode(@RequestParam("code") String code){
        return service.delYpUnitByCode(code);
    }

    @GetMapping("/selectYpChargeGroup")
    public ResultVo<List<YpZdChargeGroup>> selectYpChargeGroup(@RequestParam("text") String text){
        return service.selectYpChargeGroup(text);
    }

    @PostMapping("/saveYpChargeGroup")
    public ResultVo<Map<String, Object>> saveYpChargeGroup(@RequestBody @Validated YpZdChargeGroup ypChargeGroup){
        return service.saveYpChargeGroup(ypChargeGroup);
    }

    @GetMapping("/delYpChargeGroupByCode")
    public ResultVo<Map<String, Object>> delYpChargeGroupByCode(@RequestParam("code") String code){
        return service.delYpChargeGroupByCode(code);
    }

    @GetMapping("/selectYpVisibleFlag")
    public ResultVo<List<Map<String, Object>>> selectYpVisibleFlag(@RequestParam("text") String text){
        return service.selectYpVisibleFlag(text);
    }

    @PostMapping("/updateYpVisibleFlag")
    public ResultVo<Map<String, Object>> updateYpVisibleFlag(@RequestBody @Validated Map<String, Object> map){
        return service.updateYpVisibleFlag(map);
    }

    @GetMapping("/selectYpSupply")
    public ResultVo<List<YpZdSupply>> selectYpSupply(@RequestParam("text") String text){
        return service.selectYpSupply(text);
    }

    @PostMapping("/saveYpSupply")
    public ResultVo<Map<String, Object>> saveYpSupply(@RequestBody @Validated YpZdSupply ypZdSupply){
        return service.saveYpSupply(ypZdSupply);
    }

    @GetMapping("/delYpSupplyByCode")
    public ResultVo<Map<String, Object>> delYpSupplyByCode(@RequestParam("code") String code){
        return service.delYpSupplyByCode(code);
    }

    @GetMapping("/selectYpManuFactory")
    public ResultVo<List<YpZdManuFactory>> selectYpManuFactory(@RequestParam("text") String text){
        return service.selectYpManuFactory(text);
    }

    @PostMapping("/saveYpManuFactory")
    public ResultVo<Map<String, Object>> saveYpManuFactory(@RequestBody @Validated YpZdManuFactory ypZdManuFactory){
        return service.saveYpManuFactory(ypZdManuFactory);
    }

    @GetMapping("/delYpManuFactoryByCode")
    public ResultVo<Map<String, Object>> delYpManuFactoryByCode(@RequestParam("code") String code){
        return service.delYpManuFactoryByCode(code);
    }

    @GetMapping("/selectYpDict")
    public ResultVo<List<Map<String, String>>> selectYpDict(@RequestParam("text") String text,
                                                            @RequestParam("groupNo") String groupNo,
                                                            @RequestParam("isSee") String isSee){
        return service.selectYpDict(text, groupNo, isSee);
    }

    @GetMapping("/updateYpStopOrUsed")
    public ResultVo<Map<String, Object>> updateYpStopOrUsed(@RequestParam("code") String code, @RequestParam("serial") String serial, @RequestParam("delFlag") String delFlag){
        return service.updateYpStopOrUsed(code, serial, delFlag);
    }

    @GetMapping("/selectYpDictByCode")
    public ResultVo<YpZdDict> selectYpDictByCode(@RequestParam("code") String code, @RequestParam("serial") String serial){
        return service.selectYpDictByCode(code, serial);
    }

    @GetMapping("/selectYpDictByCodeNoSerial")
    public ResultVo<List<YpZdDict>> selectYpDictByCodeNoSerial(@RequestParam("code") String code){
        return service.selectYpDictByCodeNoSerial(code);
    }

    @GetMapping("/selectYpDictData")
    public ResultVo<Map<String, List<CodeName>>> selectYpDictData(){
        return service.selectYpDictData();
    }


    @PostMapping("/saveYpDict")
    public ResultVo<Map<String, Object>> saveYpDict(@RequestBody @Validated YpZdDictVo ypZdDictVo){
        return service.saveYpDict(ypZdDictVo);
    }

    @GetMapping("/selectYpPrintNameData")
    public ResultVo<List<YpPrintName>> selectYpPrintNameData(@RequestParam("chargeCode") String chargeCode){
        return service.selectYpPrintNameData(chargeCode);
    }

    @PostMapping("/savePrintName")
    public ResultVo<Map<String, Object>> savePrintName(@RequestBody @Validated YpPrintName ypPrintName){
        return service.savePrintName(ypPrintName);
    }

    @GetMapping("/delYpPrintNameByPrintName")
    public ResultVo<Map<String, Object>> delYpPrintNameByPrintName(@RequestParam("chargeCode") String chargeCode,
                                                                 @RequestParam("printName") String printName){
        return service.delYpPrintNameByPrintName(chargeCode, printName);
    }

    @GetMapping("/selectYpGroupNameByYfFlag")
    public ResultVo<List<CodeName>> selectYpGroupNameByYfFlag(@RequestParam("text") String text, @RequestParam("yfFlag") String yfFlag){
        return service.selectYpGroupNameByYfFlag(text, yfFlag);
    }

    @GetMapping("/selectYpGroupNameAll")
    public ResultVo<List<Map<String, Object>>> selectYpGroupNameAll(@RequestParam("text") String text){
        return service.selectYpGroupNameAll(text);
    }

    @GetMapping("/updateYpTempPurchase")
    public ResultVo<Map<String, Object>> updateYpTempPurchase(@RequestParam("code") String code, @RequestParam("serial") String serial, @RequestParam("tempPurchaseFlag") String tempPurchaseFlag){
        return service.updateYpTempPurchase(code, serial, tempPurchaseFlag);
    }

    @GetMapping("/updateYkYpStopOrUsed")
    public ResultVo<Map<String, Object>> updateYkYpStopOrUsed(@RequestParam("groupNo") String groupNo, @RequestParam("code") String code,
                                                              @RequestParam("serial") String serial, @RequestParam("delFlag") String delFlag){
        return service.updateYkYpStopOrUsed(groupNo, code, serial, delFlag);
    }

    @GetMapping("/updateYpJbFlag")
    public ResultVo<Map<String, Object>> updateYpJbFlag(@RequestParam("code") String code, @RequestParam("serial") String serial, @RequestParam("jbFlag") String jbFlag){
        return service.updateYpJbFlag(code, serial, jbFlag);
    }

    @GetMapping("/selectYpStorageInfo")
    public ResultVo<Map<String, Object>> selectYpStorageInfo(@RequestParam("code") String code, @RequestParam("groupNo") String groupNo){
        return service.selectYpStorageInfo(code, groupNo);
    }

    @GetMapping("/updateYpHighWarning")
    public ResultVo<Map<String, Object>> updateYpHighWarning(@RequestParam("code") String code, @RequestParam("serial") String serial, @RequestParam("flag") String flag){
        return service.updateYpHighWarning(code, serial, flag);
    }

    @GetMapping("/updateYpWinningBidder")
    public ResultVo<Map<String, Object>> updateYpWinningBidder(@RequestParam("code") String code, @RequestParam("serial") String serial, @RequestParam("flag") String flag){
        return service.updateYpWinningBidder(code, serial, flag);
    }

    @GetMapping("/updateYpFocusMonitor")
    public ResultVo<Map<String, Object>> updateYpFocusMonitor(@RequestParam("code") String code, @RequestParam("serial") String serial, @RequestParam("flag") String flag){
        return service.updateYpFocusMonitor(code, serial, flag);
    }

    @GetMapping("/updateYpReturnFlag")
    public ResultVo<Map<String, Object>> updateYpReturnFlag(@RequestParam("code") String code, @RequestParam("serial") String serial, @RequestParam("flag") String flag){
        return service.updateYpReturnFlag(code, serial, flag);
    }

}