APP新增患者预约接口

master
gongzhenkun 2 years ago
parent 00912980f1
commit 3d9a605930

@ -3,26 +3,28 @@ package com.ruoyi.web.controller.api;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.DateUtils;
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.AppletPatientHospitalDoctor;
import com.ruoyi.system.domain.resp.PatientHistoryRecordResp; import com.ruoyi.system.domain.resp.PatientHistoryRecordResp;
import com.ruoyi.system.domain.resp.TRecordResp; import com.ruoyi.system.service.ITPatientHospitalDoctorService;
import com.ruoyi.system.service.ITImageHistoryService;
import com.ruoyi.system.service.ITRecordHistoryService; import com.ruoyi.system.service.ITRecordHistoryService;
import com.ruoyi.system.service.ITRecordService; import com.ruoyi.system.service.ITRecordService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Comparator; import javax.annotation.Resource;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Api("mp接口") @Api("mp接口")
@RestController @RestController
@ -30,10 +32,12 @@ import java.util.stream.Collectors;
public class MpController extends BaseController { public class MpController extends BaseController {
@Autowired @Autowired
private ITRecordService tRecordService; private ITRecordService tRecordService;
@Autowired @Autowired
private ITRecordHistoryService recordHistoryService; private ITRecordHistoryService recordHistoryService;
@Autowired
private ITImageHistoryService imageHistoryService; @Resource
private ITPatientHospitalDoctorService itPatientHospitalDoctorService;
@ApiOperation("患者诊断记录") @ApiOperation("患者诊断记录")
@ -72,4 +76,48 @@ public class MpController extends BaseController {
success.put("recordId", tRecord.getId()); success.put("recordId", tRecord.getId());
return success; return success;
} }
/**
*
*
* @param appPatientHospitalDoctor
* @return {@code AjaxResult}
*/
@ApiOperation("APP患者预约")
@Log(title = "APP患者预约", businessType = BusinessType.INSERT)
@GetMapping("/patient/makeAnAppointment")
public AjaxResult patientsToMakeAnAppointment(AppletPatientHospitalDoctor appPatientHospitalDoctor)
{
// 查询该患者当天是否有预约记录
TRecord tRecord = new TRecord();
tRecord.setPatientId(appPatientHospitalDoctor.getPatientId());
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)) {
AjaxResult ajaxResult = AjaxResult.error();
ajaxResult.put("msg", "当前患者已登记过信息!");
return ajaxResult;
}
// 患者预约新增t_record中的一条记录;判断关联表是否存在当前关系
TPatientHospitalDoctor tPatientHospitalDoctor = new TPatientHospitalDoctor();
BeanUtils.copyProperties(appPatientHospitalDoctor, tPatientHospitalDoctor);
tRecord.setCreateBy(getUsername());
tRecordService.insertTRecord(tRecord);
List<TPatientHospitalDoctor> tPHDs = itPatientHospitalDoctorService.selectTPatientHospitalDoctorList(tPatientHospitalDoctor);
if (tPHDs.isEmpty())
{
itPatientHospitalDoctorService.insertTPatientHospitalDoctor(tPatientHospitalDoctor);
}
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;
}
} }

@ -7,7 +7,7 @@ import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
/** /**
* App *
* *
* @author gongzhenkun * @author gongzhenkun
* @date 2022/8/9 14:48 * @date 2022/8/9 14:48

@ -0,0 +1,63 @@
package com.ruoyi.system.domain.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* App
*
* @author gongzhenkun
* @date 2022/8/9 14:48
*/
@ApiModel(value = "AppletPatientHospitalDoctor", description = "App端患者预约入参实体")
public class AppletPatientHospitalDoctor implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
@NotNull(message = "hospitalId不为空")
@ApiModelProperty("hospitalId")
private Long hospitalId;
/**
* ID
*/
@NotNull(message = "doctorId不为空")
@ApiModelProperty("doctorId")
private Long doctorId;
/**
* ID
*/
@NotNull(message = "patientId不为空")
@ApiModelProperty("patientId")
private Long patientId;
public Long getHospitalId() {
return hospitalId;
}
public void setHospitalId(Long hospitalId) {
this.hospitalId = hospitalId;
}
public Long getDoctorId() {
return doctorId;
}
public void setDoctorId(Long doctorId) {
this.doctorId = doctorId;
}
public Long getPatientId() {
return patientId;
}
public void setPatientId(Long patientId) {
this.patientId = patientId;
}
}
Loading…
Cancel
Save