You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
2.2 KiB
Java
49 lines
2.2 KiB
Java
2 years ago
|
package com.supervision.service.impl;
|
||
|
|
||
|
import com.supervision.exception.BusinessException;
|
||
|
import com.supervision.model.ConfigAncillaryItem;
|
||
|
import com.supervision.model.DiagnosisAncillaryRecord;
|
||
|
import com.supervision.model.DiseaseAncillary;
|
||
|
import com.supervision.model.Process;
|
||
|
import com.supervision.pojo.vo.AskAncillaryResultReqVO;
|
||
|
import com.supervision.service.*;
|
||
|
import com.supervision.util.UserUtil;
|
||
|
import lombok.RequiredArgsConstructor;
|
||
|
import org.springframework.stereotype.Service;
|
||
|
|
||
|
import java.util.Optional;
|
||
|
|
||
|
@Service
|
||
|
@RequiredArgsConstructor
|
||
|
public class AskAncillaryServiceImpl implements AskAncillaryService {
|
||
|
|
||
|
private final ProcessService processService;
|
||
|
|
||
|
private final DiseaseAncillaryService diseaseAncillaryService;
|
||
|
|
||
|
private final ConfigAncillaryItemService ancillaryItemService;
|
||
|
|
||
|
@Override
|
||
|
public DiagnosisAncillaryRecord queryAskAncillaryResult(AskAncillaryResultReqVO reqVO) {
|
||
|
// 首先根据process_id查新到流程ID
|
||
|
Process process = Optional.ofNullable(processService.getById(reqVO.getProcessId())).orElseThrow(() -> new BusinessException("未找到流程ID"));
|
||
|
// 找到对应的项目
|
||
|
ConfigAncillaryItem ancillaryItem = ancillaryItemService.lambdaQuery().eq(ConfigAncillaryItem::getItemName, reqVO.getItemName()).last("limit 1")
|
||
|
.oneOpt().orElseThrow(() -> new BusinessException("未找到对应的辅助工具"));
|
||
|
|
||
|
DiseaseAncillary diseaseAncillary = diseaseAncillaryService.lambdaQuery().eq(DiseaseAncillary::getPatientId, process.getPatientId()).eq(DiseaseAncillary::getItemId, ancillaryItem.getId())
|
||
|
.oneOpt().orElseGet(() -> {
|
||
|
DiseaseAncillary get = new DiseaseAncillary();
|
||
|
get.setResult("无相关资讯");
|
||
|
return get;
|
||
|
});
|
||
|
DiagnosisAncillaryRecord record = new DiagnosisAncillaryRecord();
|
||
|
record.setProcessId(process.getId());
|
||
|
record.setItemId(ancillaryItem.getId());
|
||
|
record.setValue(diseaseAncillary.getResult());
|
||
|
record.setCreateUserId(UserUtil.getUser().getId());
|
||
|
record.setUpdateUserId(UserUtil.getUser().getId());
|
||
|
return record;
|
||
|
}
|
||
|
}
|