OpenApiSmjkController.java 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. package com.yihu.wlyy.web.third;
  2. import com.yihu.wlyy.service.app.archives.PatientEventService;
  3. import com.yihu.wlyy.service.app.archives.PatientRecordService;
  4. import com.yihu.wlyy.web.BaseController;
  5. import io.swagger.annotations.Api;
  6. import io.swagger.annotations.ApiOperation;
  7. import io.swagger.annotations.ApiParam;
  8. import org.json.JSONObject;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.stereotype.Controller;
  11. import org.springframework.web.bind.annotation.RequestMapping;
  12. import org.springframework.web.bind.annotation.RequestMethod;
  13. import org.springframework.web.bind.annotation.RequestParam;
  14. import org.springframework.web.bind.annotation.ResponseBody;
  15. import java.util.*;
  16. /**
  17. * 市民健康档案接口
  18. * @author hzp at 2016-12-19
  19. */
  20. @Controller
  21. @RequestMapping(value = "/third/smjk")
  22. @Api(description = "市民健康档案接口")
  23. public class OpenApiSmjkController extends BaseController {
  24. @Autowired
  25. private PatientRecordService patientRecordService;
  26. @Autowired
  27. private PatientEventService patientEventService;
  28. @ApiOperation("获取门诊记录/住院记录(基卫+APP)")
  29. @RequestMapping(value = "/event", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
  30. @ResponseBody
  31. public String getAllEvent(@ApiParam(name="patient",value="患者代码",defaultValue = "14531c1f0c09442e8017853fd1a0c8b7")
  32. @RequestParam(value="patient",required = false) String patient,
  33. @ApiParam(name="type",value="类型",defaultValue = "")
  34. @RequestParam(value="type",required = false) String type,
  35. @ApiParam(name="page",value="第几页",defaultValue = "1")
  36. @RequestParam(value="page",required = true) String page,
  37. @ApiParam(name="pageSize",value="每页几行",defaultValue = "10")
  38. @RequestParam(value="pageSize",required = true) String pageSize,
  39. @ApiParam(name="lastTime",value="最后一条时间",defaultValue = "")
  40. @RequestParam(value="lastTime",required = false) String lastTime) {
  41. try {
  42. List<Map<String,String>> result = patientRecordService.getAllEvent(patient,type,page,pageSize,lastTime);
  43. return write(200, "获取就诊记录成功!", "data", result);
  44. } catch (Exception e) {
  45. return invalidUserException(e, -1, "获取门/急诊数据失败!");
  46. }
  47. }
  48. @RequestMapping(value = "/event/healthData", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
  49. @ResponseBody
  50. @ApiOperation("获取健康档案详情(基卫)")
  51. public String getHealthData(@ApiParam(name="patient",value="患者代码",defaultValue = "14531c1f0c09442e8017853fd1a0c8b7")
  52. @RequestParam(value="patient",required = false) String patient,
  53. @ApiParam(name="event",value="事件ID",defaultValue = "30d1eb16-bca2-4b39-b413-672b4361e7a7")
  54. @RequestParam(value="event",required = true) String event,
  55. @ApiParam(name="catalog",value="档案类型",defaultValue = "0101")
  56. @RequestParam(value="catalog",required = true) String catalog,
  57. @ApiParam(name="serial",value="该类别顺序号,默认填1",defaultValue = "1")
  58. @RequestParam(value="serial",required = true) String serial) {
  59. try {
  60. String result = patientRecordService.getHealthData(patient, event, catalog, serial);
  61. return write(200, "获取健康档案详情成功!", "data", result);
  62. } catch (Exception e) {
  63. return invalidUserException(e, -1, "获取健康档案详情失败!");
  64. }
  65. }
  66. @RequestMapping(value = "/event/catalog", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
  67. @ResponseBody
  68. @ApiOperation("通过事件号获取档案类型列表(基卫)")
  69. public String getEventCatalog(@ApiParam(name="patient",value="患者代码",defaultValue = "14531c1f0c09442e8017853fd1a0c8b7")
  70. @RequestParam(value="patient",required = false) String patient,
  71. @ApiParam(name="event",value="事件ID",defaultValue = "30d1eb16-bca2-4b39-b413-672b4361e7a7")
  72. @RequestParam(value="event",required = true) String event) {
  73. try {
  74. List<Map<String,String>> result = patientRecordService.getEventCatalog(patient,event);
  75. return write(200, "通过事件号获取档案类型列表成功!", "data", result);
  76. } catch (Exception e) {
  77. return invalidUserException(e, -1, e.getMessage());
  78. }
  79. }
  80. @RequestMapping(value = "/event/drug", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
  81. @ResponseBody
  82. @ApiOperation("获取用药记录(基卫)")
  83. public String getDrugsList(@ApiParam(name="patient",value="患者代码",defaultValue = "14531c1f0c09442e8017853fd1a0c8b7")
  84. @RequestParam(value="patient",required = false) String patient,
  85. @ApiParam(name="page",value="第几页",defaultValue = "1")
  86. @RequestParam(value="page",required = true) String page,
  87. @ApiParam(name="pageSize",value="每页几行",defaultValue = "10")
  88. @RequestParam(value="pageSize",required = true) String pageSize) {
  89. try {
  90. String result = patientRecordService.getDrugsListPage(patient, page, pageSize);
  91. return write(200, "获取用药记录成功!", "data", result);
  92. } catch (Exception e) {
  93. return invalidUserException(e, -1, "获取用药记录失败!");
  94. }
  95. }
  96. @ApiOperation("获取检查检验报告(基卫+APP)")
  97. @RequestMapping(value = "/event/report", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
  98. @ResponseBody
  99. public String getReportList(@ApiParam(name="patient",value="患者代码",defaultValue = "14531c1f0c09442e8017853fd1a0c8b7")
  100. @RequestParam(value="patient",required = false) String patient,
  101. @ApiParam(name="page",value="第几页",defaultValue = "1")
  102. @RequestParam(value="page",required = true) String page,
  103. @ApiParam(name="pageSize",value="每页几行",defaultValue = "10")
  104. @RequestParam(value="pageSize",required = true) String pageSize,
  105. @ApiParam(name="lastTime",value="最后一条时间",defaultValue = "2010-10-10 00:00:00")
  106. @RequestParam(value="lastTime",required = false) String lastTime)
  107. {
  108. try {
  109. List<Map<String,String>> result = patientRecordService.getExamAndLabReport(patient, page, pageSize,lastTime);
  110. return write(200, "获取检查检验报告成功!", "data", result);
  111. } catch (Exception e) {
  112. return invalidUserException(e, -1, "获取检查检验报告失败!");
  113. }
  114. }
  115. /******************************************* 就诊事件管理 **********************************************************/
  116. @RequestMapping(value = "/event/detail", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
  117. @ResponseBody
  118. @ApiOperation("获取就诊事件详情")
  119. public String getEventDetail(@ApiParam(name="event",value="事件ID",defaultValue = "")
  120. @RequestParam(value="event",required = true) String event)
  121. {
  122. try {
  123. JSONObject result = patientEventService.getEventDetail(event);
  124. return write(200, "获取就诊事件详情成功!", "data", result);
  125. } catch (Exception e) {
  126. return invalidUserException(e, -1, "获取就诊事件详情失败!");
  127. }
  128. }
  129. }