|
@@ -32,15 +32,17 @@ public class AppointmentService {
|
|
private final AppointmentDao dao;
|
|
private final AppointmentDao dao;
|
|
private final RedisLikeService redis;
|
|
private final RedisLikeService redis;
|
|
private final ElectronicHealthCardService healthCardService;
|
|
private final ElectronicHealthCardService healthCardService;
|
|
|
|
+ private final WxRefundService wxRefundService;
|
|
|
|
|
|
@Value("${hrgApiUrl}")
|
|
@Value("${hrgApiUrl}")
|
|
private String hrgApiUrl;
|
|
private String hrgApiUrl;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- public AppointmentService(AppointmentDao dao, RedisLikeService redis, ElectronicHealthCardService healthCardService) {
|
|
|
|
|
|
+ public AppointmentService(AppointmentDao dao, RedisLikeService redis, ElectronicHealthCardService healthCardService, WxRefundService wxRefundService) {
|
|
this.dao = dao;
|
|
this.dao = dao;
|
|
this.redis = redis;
|
|
this.redis = redis;
|
|
this.healthCardService = healthCardService;
|
|
this.healthCardService = healthCardService;
|
|
|
|
+ this.wxRefundService = wxRefundService;
|
|
}
|
|
}
|
|
|
|
|
|
public ResultVo<List<MzClass>> getAllDepartments() {
|
|
public ResultVo<List<MzClass>> getAllDepartments() {
|
|
@@ -249,8 +251,8 @@ public class AppointmentService {
|
|
return ThmzUtil.getResultVoCompletableFuture(hrgResponse);
|
|
return ThmzUtil.getResultVoCompletableFuture(hrgResponse);
|
|
}
|
|
}
|
|
|
|
|
|
- public ResultVo<List<MzyReqrec>> listMzyReqrecUnPay(BriefPatInfo patInfo) {
|
|
|
|
- String url = hrgApiUrl + "/listMzyReqrecUnPay?patientId=" + patInfo.getPatientId();
|
|
|
|
|
|
+ public ResultVo<List<MzyReqrec>> listMzyReqrec(BriefPatInfo patInfo) {
|
|
|
|
+ String url = hrgApiUrl + "/listMzyReqrec?patientId=" + patInfo.getPatientId() + "&payMark=" + patInfo.getPayMark();
|
|
JSONObject response = new RestTemplate().getForObject(url, JSONObject.class);
|
|
JSONObject response = new RestTemplate().getForObject(url, JSONObject.class);
|
|
if (null == response) {
|
|
if (null == response) {
|
|
return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
@@ -297,7 +299,7 @@ public class AppointmentService {
|
|
return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
|
|
return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
|
|
}
|
|
}
|
|
MzyReqrec mzyReqrec = JSONObject.parseObject(JSONObject.toJSONString(data), MzyReqrec.class);
|
|
MzyReqrec mzyReqrec = JSONObject.parseObject(JSONObject.toJSONString(data), MzyReqrec.class);
|
|
- if (StringUtil.notBlank(mzyReqrec.getPaymode())) {
|
|
|
|
|
|
+ if (patInfo.filterUnpaidReq() && StringUtil.notBlank(mzyReqrec.getPaymode())) {
|
|
return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
|
|
return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
|
|
}
|
|
}
|
|
mzyReqrec.setDoctorCode(redis.getEmployeeName(mzyReqrec.getDoctorCode()));
|
|
mzyReqrec.setDoctorCode(redis.getEmployeeName(mzyReqrec.getDoctorCode()));
|
|
@@ -305,4 +307,32 @@ public class AppointmentService {
|
|
mzyReqrec.setAmpm(redis.getAmpmName(mzyReqrec.getAmpm()));
|
|
mzyReqrec.setAmpm(redis.getAmpmName(mzyReqrec.getAmpm()));
|
|
return ResultVoUtil.success(mzyReqrec);
|
|
return ResultVoUtil.success(mzyReqrec);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public ResultVo<String> cancelReqrec(MzyReqrec mzyReq) {
|
|
|
|
+ if (invalidCancelReqrec(mzyReq)) {
|
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "仅支持最近15天内尚未就诊的微信自助挂号。");
|
|
|
|
+ }
|
|
|
|
+ String url = hrgApiUrl + "/cancelReqrec";
|
|
|
|
+ JSONObject params = new JSONObject();
|
|
|
|
+ params.put("patientId", mzyReq.getPatientId());
|
|
|
|
+ params.put("times", mzyReq.getTimes());
|
|
|
|
+ JSONObject response = new RestTemplate().postForObject(url, params, JSONObject.class);
|
|
|
|
+ log.info("自助退号:参数:{};结果:{}", params, response);
|
|
|
|
+ if (null == response) {
|
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
|
+ }
|
|
|
|
+ Integer rescode = response.getInteger("code");
|
|
|
|
+ if (null == rescode) {
|
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
|
+ }
|
|
|
|
+ if (rescode != 0) {
|
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, response.getString("message"));
|
|
|
|
+ }
|
|
|
|
+ return wxRefundService.autoRefund(mzyReq.getPsordnum(), "自助退号。");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private boolean invalidCancelReqrec(MzyReqrec mzyReq) {
|
|
|
|
+ return DateUtil.dateDiff(mzyReq.getRequestDayStr()) > 15 || null == mzyReq.getPaymode()
|
|
|
|
+ || mzyReq.getVisitedMark().equals("1") || mzyReq.getCancelMark().equals("1");
|
|
|
|
+ }
|
|
}
|
|
}
|