SuggestController.java 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package com.yihu.figure.controller;
  2. import com.yihu.figure.model.suggest.Suggest;
  3. import com.yihu.figure.service.SuggestService;
  4. import io.swagger.annotations.Api;
  5. import io.swagger.annotations.ApiOperation;
  6. import io.swagger.annotations.ApiParam;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.http.MediaType;
  9. import org.springframework.web.bind.annotation.RequestMapping;
  10. import org.springframework.web.bind.annotation.RequestMethod;
  11. import org.springframework.web.bind.annotation.RequestParam;
  12. import org.springframework.web.bind.annotation.RestController;
  13. import java.util.List;
  14. import java.util.Map;
  15. /**
  16. * Created by chenweida on 2017/3/7.
  17. */
  18. @RestController
  19. @RequestMapping(value = "/suggest", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
  20. @Api(description = "建议")
  21. public class SuggestController extends BaseController {
  22. @Autowired
  23. private SuggestService suggestService;
  24. @ApiOperation(value = "获取患者建议")
  25. @RequestMapping(value = "getPatientSuggest", method = RequestMethod.GET)
  26. public String getPatientInfo(
  27. @ApiParam(name = "patientCode", value = "患者code", required = true) @RequestParam(value = "patientCode", required = true) String patientCode) {
  28. try {
  29. Map<String, List<Suggest>> patientInfo = suggestService.getPatientSuggest(patientCode);
  30. return write(200, "获取成功!", "suggest", patientInfo);
  31. } catch (Exception e) {
  32. e.printStackTrace();
  33. return error(-1, e.getMessage());
  34. }
  35. }
  36. }