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

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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yihu.wlyy.service.app.talk.TalkGroupService;
import com.yihu.wlyy.web.BaseController;

@Controller
@RequestMapping(value = "/patient/talkgroup", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "患者端-讨论组")
public class PatientDiscussionGroupController extends BaseController {

	@Autowired
	private TalkGroupService talkGroupService;
	
	@RequestMapping(value = "consult")
	@ResponseBody
	public String getConsultTalkGroup(@RequestParam(required = true)String consult){
		try{
			JSONObject object = talkGroupService.findConsultTalkGroup(consult);
			return write(200, "查询咨询对应讨论组成功!","data",object);
		}catch(Exception e){
			return error(-1, "查询咨询对应讨论组失败!");
		}
	}
}
