123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- package thyyxxk.wxservice_server.controller;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.validation.annotation.Validated;
- import org.springframework.web.bind.annotation.*;
- import thyyxxk.wxservice_server.config.auth.PassToken;
- import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
- import thyyxxk.wxservice_server.entity.BriefPatInfo;
- import thyyxxk.wxservice_server.entity.ResultVo;
- import thyyxxk.wxservice_server.entity.appointment.*;
- import thyyxxk.wxservice_server.service.AppointmentService;
- import thyyxxk.wxservice_server.utils.ResultVoUtil;
- import thyyxxk.wxservice_server.utils.TokenUtil;
- import java.util.List;
- import java.util.Map;
- /**
- * @author dj
- */
- @RestController
- @RequestMapping("/appointment")
- public class AppointmentController {
- private final AppointmentService service;
- @Autowired
- public AppointmentController(AppointmentService service) {
- this.service = service;
- }
- @GetMapping("/getAllDepartments")
- public ResultVo<List<MzClass>> getAllDepartments() {
- List<MzClass> list = service.getAllDepartments();
- if (list.isEmpty()) {
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "获取科室分类失败,请联系服务中心。");
- }
- return ResultVoUtil.success(list);
- }
- @PassToken
- @GetMapping("/refreshMzClasses")
- public ResultVo<String> refreshMzClasses() {
- return ResultVoUtil.success(service.refreshMzClasses());
- }
- @GetMapping("/refreshNightMzClasses")
- public ResultVo<String> refreshNightMzClasses() {
- return ResultVoUtil.success(service.refreshNightMzClasses());
- }
- @GetMapping("/getAllNightDepartments")
- public ResultVo<List<MzClass>> getAllNightDepartments() {
- List<MzClass> list = service.getAllNightDepartments();
- if (list.isEmpty()) {
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "获取科室分类失败,请联系服务中心。");
- }
- return ResultVoUtil.success(list);
- }
- @PostMapping("/getSourcesByDate")
- public ResultVo<Map<String, Object>> getSourcesByDate(@RequestBody GetSourcesByDateParam param) {
- return ResultVoUtil.success(service.getSourcesByDate(param));
- }
- @PostMapping("/getDoctorSources")
- public ResultVo<List<Map<String, Object>>> getDoctorSources(@RequestBody GetDoctorSourcesParam param) {
- return ResultVoUtil.success(service.getDoctorSources(param));
- }
- @PostMapping("/getDoctorArrangement")
- public ResultVo<List<Map<String, Object>>> getDoctorArrangement(@RequestBody GetDoctorSourcesParam param) {
- return ResultVoUtil.success(service.getDoctorArrangement(param));
- }
- @PostMapping("/getGhFee")
- public ResultVo<Map<String, Object>> getGhFee(@RequestBody @Validated GetGhFeeParam param) {
- Map<String, Object> response = service.getGhFee(param);
- if (null == response) {
- return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, "获取挂号费用失败,请稍后重试。");
- }
- return ResultVoUtil.success(response);
- }
- @GetMapping("/getDoctorInfo")
- public ResultVo<DoctorInfo> getDoctorInfo(@RequestParam("doctorCode") String doctorCode) {
- DoctorInfo doctorInfo = service.getDoctorInfo(doctorCode);
- if (null == doctorInfo) {
- return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "未找到医生信息!");
- }
- return ResultVoUtil.success(doctorInfo);
- }
- @GetMapping("/checkAppointmentRequirements")
- public ResultVo<String> checkAppointmentRequirements(@RequestParam("patientId") String patientId,
- @RequestParam("deptCode") String deptCode) {
- String response = service.checkAppointmentRequirements(patientId, deptCode);
- if (response.startsWith("ERROR:")) {
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, response);
- }
- return ResultVoUtil.success();
- }
- @PostMapping("/getSourcesByDateAndDoctor")
- public ResultVo<Integer[]> getSourcesByDateAndDoctor(@RequestBody GetDoctorSourcesParam param) {
- return ResultVoUtil.success(service.getSourcesByDateAndDoctor(param));
- }
- @GetMapping("/getDoctorQrCode")
- public ResultVo<String> getDoctorQrCode(@RequestParam("doctorCode") String doctorCode) {
- return ResultVoUtil.success(service.getDoctorQrCode(doctorCode));
- }
- @GetMapping("/getPaidMzGhList")
- public ResultVo<List<Map<String, String>>> getPaidMzGhList(@RequestParam("patientId") String patientId) {
- return ResultVoUtil.success(service.getPaidMzGhList(patientId));
- }
- @PostMapping("/listMzyReqrec")
- public ResultVo<List<MzyReqrec>> listMzyReqrec(@RequestBody BriefPatInfo patInfo) {
- return ResultVoUtil.success(service.listMzyReqrec(patInfo));
- }
- @PostMapping("/getMzyReqrecInfo")
- public ResultVo<MzyReqrec> getMzyReqrecInfo(@RequestBody BriefPatInfo patInfo) {
- MzyReqrec mzyReqrec = service.getMzyReqrecInfo(patInfo);
- if (null == mzyReqrec) {
- return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
- }
- return ResultVoUtil.success(mzyReqrec);
- }
- @PostMapping("/cancelReqrec")
- public ResultVo<String> cancelReqrec(@RequestBody MzyReqrec mzyReq) {
- String response = service.cancelReqrec(mzyReq);
- if (response.startsWith("ERROR:")) {
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, response);
- }
- return ResultVoUtil.success("退号成功。");
- }
- @GetMapping("/getDeptPos")
- public ResultVo<String> getDeptPos(@RequestParam("deptCode") String deptCode,
- @RequestParam("ampm") String ampm) {
- return ResultVoUtil.success(service.getDeptPos(deptCode, ampm));
- }
- @GetMapping("/clearDeptPos")
- public ResultVo<String> clearDeptPos() {
- return ResultVoUtil.success(service.clearDeptPos());
- }
- }
|