package com.yihu.wlyy.statistics.controller;

import com.fasterxml.jackson.databind.deser.Deserializers;
import com.yihu.wlyy.statistics.task.PatientDiseaseToLabel;
import com.yihu.wlyy.statistics.task.PatientGroupToLabelRunnable;
import com.yihu.wlyy.statistics.task.SignTeamAndGroupRunnable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by lyr-pc on 2016/10/12.
 */
@RestController
@RequestMapping(value = "/data_process")
public class DataProcessController extends BaseController {

    /**
     * 签约同步数据设置团队和分组
     *
     * @return
     */
    @RequestMapping(value = "/sign_team_group_thread")
    public String setTeamGroupPage(long start,long end){
        try {
            new Thread(new SignTeamAndGroupRunnable(start,end)).start();
            return write(200,"启动成功");
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "启动失败");
        }
    }

    /**
     * 签约同步数据设置团队和分组
     *
     * @return
     */
    @RequestMapping(value = "/disease_to_label_thread")
    public String diseaseToLabel(long start){
        try {
            new Thread(new PatientDiseaseToLabel(start)).start();
            return write(200,"启动成功");
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "启动失败");
        }
    }

    /**
     * 签约同步数据设置团队和分组
     *
     * @return
     */
    @RequestMapping(value = "/group_to_label_thread")
    public String diseaseToLabel(long start,long end){
        try {
            new Thread(new PatientGroupToLabelRunnable(start,end)).start();
            return write(200,"启动成功");
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "启动失败");
        }
    }
}
