|
@@ -41,6 +41,9 @@ public class AppointmentService {
|
|
|
@Value("${hrgApiUrl}")
|
|
|
private String hrgApiUrl;
|
|
|
|
|
|
+ private static final int[] ampmValue = new int[]{830, 900, 930, 1000, 1030, 1100, 1130, 1200, 1430, 1500, 1530, 1600, 1630, 1700};
|
|
|
+ private static final String[] ampmLabel = new String[]{"a1","a2","a3","a4","a5","a6","a7","a8","p1","p2","p3","p4","p5","p6"};
|
|
|
+
|
|
|
@Autowired
|
|
|
public AppointmentService(AppointmentDao dao, RedisLikeService redis, ElectronicHealthCardService healthCardService, WxRefundService wxRefundService) {
|
|
|
this.dao = dao;
|
|
@@ -219,6 +222,23 @@ public class AppointmentService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.SLIGHTLY_ERROR, data.getResultMessage());
|
|
|
}
|
|
|
data.getData().removeIf(map -> (int) map.get("leftNum") == 0);
|
|
|
+ String today = DateUtil.formatDatetime(new Date(), "yyyy-MM-dd");
|
|
|
+ if (param.getNeedExcludePassedTime() && param.getDate().equals(today)) {
|
|
|
+ int currentHourMinute = DateUtil.parseHourMinuteToInteger();
|
|
|
+ int validAmpmIndex = 0;
|
|
|
+ for (int i = 0; i < ampmValue.length; i++) {
|
|
|
+ if (currentHourMinute < ampmValue[i]) {
|
|
|
+ validAmpmIndex = i;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (Map<String, Object> map : data.getData()) {
|
|
|
+ for (int i = 0; i < validAmpmIndex; i++) {
|
|
|
+ map.remove(ampmLabel[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (data.getData().size() == 0) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.SLIGHTLY_ERROR);
|
|
|
}
|