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

import io.swagger.annotations.Api;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yihu.wlyy.service.app.health.PatientHealthGuidanceService;
import com.yihu.wlyy.web.BaseController;

/**
 * 患者端：健康指导控制类
 * @author George
 *
 */
@Controller
@RequestMapping(value = "/patient/health/guidance")
@Api(description = "患者端-健康指导")
public class PatientHealthGuidanceController extends BaseController {

	@Autowired
	private PatientHealthGuidanceService patientHealthGuidanceService;

	/**
	 * 查询患者的健康指导
	 * @param patient
	 * @return
	 */
	@RequestMapping(value = "list")
	@ResponseBody
	public String list(long id, int pagesize) {
		try {
			JSONArray array = patientHealthGuidanceService.findGuidanceByPatient(getUID(), id, pagesize);
			return write(200, "查询成功！", "list", array);
		} catch (Exception e) {
			error(e);
			return error(-1, "查询失败！");
		}
	}
}
