|
@@ -59,28 +59,29 @@ public class CovidVaccinateAppointmentService {
|
|
|
}
|
|
|
param.setAge(age);
|
|
|
param.setSex(IdCardUtil.calSexByIdCard(param.getSocialNo()));
|
|
|
+ String dateFormatted = DateUtil.formatDatetime(param.getExecuteDate(), "yyyy-MM-dd");
|
|
|
if (dao.selectValidAppointment(param.getSocialNo(), param.getExecuteDate()) > 0) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您在【" +
|
|
|
- DateUtil.formatDatetime(param.getExecuteDate(), "yyyy-MM-dd") +
|
|
|
- "】已存在有效的预约,请勿重复预约。");
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您在【" + dateFormatted + "】已存在有效的预约,请勿重复预约。");
|
|
|
+ }
|
|
|
+ Integer threshold = dao.selectThresholdByDate(param.getExecuteDate());
|
|
|
+ if (null == threshold) {
|
|
|
+ dao.insertNewThresholdByDate(param.getExecuteDate());
|
|
|
+ threshold = 150;
|
|
|
}
|
|
|
int count = dao.selectTotalCountByDate(param.getExecuteDate());
|
|
|
- if (count >= 150) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "【" +
|
|
|
- DateUtil.formatDatetime(param.getExecuteDate(), "yyyy-MM-dd") +
|
|
|
- "】的预约名额已满,请选择其他预约日期。");
|
|
|
+ if (count >= threshold) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "【" + dateFormatted + "】的预约名额已满,请选择其他预约日期。");
|
|
|
}
|
|
|
dao.insertNewAppointment(param);
|
|
|
if (null != param.getPatientId() && !param.getPatientId().trim().equals("")) {
|
|
|
dao.updatePhoneAndSocialNo(param.getPatientId(), param.getSocialNo(), param.getPhone());
|
|
|
String msgContent = "{\"touser\":\"\",\"data\":" +
|
|
|
- "{\"keyword2\":{\"color\":\"#173177\",\"value\":\"" +
|
|
|
- DateUtil.formatDatetime(param.getExecuteDate(), "yyyy-MM-dd") + "\"}," +
|
|
|
+ "{\"keyword2\":{\"color\":\"#173177\",\"value\":\"" + dateFormatted + "\"}," +
|
|
|
"\"keyword1\":{\"color\":\"#173177\",\"value\":\"" + param.getName() + "\"}," +
|
|
|
"\"keyword3\":{\"color\":\"#173177\",\"value\":\"" + (++count) + "\"}," +
|
|
|
"\"remark\":{\"color\":\"#FF0000\",\"value\":\"感谢您的使用,祝您健康!\"}," +
|
|
|
"\"first\":{\"color\":\"#FF0000\",\"value\":\"您已成功预约新冠疫苗接种服务。" +
|
|
|
- "请在预约日期当天凭本人身份证在【泰和医院门诊大楼五楼体检中心】接种新冠疫苗。\"}}," +
|
|
|
+ "请于【" + dateFormatted + "】凭本人身份证在【泰和医院门诊大楼五楼体检中心】接种新冠疫苗。\"}}," +
|
|
|
"\"template_id\":\"zVSzbYLmdqq_h1IcTPSwi6X4qFm0j9aTVeLZPxR03Bs\"," +
|
|
|
"\"url\":\"\"}";
|
|
|
PushMessageParam pojo = new PushMessageParam();
|
|
@@ -90,6 +91,7 @@ public class CovidVaccinateAppointmentService {
|
|
|
wxApiService.pushMessage(pojo);
|
|
|
}
|
|
|
log.info("预约新冠疫苗接种:{}", JSONObject.toJSONStringWithDateFormat(param, "yyyy-MM-dd HH:mm:ss"));
|
|
|
- return ResultVoUtil.success("您已成功预约新冠疫苗接种服务。请在预约日期当天凭本人身份证在【泰和医院门诊大楼五楼体检中心】接种新冠疫苗。");
|
|
|
+ return ResultVoUtil.success("您已成功预约新冠疫苗接种服务。请于【" + dateFormatted + "】" +
|
|
|
+ "凭本人身份证在【泰和医院门诊大楼五楼体检中心】接种新冠疫苗。");
|
|
|
}
|
|
|
}
|