AppointmentController.java 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. package thyyxxk.wxservice_server.controller;
  2. import org.springframework.beans.factory.annotation.Autowired;
  3. import org.springframework.validation.annotation.Validated;
  4. import org.springframework.web.bind.annotation.*;
  5. import thyyxxk.wxservice_server.config.auth.PassToken;
  6. import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
  7. import thyyxxk.wxservice_server.entity.BriefPatInfo;
  8. import thyyxxk.wxservice_server.entity.ResultVo;
  9. import thyyxxk.wxservice_server.entity.appointment.*;
  10. import thyyxxk.wxservice_server.service.AppointmentService;
  11. import thyyxxk.wxservice_server.utils.ResultVoUtil;
  12. import thyyxxk.wxservice_server.utils.TokenUtil;
  13. import java.util.List;
  14. import java.util.Map;
  15. /**
  16. * @author dj
  17. */
  18. @RestController
  19. @RequestMapping("/appointment")
  20. public class AppointmentController {
  21. private final AppointmentService service;
  22. @Autowired
  23. public AppointmentController(AppointmentService service) {
  24. this.service = service;
  25. }
  26. @GetMapping("/getAllDepartments")
  27. public ResultVo<List<MzClass>> getAllDepartments() {
  28. List<MzClass> list = service.getAllDepartments();
  29. if (list.isEmpty()) {
  30. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "获取科室分类失败,请联系服务中心。");
  31. }
  32. return ResultVoUtil.success(list);
  33. }
  34. @PassToken
  35. @GetMapping("/refreshMzClasses")
  36. public ResultVo<String> refreshMzClasses() {
  37. return ResultVoUtil.success(service.refreshMzClasses());
  38. }
  39. @GetMapping("/refreshNightMzClasses")
  40. public ResultVo<String> refreshNightMzClasses() {
  41. return ResultVoUtil.success(service.refreshNightMzClasses());
  42. }
  43. @GetMapping("/getAllNightDepartments")
  44. public ResultVo<List<MzClass>> getAllNightDepartments() {
  45. List<MzClass> list = service.getAllNightDepartments();
  46. if (list.isEmpty()) {
  47. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "获取科室分类失败,请联系服务中心。");
  48. }
  49. return ResultVoUtil.success(list);
  50. }
  51. @PostMapping("/getSourcesByDate")
  52. public ResultVo<Map<String, Object>> getSourcesByDate(@RequestBody GetSourcesByDateParam param) {
  53. return ResultVoUtil.success(service.getSourcesByDate(param));
  54. }
  55. @PostMapping("/getDoctorSources")
  56. public ResultVo<List<Map<String, Object>>> getDoctorSources(@RequestBody GetDoctorSourcesParam param) {
  57. return ResultVoUtil.success(service.getDoctorSources(param));
  58. }
  59. @PostMapping("/getDoctorArrangement")
  60. public ResultVo<List<Map<String, Object>>> getDoctorArrangement(@RequestBody GetDoctorSourcesParam param) {
  61. return ResultVoUtil.success(service.getDoctorArrangement(param));
  62. }
  63. @PostMapping("/getGhFee")
  64. public ResultVo<Map<String, Object>> getGhFee(@RequestBody @Validated GetGhFeeParam param) {
  65. Map<String, Object> response = service.getGhFee(param);
  66. if (null == response) {
  67. return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, "获取挂号费用失败,请稍后重试。");
  68. }
  69. return ResultVoUtil.success(response);
  70. }
  71. @GetMapping("/getDoctorInfo")
  72. public ResultVo<DoctorInfo> getDoctorInfo(@RequestParam("doctorCode") String doctorCode) {
  73. DoctorInfo doctorInfo = service.getDoctorInfo(doctorCode);
  74. if (null == doctorInfo) {
  75. return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "未找到医生信息!");
  76. }
  77. return ResultVoUtil.success(doctorInfo);
  78. }
  79. @GetMapping("/checkAppointmentRequirements")
  80. public ResultVo<String> checkAppointmentRequirements(@RequestParam("patientId") String patientId,
  81. @RequestParam("deptCode") String deptCode) {
  82. String response = service.checkAppointmentRequirements(patientId, deptCode);
  83. if (response.startsWith("ERROR:")) {
  84. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, response);
  85. }
  86. return ResultVoUtil.success();
  87. }
  88. @PostMapping("/getSourcesByDateAndDoctor")
  89. public ResultVo<Integer[]> getSourcesByDateAndDoctor(@RequestBody GetDoctorSourcesParam param) {
  90. return ResultVoUtil.success(service.getSourcesByDateAndDoctor(param));
  91. }
  92. @GetMapping("/getDoctorQrCode")
  93. public ResultVo<String> getDoctorQrCode(@RequestParam("doctorCode") String doctorCode) {
  94. return ResultVoUtil.success(service.getDoctorQrCode(doctorCode));
  95. }
  96. @GetMapping("/getPaidMzGhList")
  97. public ResultVo<List<Map<String, String>>> getPaidMzGhList(@RequestParam("patientId") String patientId) {
  98. return ResultVoUtil.success(service.getPaidMzGhList(patientId));
  99. }
  100. @PostMapping("/listMzyReqrec")
  101. public ResultVo<List<MzyReqrec>> listMzyReqrec(@RequestBody BriefPatInfo patInfo) {
  102. return ResultVoUtil.success(service.listMzyReqrec(patInfo));
  103. }
  104. @PostMapping("/getMzyReqrecInfo")
  105. public ResultVo<MzyReqrec> getMzyReqrecInfo(@RequestBody BriefPatInfo patInfo) {
  106. MzyReqrec mzyReqrec = service.getMzyReqrecInfo(patInfo);
  107. if (null == mzyReqrec) {
  108. return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
  109. }
  110. return ResultVoUtil.success(mzyReqrec);
  111. }
  112. @PostMapping("/cancelReqrec")
  113. public ResultVo<String> cancelReqrec(@RequestBody MzyReqrec mzyReq) {
  114. String response = service.cancelReqrec(mzyReq);
  115. if (response.startsWith("ERROR:")) {
  116. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, response);
  117. }
  118. return ResultVoUtil.success("退号成功。");
  119. }
  120. @GetMapping("/getDeptPos")
  121. public ResultVo<String> getDeptPos(@RequestParam("deptCode") String deptCode,
  122. @RequestParam("ampm") String ampm) {
  123. return ResultVoUtil.success(service.getDeptPos(deptCode, ampm));
  124. }
  125. @GetMapping("/clearDeptPos")
  126. public ResultVo<String> clearDeptPos() {
  127. return ResultVoUtil.success(service.clearDeptPos());
  128. }
  129. }