PatientInterveneController.java 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. package com.yihu.wlyy.web.patient.intervene;
  2. import java.util.List;
  3. import io.swagger.annotations.Api;
  4. import org.json.JSONArray;
  5. import org.json.JSONObject;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.data.domain.Page;
  8. import org.springframework.http.MediaType;
  9. import org.springframework.stereotype.Controller;
  10. import org.springframework.web.bind.annotation.RequestMapping;
  11. import org.springframework.web.bind.annotation.RequestMethod;
  12. import org.springframework.web.bind.annotation.ResponseBody;
  13. import com.yihu.wlyy.entity.patient.PatientInspectionSuggest;
  14. import com.yihu.wlyy.entity.patient.PatientSelfInspection;
  15. import com.yihu.wlyy.entity.patient.PatientSelfInspectionItem;
  16. import com.yihu.wlyy.service.app.intervene.PatientInspectionService;
  17. import com.yihu.wlyy.util.DateUtil;
  18. import com.yihu.wlyy.web.BaseController;
  19. /**
  20. * 患者端:干预控制类
  21. * @author George
  22. *
  23. */
  24. @Controller
  25. @RequestMapping(value = "/patient/intervene", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, method = RequestMethod.GET)
  26. @Api(description = "患者端-干预控制")
  27. public class PatientInterveneController extends BaseController {
  28. @Autowired
  29. private PatientInspectionService patientInspectionService;
  30. /**
  31. * 患者检查建议查询接口
  32. * @param patient
  33. * @param id
  34. * @param pagesize
  35. * @return
  36. */
  37. @RequestMapping(value = "inspection_list")
  38. @ResponseBody
  39. public String inspection(long id, int pagesize) {
  40. try {
  41. Page<PatientInspectionSuggest> list = patientInspectionService.findSuggestByPatient(getUID(), id, pagesize);
  42. JSONArray array = new JSONArray();
  43. if (list != null) {
  44. for (PatientInspectionSuggest suggest : list) {
  45. if (suggest == null) {
  46. continue;
  47. }
  48. JSONObject json = new JSONObject();
  49. json.put("id", suggest.getId());
  50. json.put("content", suggest.getContent());
  51. json.put("czrq", DateUtil.dateToStrLong(suggest.getCzrq()));
  52. array.put(json);
  53. }
  54. }
  55. return write(200, "查询成功!", "list", array);
  56. } catch (Exception e) {
  57. error(e);
  58. return error(-1, "查询失败!");
  59. }
  60. }
  61. /**
  62. * 查询指定患者的体测提醒
  63. * @param patient
  64. * @param id
  65. * @param pagesize
  66. * @return
  67. */
  68. @RequestMapping(value = "self_exam_list")
  69. @ResponseBody
  70. public String selfExamList(long id, int pagesize) {
  71. try {
  72. Page<PatientSelfInspection> list = patientInspectionService.findSelfExamByPatient(getUID(), id, pagesize);
  73. JSONArray array = new JSONArray();
  74. if (list != null) {
  75. for (PatientSelfInspection psi : list) {
  76. if (psi == null) {
  77. continue;
  78. }
  79. JSONObject json = new JSONObject();
  80. json.put("id", psi.getId());
  81. json.put("code", psi.getCode());
  82. json.put("type", psi.getType());
  83. json.put("czrq", DateUtil.dateToStrLong(psi.getCzrq()));
  84. array.put(json);
  85. }
  86. }
  87. return write(200, "查询成功!", "list", array);
  88. } catch (Exception e) {
  89. error(e);
  90. return error(-1, "查询失败!");
  91. }
  92. }
  93. /**
  94. * 查询体检提醒信息
  95. * @param inspection 提醒标识
  96. * @return
  97. */
  98. @RequestMapping(value = "self_exam_info")
  99. @ResponseBody
  100. public String selfExamInfo(String inspection) {
  101. try {
  102. List<PatientSelfInspectionItem> list = patientInspectionService.findSelfExamInfo(inspection);
  103. JSONArray array = new JSONArray();
  104. if (list != null) {
  105. for (PatientSelfInspectionItem psii : list) {
  106. if (psii == null) {
  107. continue;
  108. }
  109. JSONObject json = new JSONObject();
  110. // 设备名称
  111. json.put("deviceName", psii.getDeviceName());
  112. // 提醒说明
  113. json.put("content", psii.getContent());
  114. array.put(json);
  115. }
  116. }
  117. return write(200, "查询成功!", "list", array);
  118. } catch (Exception e) {
  119. error(e);
  120. return error(-1, "查询失败!");
  121. }
  122. }
  123. }