package com.yihu.wlyy.web.patient.sign;

import com.yihu.wlyy.service.app.sign.FamilyContractService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
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.ResponseBody;

/**
 * Created by Administrator on 2016.08.26.
 */
@Controller
@RequestMapping(value = "/family_contract/homepage", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "家庭查询-无过滤")
public class FamilyWithoutFilterController extends BaseController {

    @Autowired
    private FamilyContractService familyContractService;
    /**
     * 医生主页信息查询接口
     * @param doctor 医生标识
     * @return
     */
    @RequestMapping(value = "homepage")
    @ResponseBody
    public String homepage(String doctor) {
        try {
            JSONObject json = familyContractService.findDoctorMainPage(getUID(), doctor);

            if (json == null) {
                return error(-1, "医生主页查询失败！");
            }
            return write(200, "医生主页查询成功！", "data", json);
        } catch (Exception e) {
            error(e);
            return error(-1, "医生主页查询失败！");
        }
    }
}
