预约逻辑修改

master
heminjian502 2 years ago
parent 3fa1bb4ff5
commit 34a88aa841

@ -21,6 +21,7 @@ import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.framework.config.ServerConfig; import com.ruoyi.framework.config.ServerConfig;
import com.ruoyi.system.domain.*; import com.ruoyi.system.domain.*;
import com.ruoyi.system.domain.req.*; import com.ruoyi.system.domain.req.*;
import com.ruoyi.system.domain.resp.PatientHistoryRecordResp;
import com.ruoyi.system.domain.resp.TRecordResp; import com.ruoyi.system.domain.resp.TRecordResp;
import com.ruoyi.system.service.*; import com.ruoyi.system.service.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -133,15 +134,26 @@ public class AppController extends BaseController
@GetMapping("/patient/makeAnAppointment") @GetMapping("/patient/makeAnAppointment")
public AjaxResult patientsToMakeAnAppointment(AppPatientHospitalDoctor appPatientHospitalDoctor) 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<TRecord> 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中的一条记录;判断关联表是否存在当前关系 // 患者预约新增t_record中的一条记录;判断关联表是否存在当前关系
TPatientHospitalDoctor tPatientHospitalDoctor = new TPatientHospitalDoctor(); TPatientHospitalDoctor tPatientHospitalDoctor = new TPatientHospitalDoctor();
BeanUtils.copyProperties(appPatientHospitalDoctor, tPatientHospitalDoctor); BeanUtils.copyProperties(appPatientHospitalDoctor, tPatientHospitalDoctor);
tPatientHospitalDoctor.setPatientId(getUserId()); 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()); tRecord.setCreateBy(getUsername());
tRecordService.insertTRecord(tRecord); tRecordService.insertTRecord(tRecord);
List<TPatientHospitalDoctor> tPHDs = itPatientHospitalDoctorService.selectTPatientHospitalDoctorList(tPatientHospitalDoctor); List<TPatientHospitalDoctor> tPHDs = itPatientHospitalDoctorService.selectTPatientHospitalDoctorList(tPatientHospitalDoctor);
@ -149,7 +161,13 @@ public class AppController extends BaseController
{ {
itPatientHospitalDoctorService.insertTPatientHospitalDoctor(tPatientHospitalDoctor); itPatientHospitalDoctorService.insertTPatientHospitalDoctor(tPatientHospitalDoctor);
} }
return AjaxResult.success("预约成功"); TRecord queryRecord = new TRecord();
queryRecord.setId(tRecord.getId());
List<PatientHistoryRecordResp> 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}") @PutMapping("/record/ai/finish/{id}")

@ -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<PatientHistoryRecordResp> resp = tRecordService.queryPatientHistoryRecord(tRecord);
return AjaxResult.success(resp);
}
}

@ -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;
}
}

@ -7,10 +7,7 @@ import com.ruoyi.system.domain.TPatientHospitalDoctor;
import com.ruoyi.system.domain.TPatient; import com.ruoyi.system.domain.TPatient;
import com.ruoyi.system.domain.TRecord; import com.ruoyi.system.domain.TRecord;
import com.ruoyi.system.domain.req.TRecordResultReq; import com.ruoyi.system.domain.req.TRecordResultReq;
import com.ruoyi.system.domain.resp.PlatformDayPlanResp; import com.ruoyi.system.domain.resp.*;
import com.ruoyi.system.domain.resp.TRecordResp;
import com.ruoyi.system.domain.resp.WeekMonthPersonCountResp;
import com.ruoyi.system.domain.resp.WeekMonthTimeResp;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -160,4 +157,6 @@ public interface TRecordMapper
* @return int * @return int
*/ */
int queryDoctorNumberOfDiagnosis(Long doctorId); int queryDoctorNumberOfDiagnosis(Long doctorId);
List<PatientHistoryRecordResp> queryPatientHistoryRecord(TRecord tRecord);
} }

@ -6,6 +6,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.TPatientHospitalDoctor; import com.ruoyi.system.domain.TPatientHospitalDoctor;
import com.ruoyi.system.domain.TRecord; import com.ruoyi.system.domain.TRecord;
import com.ruoyi.system.domain.req.TRecordResultReq; import com.ruoyi.system.domain.req.TRecordResultReq;
import com.ruoyi.system.domain.resp.PatientHistoryRecordResp;
import com.ruoyi.system.domain.resp.TRecordResp; import com.ruoyi.system.domain.resp.TRecordResp;
/** /**
@ -105,4 +106,6 @@ public interface ITRecordService
* @return int * @return int
*/ */
int queryDoctorNumberOfDiagnosis(Long doctorId); int queryDoctorNumberOfDiagnosis(Long doctorId);
List<PatientHistoryRecordResp> queryPatientHistoryRecord(TRecord tRecord);
} }

@ -7,6 +7,7 @@ import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.TPatientHospitalDoctor; import com.ruoyi.system.domain.TPatientHospitalDoctor;
import com.ruoyi.system.domain.TRecord; import com.ruoyi.system.domain.TRecord;
import com.ruoyi.system.domain.req.TRecordResultReq; 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.RecordHistoryDataResp;
import com.ruoyi.system.domain.resp.TRecordResp; import com.ruoyi.system.domain.resp.TRecordResp;
import com.ruoyi.system.mapper.TRecordMapper; import com.ruoyi.system.mapper.TRecordMapper;
@ -228,4 +229,11 @@ public class TRecordServiceImpl implements ITRecordService
public int queryDoctorNumberOfDiagnosis(Long doctorId) { public int queryDoctorNumberOfDiagnosis(Long doctorId) {
return tRecordMapper.queryDoctorNumberOfDiagnosis(doctorId); return tRecordMapper.queryDoctorNumberOfDiagnosis(doctorId);
} }
@Override
public List<PatientHistoryRecordResp> queryPatientHistoryRecord(TRecord tRecord) {
return tRecordMapper.queryPatientHistoryRecord(tRecord);
}
} }

@ -427,4 +427,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="queryDoctorNumberOfDiagnosis" resultType="java.lang.Integer"> <select id="queryDoctorNumberOfDiagnosis" resultType="java.lang.Integer">
SELECT COUNT(*) FROM t_record where doctor_id = #{doctorId} AND `status` = '1'; SELECT COUNT(*) FROM t_record where doctor_id = #{doctorId} AND `status` = '1';
</select> </select>
<select id="queryPatientHistoryRecord" parameterType="TRecord" resultType="com.ruoyi.system.domain.resp.PatientHistoryRecordResp">
SELECT
td.`name` doctorName,
th.`name` hospitalName,
td.speciality speciality,
tr.create_time recordTime
FROM
t_record tr
LEFT JOIN t_doctor td ON tr.doctor_id = td.id
LEFT JOIN t_hospital th ON tr.hospital_id = th.id
<where>
<if test="patientId!=null">
and tr.patient_id = #{patientId}
</if>
<if test="id!=null">
and tr.id = #{id}
</if>
</where>
order by tr.create_time desc
</select>
</mapper> </mapper>

Loading…
Cancel
Save