package com.fs.app.controller;

import cn.hutool.json.JSONUtil;
import com.fs.his.config.AgreementConfig;
import com.fs.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping(value="/web")
public class H5Controller
{

    @Autowired
    private ISysConfigService configService;


    @GetMapping("/userAgreement")
    public ModelAndView userAgreement( )
    {

        String json=configService.selectConfigByKey("his.agreementConfig");
        AgreementConfig config= JSONUtil.toBean(json, AgreementConfig.class);

        ModelAndView mv=new ModelAndView();
        mv.addObject("userAgreement", config.getUserRegister());
        mv.setViewName("userAgreement");
        return mv;
    }
    @GetMapping("/privacyPolicy")
    public ModelAndView privacyPolicy( )
    {
        String json=configService.selectConfigByKey("his.agreementConfig");
        AgreementConfig config= JSONUtil.toBean(json, AgreementConfig.class);
        ModelAndView mv=new ModelAndView();
        mv.addObject("privacyPolicy", config.getUserPrivacy());
        mv.setViewName("privacyPolicy");
        return mv;
    }

    @GetMapping("/healthCustomerService")
    public ModelAndView healthCustomerService( )
    {
        String json=configService.selectConfigByKey("his.agreementConfig");
        AgreementConfig config= JSONUtil.toBean(json, AgreementConfig.class);
        ModelAndView mv=new ModelAndView();
        mv.addObject("healthCustomerService", config.getUserHealth());
        mv.setViewName("healthCustomerService");
        return mv;
    }

    @GetMapping("/vipService")
    public ModelAndView vipService( )
    {
        String json=configService.selectConfigByKey("his.agreementConfig");
        AgreementConfig config= JSONUtil.toBean(json, AgreementConfig.class);
        ModelAndView mv=new ModelAndView();
        mv.addObject("vipService", config.getVipService());
        mv.setViewName("vipService");
        return mv;
    }


    @GetMapping("/vipAutomaticService")
    public ModelAndView vipAutomaticService( )
    {
        String json=configService.selectConfigByKey("his.agreementConfig");
        AgreementConfig config= JSONUtil.toBean(json, AgreementConfig.class);
        ModelAndView mv=new ModelAndView();
        mv.addObject("vipAutomaticService", config.getVipAutomaticService());
        mv.setViewName("vipAutomaticService");
        return mv;
    }

    @GetMapping("/userRemoveService")
    public ModelAndView userRemoveService( )
    {
        String json=configService.selectConfigByKey("his.agreementConfig");
        AgreementConfig config= JSONUtil.toBean(json, AgreementConfig.class);
        ModelAndView mv=new ModelAndView();
        mv.addObject("userRemoveService", config.getUserRemoveService());
        mv.setViewName("userRemoveService");
        return mv;
    }


}
