From 34a88aa8410d83b45e987536d0c58e52de89ee19 Mon Sep 17 00:00:00 2001 From: heminjian502 Date: Fri, 2 Sep 2022 12:49:55 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E7=BA=A6=E9=80=BB=E8=BE=91=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/api/AppController.java | 30 ++++++++--- .../web/controller/api/MpController.java | 41 +++++++++++++++ .../domain/resp/PatientHistoryRecordResp.java | 51 +++++++++++++++++++ .../ruoyi/system/mapper/TRecordMapper.java | 7 ++- .../ruoyi/system/service/ITRecordService.java | 3 ++ .../service/impl/TRecordServiceImpl.java | 8 +++ .../resources/mapper/system/TRecordMapper.xml | 22 ++++++++ 7 files changed, 152 insertions(+), 10 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/MpController.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/PatientHistoryRecordResp.java 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 5df476e..2cb91c5 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 @@ -21,6 +21,7 @@ import com.ruoyi.common.utils.http.HttpUtils; import com.ruoyi.framework.config.ServerConfig; import com.ruoyi.system.domain.*; import com.ruoyi.system.domain.req.*; +import com.ruoyi.system.domain.resp.PatientHistoryRecordResp; import com.ruoyi.system.domain.resp.TRecordResp; import com.ruoyi.system.service.*; import io.swagger.annotations.Api; @@ -133,15 +134,26 @@ public class AppController extends BaseController @GetMapping("/patient/makeAnAppointment") public AjaxResult patientsToMakeAnAppointment(AppPatientHospitalDoctor appPatientHospitalDoctor) { + // 查询该患者当天是否有预约记录 + TRecord tRecord = new TRecord(); + tRecord.setPatientId(getUserId()); + tRecord.setHospitalId(appPatientHospitalDoctor.getHospitalId()); + tRecord.setStatus("0"); + tRecord.setDoctorId(appPatientHospitalDoctor.getDoctorId()); + 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()); + AjaxResult ajaxResult = AjaxResult.error(); + ajaxResult.put("msg", "同一个医生,一天只能登记一次;您今天已经在" + appointmentTime + "登记"); + ajaxResult.put("isBook", true); + return ajaxResult; + } + // 患者预约,新增t_record中的一条记录;判断关联表是否存在当前关系 TPatientHospitalDoctor tPatientHospitalDoctor = new TPatientHospitalDoctor(); BeanUtils.copyProperties(appPatientHospitalDoctor, tPatientHospitalDoctor); tPatientHospitalDoctor.setPatientId(getUserId()); - TRecord tRecord = new TRecord(); - tRecord.setHospitalId(tPatientHospitalDoctor.getHospitalId()); - tRecord.setPatientId(tPatientHospitalDoctor.getPatientId()); - tRecord.setDoctorId(tPatientHospitalDoctor.getDoctorId()); - tRecord.setStatus("0"); tRecord.setCreateBy(getUsername()); tRecordService.insertTRecord(tRecord); List tPHDs = itPatientHospitalDoctorService.selectTPatientHospitalDoctorList(tPatientHospitalDoctor); @@ -149,7 +161,13 @@ public class AppController extends BaseController { itPatientHospitalDoctorService.insertTPatientHospitalDoctor(tPatientHospitalDoctor); } - return AjaxResult.success("预约成功"); + TRecord queryRecord = new TRecord(); + queryRecord.setId(tRecord.getId()); + List resp = tRecordService.queryPatientHistoryRecord(queryRecord); + AjaxResult ajaxResult = AjaxResult.success(); + ajaxResult.put("record", CollectionUtils.isEmpty(resp) ? null : resp.get(0)); + ajaxResult.put("msg", "登记成功"); + return ajaxResult; } @PutMapping("/record/ai/finish/{id}") diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/MpController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/MpController.java new file mode 100644 index 0000000..8c6ddbe --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/MpController.java @@ -0,0 +1,41 @@ +package com.ruoyi.web.controller.api; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.system.domain.TPatientHospitalDoctor; +import com.ruoyi.system.domain.TRecord; +import com.ruoyi.system.domain.resp.PatientHistoryRecordResp; +import com.ruoyi.system.domain.resp.TRecordResp; +import com.ruoyi.system.service.ITRecordService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Comparator; +import java.util.List; +import java.util.stream.Collectors; + +@Api("mp接口") +@RestController +@RequestMapping("/api/mp") +public class MpController extends BaseController { + @Autowired + private ITRecordService tRecordService; + + @ApiOperation("患者诊断记录") + @GetMapping("/patient/history/record") + public AjaxResult queryPatientHistoryRecord() + { + TRecord tRecord = new TRecord(); + tRecord.setPatientId(getUserId()); + List resp = tRecordService.queryPatientHistoryRecord(tRecord); + return AjaxResult.success(resp); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/PatientHistoryRecordResp.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/PatientHistoryRecordResp.java new file mode 100644 index 0000000..2e6dc58 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/PatientHistoryRecordResp.java @@ -0,0 +1,51 @@ +package com.ruoyi.system.domain.resp; + +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.io.Serializable; +import java.util.Date; + +public class PatientHistoryRecordResp implements Serializable { + private static final long serialVersionUID = 7257040908679462977L; + + private String doctorName; + + private String hospitalName; + + private String speciality; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date recordTime; + + public String getDoctorName() { + return doctorName; + } + + public void setDoctorName(String doctorName) { + this.doctorName = doctorName; + } + + public String getHospitalName() { + return hospitalName; + } + + public void setHospitalName(String hospitalName) { + this.hospitalName = hospitalName; + } + + public String getSpeciality() { + return speciality; + } + + public void setSpeciality(String speciality) { + this.speciality = speciality; + } + + public Date getRecordTime() { + return recordTime; + } + + public void setRecordTime(Date recordTime) { + this.recordTime = recordTime; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TRecordMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TRecordMapper.java index 54ea4e6..c25dce4 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TRecordMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TRecordMapper.java @@ -7,10 +7,7 @@ import com.ruoyi.system.domain.TPatientHospitalDoctor; import com.ruoyi.system.domain.TPatient; import com.ruoyi.system.domain.TRecord; import com.ruoyi.system.domain.req.TRecordResultReq; -import com.ruoyi.system.domain.resp.PlatformDayPlanResp; -import com.ruoyi.system.domain.resp.TRecordResp; -import com.ruoyi.system.domain.resp.WeekMonthPersonCountResp; -import com.ruoyi.system.domain.resp.WeekMonthTimeResp; +import com.ruoyi.system.domain.resp.*; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -160,4 +157,6 @@ public interface TRecordMapper * @return int */ int queryDoctorNumberOfDiagnosis(Long doctorId); + + List queryPatientHistoryRecord(TRecord tRecord); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITRecordService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITRecordService.java index 6fca7b8..de88a5b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITRecordService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITRecordService.java @@ -6,6 +6,7 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.system.domain.TPatientHospitalDoctor; import com.ruoyi.system.domain.TRecord; import com.ruoyi.system.domain.req.TRecordResultReq; +import com.ruoyi.system.domain.resp.PatientHistoryRecordResp; import com.ruoyi.system.domain.resp.TRecordResp; /** @@ -105,4 +106,6 @@ public interface ITRecordService * @return int */ int queryDoctorNumberOfDiagnosis(Long doctorId); + + List queryPatientHistoryRecord(TRecord tRecord); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordServiceImpl.java index b51a99b..37b367d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordServiceImpl.java @@ -7,6 +7,7 @@ import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.TPatientHospitalDoctor; import com.ruoyi.system.domain.TRecord; import com.ruoyi.system.domain.req.TRecordResultReq; +import com.ruoyi.system.domain.resp.PatientHistoryRecordResp; import com.ruoyi.system.domain.resp.RecordHistoryDataResp; import com.ruoyi.system.domain.resp.TRecordResp; import com.ruoyi.system.mapper.TRecordMapper; @@ -228,4 +229,11 @@ public class TRecordServiceImpl implements ITRecordService public int queryDoctorNumberOfDiagnosis(Long doctorId) { return tRecordMapper.queryDoctorNumberOfDiagnosis(doctorId); } + + @Override + public List queryPatientHistoryRecord(TRecord tRecord) { + return tRecordMapper.queryPatientHistoryRecord(tRecord); + } + + } diff --git a/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml index d442750..f05c399 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml @@ -427,4 +427,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + +