package thyyxxk.webserver.service.shitijian;

import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import thyyxxk.webserver.constants.sidicts.SiTj;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.shitijian.TiJianPiPeiPojo;
import thyyxxk.webserver.entity.shitijian.TiJianUploadInfosPojo;
import thyyxxk.webserver.entity.shitijian.TiJianYuYuePojo;
import thyyxxk.webserver.utils.SiTjResTemplate;

import java.util.List;

/**
 * @description: 体检服务
 * @author: DingJie
 * @create: 2021/7/1316:25
 */
@Slf4j
@Service
public class SiTjService {
    @Value("${si-tj-url}")
    private String siTjUrl;

    @Autowired
    private SiTjResTemplate siTjResTemplate;


    public ResultVo<Object> getTiJianTaoCanMuLu(String year) {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("year", year);
        return siTjResTemplate.getSiTjRest(siTjUrl + "/service", SiTj.ZX_TI_JIAN_TAO_CAN_MU_LU_XIA_FA, jsonObject);
    }

    public ResultVo<Object> yiSiZhenDuanMuLu(String year) {
        JSONObject js = new JSONObject();
        js.put("year", year);
        return siTjResTemplate.getSiTjRest(siTjUrl + "/service", SiTj.ZX_YI_SI_ZHEN_DUAN_MU_LU_XIA_FA, js);
    }

    public ResultVo<Object> tiJianZhiBiaoMulu(String year) {
        JSONObject js = new JSONObject();
        js.put("year", year);
        return siTjResTemplate.getSiTjRest(siTjUrl + "/service", SiTj.ZX_TI_JIAN_ZHI_BIAO_MU_LU_XIA_FA, js);
    }

    public ResultVo<Object> tiJianTaoCanPipei(List<TiJianPiPeiPojo> list) {
        JSONObject js = new JSONObject();
        js.put("HisPackageMatchInfo", list);
        return siTjResTemplate.getSiTjRest(siTjUrl + "/service", SiTj.TI_JIAN_TAO_CAN_PI_PEI, js);
    }

    public ResultVo<Object> yiShiZhenDuanPiPei(List<String> param) {
        JSONObject js = new JSONObject();
        js.put("HisPackageMatchInfo", param);
        return siTjResTemplate.getSiTjRest(siTjUrl + "/service", SiTj.YI_SI_ZHEN_DUAN_PIP_PEI, js);
    }

    public ResultVo<Object> tiJianZhiBiaoPiPei(List<TiJianPiPeiPojo> param) {
        JSONObject js = new JSONObject();
        js.put("IndexMatchInfo", param);
        return siTjResTemplate.getSiTjRest(siTjUrl + "/service", SiTj.TI_ZHI_PI_PEI, js);
    }

    public ResultVo<Object> quXiaoTiJianTaoCanPiPei(List<String> param) {
        JSONObject js = new JSONObject();
        js.put("PackageMatchInfoIds", param);
        return siTjResTemplate.getSiTjRest(siTjUrl + "/service", SiTj.QU_XIAO_TAO_CAN_PI_PEI, js);
    }

    public ResultVo<Object> quXiaoYiSiZhenDuanPiPei(List<String> param) {
        JSONObject js = new JSONObject();
        js.put("IllnessMatchInfoIds", param);
        return siTjResTemplate.getSiTjRest(siTjUrl + "/service", SiTj.QU_XIAO_YI_SI_ZHEN_DUAN_PI_PEI, js);
    }

    public ResultVo<Object> quXiaoTiJianZhiBiaoPiPei(List<String> param) {
        JSONObject js = new JSONObject();
        js.put("indexMatchInfoIds", param);
        return siTjResTemplate.getSiTjRest(siTjUrl + "/service", SiTj.QU_XIAO_TI_JIAN_ZHI_BIAO_PI_PEI, js);
    }

    public ResultVo<Object> tiJianTaoCanPiPeiChaXun(TiJianPiPeiPojo param) {
        String js = JSONObject.toJSONString(param);
        return siTjResTemplate.getSiTjRest(siTjUrl + "/service", SiTj.QU_XIAO_TI_JIAN_ZHI_BIAO_PI_PEI, JSONObject.parseObject(js));
    }

    public ResultVo<Object> yiSiZhenDuanPiPeiChaXun(TiJianPiPeiPojo param) {
        String js = JSONObject.toJSONString(param);
        return siTjResTemplate.getSiTjRest(siTjUrl + "/service", SiTj.YI_SI_ZHEN_DUAN_PI_PEI_CHA_XUN, JSONObject.parseObject(js));
    }

    public ResultVo<Object> tiJianZhiBiaoPiPeiChaXun(TiJianPiPeiPojo param) {
        String js = JSONObject.toJSONString(param);
        return siTjResTemplate.getSiTjRest(siTjUrl + "/service", SiTj.YI_SI_ZHEN_DUAN_PI_PEI_CHA_XUN, JSONObject.parseObject(js));
    }

    public ResultVo<Object> tiJianShouFeiXiangMuMuLu(String year) {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("year", year);
        return siTjResTemplate.getSiTjRest(siTjUrl + "/service", SiTj.ZX_TI_JIAN_SHOU_FEI_XIANG_MU_MU_LU_XIA_FA, jsonObject);
    }

    public ResultVo<Object> tiJianRenYuanXinXi(TiJianYuYuePojo param) {
        String js = JSONObject.toJSONString(param);
        return siTjResTemplate.getSiTjRest(siTjUrl + "/service", SiTj.TI_JIAN_REN_YUAN_JI_BEN_BEI_AN_XIN_XI, JSONObject.parseObject(js));
    }

    public ResultVo<Object> tiJianRenYuanTaoCanMingXi(TiJianYuYuePojo param) {
        String js = JSONObject.toJSONString(param);
        return siTjResTemplate.getSiTjRest(siTjUrl + "/service", SiTj.TI_JIAN_REN_YUAN_TAO_CAN_MING_XI, JSONObject.parseObject(js));
    }

    public ResultVo<Object> tiJianXinXiCaiJiYuJieSuan(List<TiJianUploadInfosPojo> param) {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("uploadInfos", param);
        return siTjResTemplate.getSiTjRest(siTjUrl + "/service", SiTj.TI_JIAN_XIN_XI_CAI_JI_YU_JIE_SUAN, jsonObject);
    }

    public ResultVo<Object> yeWuHuiTui(TiJianYuYuePojo param) {
        String js = JSONObject.toJSONString(param);
        return siTjResTemplate.getSiTjRest(siTjUrl + "/service", SiTj.YE_WU_HUI_TUI, JSONObject.parseObject(js));
    }

    public ResultVo<Object> tiJianXinXiChaXun(TiJianYuYuePojo param) {
        String js = JSONObject.toJSONString(param);
        return siTjResTemplate.getSiTjRest(siTjUrl + "/service", SiTj.TI_JIAN_XIN_XI_CHA_XUN, JSONObject.parseObject(js));
    }
}
