package com.yihu.wlyy.web.data;

import com.yihu.wlyy.entity.organization.HospitalDept;
import com.yihu.wlyy.service.app.consult.ConsultTeamService;
import com.yihu.wlyy.service.app.sign.FamilyContractService;
import com.yihu.wlyy.web.BaseController;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by Administrator on 2016.10.08.
 * 修改历史数据处理控制器
 */
@Controller
@RequestMapping(value = "/dataHandling", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class DataHandlingController extends BaseController {

    @Autowired
    private FamilyContractService familyContractService;
    @Autowired
    private ConsultTeamService consultTeamService;
    @Autowired
    private DataHandingService dataHandingService;
    /**
     * 生成签约表中的行政团队的code
     */
    @RequestMapping(value = "produceSignAdminTeamCode")
    @ResponseBody
    public String produceSignAdminTeamCode() {
        try {
            return write(200, familyContractService.produceSignAdminTeamCode());
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }

    /**
     * 生成咨询表中中的行政团队的code
     * @return
     */
    @RequestMapping(value = "produceConsultAdminTeamCode")
    @ResponseBody
    public String produceConsultAdminTeamCode() {
        try {
            return write(200, consultTeamService.produceConsultAdminTeamCode());
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }

    /**
     * 生成医生和患者表中有身份的用户的密码
     * @return
     */
    @RequestMapping(value = "producePatientAndDoctorPassword")
    @ResponseBody
    public String producePatientAndDoctorPasswor() {
        try {
            return write(200, dataHandingService.producePatientAndDoctorPassword());
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
}
