|
|
@ -8,13 +8,12 @@ import com.supervision.pojo.vo.AskPhysicalResultReqVO;
|
|
|
|
import com.supervision.pojo.vo.ConfigPhysicalToolResVO;
|
|
|
|
import com.supervision.pojo.vo.ConfigPhysicalToolResVO;
|
|
|
|
import com.supervision.service.*;
|
|
|
|
import com.supervision.service.*;
|
|
|
|
import com.supervision.util.UserUtil;
|
|
|
|
import com.supervision.util.UserUtil;
|
|
|
|
|
|
|
|
import com.supervision.vo.ask.DiagnosisPhysicalRecordVo;
|
|
|
|
import com.supervision.vo.ask.AskPhysicalHistoryResVO;
|
|
|
|
import com.supervision.vo.ask.AskPhysicalHistoryResVO;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import org.apache.commons.collections4.SetUtils;
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.Optional;
|
|
|
|
import java.util.Optional;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
@ -45,22 +44,21 @@ public class AskPhysicalServiceImpl implements AskPhysicalService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public DiagnosisPhysicalRecord queryAskPhysicalResult(AskPhysicalResultReqVO reqVO) {
|
|
|
|
public DiagnosisPhysicalRecordVo queryAskPhysicalResult(AskPhysicalResultReqVO reqVO) {
|
|
|
|
// 首先根据process_id查新到流程ID
|
|
|
|
// 首先根据process_id查新到流程ID
|
|
|
|
Process process = Optional.ofNullable(processService.getById(reqVO.getProcessId())).orElseThrow(() -> new BusinessException("未找到流程ID"));
|
|
|
|
Process process = Optional.ofNullable(processService.getById(reqVO.getProcessId())).orElseThrow(() -> new BusinessException("未找到流程ID"));
|
|
|
|
ConfigPhysicalTool tool = Optional.ofNullable(toolService.getById(reqVO.getToolId())).orElseThrow(() -> new BusinessException("工具不支持"));
|
|
|
|
ConfigPhysicalTool tool = Optional.ofNullable(toolService.getById(reqVO.getToolId())).orElseThrow(() -> new BusinessException("工具不支持"));
|
|
|
|
// 是否需要具体的部位,0否1是
|
|
|
|
// 是否需要具体的部位,0否1是
|
|
|
|
String locationId = null;
|
|
|
|
ConfigPhysicalLocation location = new ConfigPhysicalLocation();
|
|
|
|
if (1 == tool.getRequireLocation()) {
|
|
|
|
if (1 == tool.getRequireLocation()) {
|
|
|
|
if (StrUtil.isBlank(reqVO.getLocationCode())){
|
|
|
|
if (StrUtil.isBlank(reqVO.getLocationCode())){
|
|
|
|
throw new BusinessException("请选择对应的位置");
|
|
|
|
throw new BusinessException("请选择对应的位置");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ConfigPhysicalLocation location = locationService.lambdaQuery().eq(ConfigPhysicalLocation::getCode, reqVO.getLocationCode()).last("limit 1")
|
|
|
|
location = locationService.lambdaQuery().eq(ConfigPhysicalLocation::getCode, reqVO.getLocationCode()).last("limit 1")
|
|
|
|
.oneOpt().orElseThrow(() -> new BusinessException("未找到对应部位"));
|
|
|
|
.oneOpt().orElseThrow(() -> new BusinessException("未找到对应部位"));
|
|
|
|
locationId = location.getId();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DiseasePhysical result = diseasePhysicalService.lambdaQuery().eq(DiseasePhysical::getMedicalRecId, process.getMedicalRecId())
|
|
|
|
DiseasePhysical result = diseasePhysicalService.lambdaQuery().eq(DiseasePhysical::getMedicalRecId, process.getMedicalRecId())
|
|
|
|
.eq(DiseasePhysical::getToolId, tool.getId()).eq(StrUtil.isNotBlank(locationId), DiseasePhysical::getLocationId, locationId).last("limit 1")
|
|
|
|
.eq(DiseasePhysical::getToolId, tool.getId()).eq(StrUtil.isNotBlank(location.getId()), DiseasePhysical::getLocationId, location.getId()).last("limit 1")
|
|
|
|
.oneOpt()
|
|
|
|
.oneOpt()
|
|
|
|
.orElseGet(() -> {
|
|
|
|
.orElseGet(() -> {
|
|
|
|
DiseasePhysical diseasePhysical = new DiseasePhysical();
|
|
|
|
DiseasePhysical diseasePhysical = new DiseasePhysical();
|
|
|
@ -72,17 +70,36 @@ public class AskPhysicalServiceImpl implements AskPhysicalService {
|
|
|
|
diagnosisPhysicalRecord.setProcessId(process.getId());
|
|
|
|
diagnosisPhysicalRecord.setProcessId(process.getId());
|
|
|
|
diagnosisPhysicalRecord.setPhysicalId(result.getId());
|
|
|
|
diagnosisPhysicalRecord.setPhysicalId(result.getId());
|
|
|
|
diagnosisPhysicalRecord.setToolId(tool.getId());
|
|
|
|
diagnosisPhysicalRecord.setToolId(tool.getId());
|
|
|
|
diagnosisPhysicalRecord.setLocationId(locationId);
|
|
|
|
diagnosisPhysicalRecord.setLocationId(location.getId());
|
|
|
|
diagnosisPhysicalRecord.setPrimaryId(reqVO.getPrimaryId());
|
|
|
|
diagnosisPhysicalRecord.setPrimaryId(reqVO.getPrimaryId());
|
|
|
|
diagnosisPhysicalRecord.setResult(result.getResult());
|
|
|
|
diagnosisPhysicalRecord.setResult(result.getResult());
|
|
|
|
diagnosisPhysicalRecord.setCreateUserId(UserUtil.getUser().getCreateUserId());
|
|
|
|
diagnosisPhysicalRecord.setCreateUserId(UserUtil.getUser().getCreateUserId());
|
|
|
|
diagnosisPhysicalRecord.setUpdateUserId(UserUtil.getUser().getCreateUserId());
|
|
|
|
diagnosisPhysicalRecord.setUpdateUserId(UserUtil.getUser().getCreateUserId());
|
|
|
|
diagnosisPhysicalRecord.insert();
|
|
|
|
diagnosisPhysicalRecord.insert();
|
|
|
|
return diagnosisPhysicalRecord;
|
|
|
|
|
|
|
|
|
|
|
|
return initDiagnosisPhysicalRecordVo(reqVO.getPrimaryId(), process.getId(), result, tool, location);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<AskPhysicalHistoryResVO> queryAskPhysicalHistory(String processId) {
|
|
|
|
public List<AskPhysicalHistoryResVO> queryAskPhysicalHistory(String processId) {
|
|
|
|
return diagnosisPhysicalRecordService.queryAskPhysicalHistory(processId);
|
|
|
|
return diagnosisPhysicalRecordService.queryAskPhysicalHistory(processId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static DiagnosisPhysicalRecordVo initDiagnosisPhysicalRecordVo(String primaryId, String processId,
|
|
|
|
|
|
|
|
DiseasePhysical result, ConfigPhysicalTool tool,
|
|
|
|
|
|
|
|
ConfigPhysicalLocation location) {
|
|
|
|
|
|
|
|
DiagnosisPhysicalRecordVo diagnosisPhysicalRecordVo = new DiagnosisPhysicalRecordVo();
|
|
|
|
|
|
|
|
diagnosisPhysicalRecordVo.setProcessId(processId);
|
|
|
|
|
|
|
|
diagnosisPhysicalRecordVo.setToolId(tool.getToolName());
|
|
|
|
|
|
|
|
diagnosisPhysicalRecordVo.setToolName(tool.getToolName());
|
|
|
|
|
|
|
|
diagnosisPhysicalRecordVo.setLocationId(location.getId());
|
|
|
|
|
|
|
|
diagnosisPhysicalRecordVo.setLocationName(location.getLocationName());
|
|
|
|
|
|
|
|
diagnosisPhysicalRecordVo.setPrimaryId(primaryId);
|
|
|
|
|
|
|
|
diagnosisPhysicalRecordVo.setPhysicalId(result.getId());
|
|
|
|
|
|
|
|
diagnosisPhysicalRecordVo.setResult(result.getResult());
|
|
|
|
|
|
|
|
return diagnosisPhysicalRecordVo;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|