package thyyxxk.webserver.controller.medicalinsurance;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import thyyxxk.webserver.constants.sidicts.*;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.dictionary.CodeName;
import thyyxxk.webserver.utils.ResultVoUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * @description: 医保字典表入口
 * @author: DingJie
 * @create: 2021/7/2912:11
 */
@RestController
@RequestMapping("/siDict")
public class SiDictController {

    @GetMapping("/getPsnCertTypes")
    public ResultVo<List<CodeName>> getPsnCertTypes() {
        List<CodeName> list = new ArrayList<>();
        for (PsnCertType item : PsnCertType.values()) {
            list.add(new CodeName(item.getCode(), item.getName()));
        }
        return ResultVoUtil.success(list);
    }

    @GetMapping("/getMedAllTypes")
    public ResultVo<List<CodeName>> getMedAllTypes() {
        List<CodeName> list = new ArrayList<>();
        for (MedType item : MedType.values()) {
            list.add(new CodeName(item.getCode(), item.getName()));
        }
        return ResultVoUtil.success(list);
    }

    @GetMapping("/getMedTypesByFlag")
    public ResultVo<List<CodeName>> getMedTypesByFlag(@RequestParam("flag") String flag) {
        List<CodeName> list = new ArrayList<>();
        for (MedType item : MedType.values()) {
            if (item.getFlag().equalsIgnoreCase(flag)) {
                list.add(new CodeName(item.getCode(), item.getName()));
            }
        }
        return ResultVoUtil.success(list);
    }

    @GetMapping("/getDiagTypes")
    public ResultVo<List<CodeName>> getDiagTypes() {
        List<CodeName> list = new ArrayList<>();
        for (DiagType item : DiagType.values()) {
            list.add(new CodeName(item.getCode(), item.getName()));
        }
        return ResultVoUtil.success(list);
    }

    @GetMapping("/getHospTypes")
    public ResultVo<List<CodeName>> getHospTypes() {
        List<CodeName> list = new ArrayList<>();
        for (FixmedinsType item : FixmedinsType.values()) {
            list.add(new CodeName(item.getCode(), item.getName()));
        }
        return ResultVoUtil.success(list);
    }

    @GetMapping("/getReflTypes")
    public ResultVo<List<CodeName>> getReflTypes() {
        List<CodeName> list = new ArrayList<>();
        for (ReflType item : ReflType.values()) {
            list.add(new CodeName(item.getCode(), item.getName()));
        }
        return ResultVoUtil.success(list);
    }

    @GetMapping("/getCertTypes")
    public ResultVo<List<CodeName>> getCertTypes() {
        List<CodeName> list = new ArrayList<>();
        for (PsnCertType item : PsnCertType.values()) {
            list.add(new CodeName(item.getCode(), item.getName()));
        }
        return ResultVoUtil.success(list);
    }

    @GetMapping("/getBizAppyTypes")
    public ResultVo<List<CodeName>> getBizAppyTypes() {
        List<CodeName> list = new ArrayList<>();
        for (BizAppyType item : BizAppyType.values()) {
            list.add(new CodeName(item.getCode(), item.getName()));
        }
        return ResultVoUtil.success(list);
    }

    @GetMapping("/getAgnterRlts")
    public ResultVo<List<CodeName>> getAgnterRlts() {
        List<CodeName> list = new ArrayList<>();
        for (AgnterRlts item : AgnterRlts.values()) {
            list.add(new CodeName(item.getCode(), item.getName()));
        }
        return ResultVoUtil.success(list);
    }

    @GetMapping("/getCatalogues")
    public ResultVo<List<CodeName>> getCatalogues() {
        List<CodeName> list = new ArrayList<>();
        for (Catalogue item : Catalogue.values()) {
            list.add(new CodeName(item.getCode(), item.getName()));
        }
        return ResultVoUtil.success(list);
    }

    @GetMapping("/getInsutypes")
    public ResultVo<List<CodeName>> getInsutypes() {
        List<CodeName> list = new ArrayList<>();
        for (Insutype item : Insutype.values()) {
            list.add(new CodeName(item.getCode(), item.getName()));
        }
        return ResultVoUtil.success(list);
    }

    @GetMapping("/getClrTypes")
    public ResultVo<List<CodeName>> getClrTypes() {
        List<CodeName> list = new ArrayList<>();
        for (ClrType item : ClrType.values()) {
            list.add(new CodeName(item.getCode(), item.getName()));
        }
        return ResultVoUtil.success(list);
    }

    @GetMapping("/getMatnTypes")
    public ResultVo<List<CodeName>> getMatnTypes() {
        List<CodeName> list = new ArrayList<>();
        for (MatnType item : MatnType.values()) {
            list.add(new CodeName(item.getCode(), item.getName()));
        }
        return ResultVoUtil.success(list);
    }

}
