SuggestController.java 1.6 KB

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