|
|
@@ -0,0 +1,96 @@
|
|
|
+package thyyxxk.wxservice_server.controller.selfmachine;
|
|
|
+
|
|
|
+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.ResultVo;
|
|
|
+import thyyxxk.wxservice_server.entity.appointment.GetDoctorSourcesParam;
|
|
|
+import thyyxxk.wxservice_server.entity.appointment.GetGhFeeParam;
|
|
|
+import thyyxxk.wxservice_server.entity.appointment.MzClass;
|
|
|
+import thyyxxk.wxservice_server.entity.selfmachine.Yyghinfo;
|
|
|
+import thyyxxk.wxservice_server.factory.thmz.ThmzService;
|
|
|
+import thyyxxk.wxservice_server.factory.thmz.model.SaveAppointmentRequest;
|
|
|
+import thyyxxk.wxservice_server.service.AppointmentService;
|
|
|
+import thyyxxk.wxservice_server.utils.ResultVoUtil;
|
|
|
+import thyyxxk.wxservice_server.utils.SnowFlakeId;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/selfMachine/yygh")
|
|
|
+public class YyghController {
|
|
|
+ private final AppointmentService service;
|
|
|
+ private final ThmzService thmzService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ public YyghController(AppointmentService service, ThmzService thmzService) {
|
|
|
+ this.service = service;
|
|
|
+ this.thmzService = thmzService;
|
|
|
+ }
|
|
|
+
|
|
|
+ @PassToken
|
|
|
+ @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
|
|
|
+ @PostMapping("/getDoctorSources")
|
|
|
+ public ResultVo<List<Map<String, Object>>> getDoctorSources(@RequestBody GetDoctorSourcesParam param) {
|
|
|
+ return ResultVoUtil.success(service.getDoctorSources(param));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PassToken
|
|
|
+ @PostMapping("/getDoctorArrangement")
|
|
|
+ public ResultVo<List<Map<String, Object>>> getDoctorArrangement(@RequestBody GetDoctorSourcesParam param) {
|
|
|
+ return ResultVoUtil.success(service.getDoctorArrangement(param));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PassToken
|
|
|
+ @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);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PassToken
|
|
|
+ @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();
|
|
|
+ }
|
|
|
+
|
|
|
+ @PassToken
|
|
|
+ @PostMapping("/saveRegWithoutCharge")
|
|
|
+ public ResultVo<String> saveRegWithoutCharge(@RequestBody Yyghinfo info) {
|
|
|
+ String sfid = SnowFlakeId.instance().nextId();
|
|
|
+ String psordnum = "PS" + sfid;
|
|
|
+ SaveAppointmentRequest request = new SaveAppointmentRequest.Builder()
|
|
|
+ .mzyRequestId(info.getMzyRequestId()).patientId(info.getPatientId())
|
|
|
+ .totalFee(BigDecimal.ZERO).fundpayAmt(BigDecimal.ZERO)
|
|
|
+ .acctpayAmt(BigDecimal.ZERO).couponAmt(BigDecimal.ZERO)
|
|
|
+ .cashpayAmt(BigDecimal.ZERO).psordnum(psordnum)
|
|
|
+ .agtordnum(sfid).apTime(info.getApTime()).build();
|
|
|
+ String res = thmzService.saveAppointment(request);
|
|
|
+ if (res.startsWith("ERROR:")) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, res);
|
|
|
+ }
|
|
|
+ return ResultVoUtil.success(res);
|
|
|
+ }
|
|
|
+}
|