diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java index ff805e2..5df476e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java @@ -666,6 +666,13 @@ public class AppController extends BaseController tRecord.setPatientId(patientId); tRecord.setDoctorId(getUserId()); tRecord.setStatus("0"); + // 新增预约限制:同一个医生 一天只能预约一次; + tRecord.setAppointmentTime(DateUtils.dateTime(new Date())); + List tRecords = tRecordService.selectTRecordList(tRecord); + if (!CollectionUtils.isEmpty(tRecords)) { + String appointmentTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS ,tRecords.get(0).getCreateTime()); + return AjaxResult.error("同一个医生,一天只能预约一次;您今天已经在" + appointmentTime + "预约"); + } tRecord.setCreateBy(getUsername()); tRecordService.insertTRecord(tRecord); TPatientHospitalDoctor tPatientHospitalDoctor = new TPatientHospitalDoctor(); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/TRecord.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/TRecord.java index 3ad0fb2..1d19875 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/TRecord.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/TRecord.java @@ -79,6 +79,8 @@ public class TRecord extends BaseEntity @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date aiResultModifyTime; + private String appointmentTime; + public void setId(Long id) { this.id = id; @@ -217,6 +219,14 @@ public class TRecord extends BaseEntity this.aiResultModifyTime = aiResultModifyTime; } + public String getAppointmentTime() { + return appointmentTime; + } + + public void setAppointmentTime(String appointmentTime) { + this.appointmentTime = appointmentTime; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -232,6 +242,7 @@ public class TRecord extends BaseEntity .append("createTime", getCreateTime()) .append("updateTime", getUpdateTime()) .append("uploadTime", getUploadTime()) + .append("appointmentTime", getAppointmentTime()) .append("imgSx", getImgSx()) .append("imgSm", getImgSm()) .append("responseTime", getResponseTime()) diff --git a/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml index 31eae4c..d442750 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml @@ -284,6 +284,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and doctor_id = #{doctorId} and hospital_id = #{hospitalId} and status = #{status} + and DATE_FORMAT( create_time, '%Y-%m-%d' ) = DATE_FORMAT(#{appointmentTime},'%Y-%m-%d') and ai_result = #{aiResult} and ai_result2 = #{aiResult2} and update_result = #{updateResult}