新增诊断记录状态查询接口;患者新增接口添加校验

master
gongzhenkun 2 years ago
parent 624b6e3897
commit e906ed826d

@ -237,14 +237,7 @@ public class AppController extends BaseController
if (Objects.nonNull(currentPatient))
{
//患者信息已存在 新增诊断记录
TRecord tRecord = new TRecord();
tRecord.setHospitalId(appPatientReq.getHospitalId());
tRecord.setPatientId(currentPatient.getId());
tRecord.setDoctorId(appPatientReq.getDoctorId());
tRecord.setStatus("0");
tRecord.setCreateBy(getUsername());
tRecordService.insertTRecord(tRecord);
return AjaxResult.success("手机号已注册");
return insertRecord(appPatientReq, currentPatient);
}
tPatientService.insertTPatient(tPatient);
Long identifier = 10000000L + tPatient.getId();
@ -277,6 +270,35 @@ public class AppController extends BaseController
return AjaxResult.success();
}
/**
*
*
* @param appPatientReq
* @param currentPatient
* @return {@code AjaxResult}
*/
private AjaxResult insertRecord(AppPatientReq appPatientReq, TPatient currentPatient) {
TRecord tRecord = new TRecord();
tRecord.setHospitalId(appPatientReq.getHospitalId());
tRecord.setPatientId(currentPatient.getId());
tRecord.setDoctorId(appPatientReq.getDoctorId());
tRecord.setCreateBy(getUsername());
if (whetherRegistration(tRecord, "0") || whetherRegistration(tRecord, "2") || whetherRegistration(tRecord, "3")) {
AjaxResult ajaxResult = AjaxResult.error();
ajaxResult.put("msg", "当前患者已登记过信息!");
return ajaxResult;
}
tRecord.setStatus("0");
tRecordService.insertTRecord(tRecord);
return AjaxResult.success("手机号已注册");
}
private Boolean whetherRegistration(TRecord tRecord, String status) {
tRecord.setStatus(status);
List<TRecord> tRecords = tRecordService.selectTRecordList(tRecord);
return !CollectionUtils.isEmpty(tRecords);
}
/**
*
*
@ -451,7 +473,7 @@ public class AppController extends BaseController
// AI接口异常需要重置当前记录状态
updateRecordStatus(recordId, "0");
logger.error("AI result exception, msg is {}", e.getMessage());
return AjaxResult.error("AI result exception, please try again!");
return AjaxResult.error("AI result exception, message is {}", e.getMessage());
}
if (StringUtils.isEmpty(result)) {
// AI接口非正常返回需要重置当前记录状态

@ -5,11 +5,14 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.TPatient;
import com.ruoyi.system.domain.TPatientHospitalDoctor;
import com.ruoyi.system.domain.TRecord;
import com.ruoyi.system.domain.req.AppPatientRecord;
import com.ruoyi.system.domain.req.AppletPatientHospitalDoctor;
import com.ruoyi.system.domain.resp.PatientHistoryRecordResp;
import com.ruoyi.system.service.ITPatientHospitalDoctorService;
import com.ruoyi.system.service.ITPatientService;
import com.ruoyi.system.service.ITRecordHistoryService;
import com.ruoyi.system.service.ITRecordService;
import io.swagger.annotations.Api;
@ -23,8 +26,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@Api("mp接口")
@RestController
@ -39,6 +44,9 @@ public class MpController extends BaseController {
@Resource
private ITPatientHospitalDoctorService itPatientHospitalDoctorService;
@Resource
private ITPatientService patientService;
@ApiOperation("患者诊断记录")
@GetMapping("/patient/history/record")
@ -124,4 +132,30 @@ public class MpController extends BaseController {
List<TRecord> tRecords = tRecordService.selectTRecordList(tRecord);
return !CollectionUtils.isEmpty(tRecords);
}
@ApiOperation("APP查询记录状态")
@Log(title = "APP查询记录状态", businessType = BusinessType.OTHER)
@GetMapping("/record/status")
public AjaxResult queryRecordState(AppPatientRecord appPatientHospitalDoctor){
AjaxResult ajaxResult = AjaxResult.success();
TPatient tPatient = new TPatient();
tPatient.setName(appPatientHospitalDoctor.getName());
tPatient.setPhone(appPatientHospitalDoctor.getPhone());
List<TPatient> tPatients = patientService.selectTPatientList(tPatient);
if (tPatients.isEmpty()) {
ajaxResult.put("status", null);
}
// 查询该患者当天是否有预约记录
TRecord tRecord = new TRecord();
tRecord.setPatientId(tPatients.get(0).getId());
tRecord.setHospitalId(appPatientHospitalDoctor.getHospitalId());
tRecord.setDoctorId(appPatientHospitalDoctor.getDoctorId());
tRecord.setAppointmentTime(DateUtils.dateTime(new Date()));
List<TRecord> tRecords = tRecordService.selectTRecordList(tRecord);
tRecords = tRecords.stream()
.sorted(Comparator.comparing(TRecord::getUploadTime, Comparator.nullsLast(Date::compareTo)).reversed())
.collect(Collectors.toList());
ajaxResult.put("status", tRecords.get(0).getStatus());
return ajaxResult;
}
}

@ -0,0 +1,47 @@
package com.ruoyi.system.domain.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
/**
*
*
* @author gongzhenkun
* @date 2022/11/7 16:50
*/
@ApiModel(value = "AppPatientRecord", description = "患者新增时查询记录入参实体")
public class AppPatientRecord extends AppPatientHospitalDoctor{
/**
*
*/
@NotNull(message = "患者名称不为空")
@ApiModelProperty("患者名称")
private String name;
/**
*
*/
@NotNull(message = "手机号不为空")
@ApiModelProperty("手机号")
private String phone;
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Loading…
Cancel
Save