|
|
|
@ -5,8 +5,10 @@ import com.supervision.exception.BusinessException;
|
|
|
|
|
import com.supervision.model.*;
|
|
|
|
|
import com.supervision.model.Process;
|
|
|
|
|
import com.supervision.pojo.vo.AskPhysicalResultReqVO;
|
|
|
|
|
import com.supervision.pojo.vo.ConfigPhysicalToolResVO;
|
|
|
|
|
import com.supervision.service.*;
|
|
|
|
|
import com.supervision.util.UserUtil;
|
|
|
|
|
import com.supervision.vo.ask.AskPhysicalHistoryResVO;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.apache.commons.collections4.SetUtils;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
@ -26,12 +28,20 @@ public class AskPhysicalServiceImpl implements AskPhysicalService {
|
|
|
|
|
|
|
|
|
|
private final DiseasePhysicalService diseasePhysicalService;
|
|
|
|
|
|
|
|
|
|
private final DiagnosisPhysicalRecordService diagnosisPhysicalRecordService;
|
|
|
|
|
|
|
|
|
|
private final ProcessService processService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, List<ConfigPhysicalTool>> queryPhysicalToolList() {
|
|
|
|
|
public List<ConfigPhysicalToolResVO> queryPhysicalToolList() {
|
|
|
|
|
List<ConfigPhysicalTool> list = toolService.lambdaQuery().list();
|
|
|
|
|
return list.stream().collect(Collectors.groupingBy(ConfigPhysicalTool::getType));
|
|
|
|
|
return list.stream().collect(Collectors.groupingBy(ConfigPhysicalTool::getType)).entrySet().stream().map(e ->{
|
|
|
|
|
ConfigPhysicalToolResVO tool = new ConfigPhysicalToolResVO();
|
|
|
|
|
tool.setToolType(e.getKey());
|
|
|
|
|
tool.setToolList(e.getValue());
|
|
|
|
|
return tool;
|
|
|
|
|
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -41,7 +51,7 @@ public class AskPhysicalServiceImpl implements AskPhysicalService {
|
|
|
|
|
ConfigPhysicalTool tool = Optional.ofNullable(toolService.getById(reqVO.getToolId())).orElseThrow(() -> new BusinessException("工具不支持"));
|
|
|
|
|
// 是否需要具体的部位,0否1是
|
|
|
|
|
String locationId = null;
|
|
|
|
|
if (1 == tool.getRequireLocation()){
|
|
|
|
|
if (1 == tool.getRequireLocation()) {
|
|
|
|
|
ConfigPhysicalLocation location = locationService.lambdaQuery().eq(ConfigPhysicalLocation::getCode, reqVO.getLocationCode()).last("limit 1")
|
|
|
|
|
.oneOpt().orElseThrow(() -> new BusinessException("为找到对应部位"));
|
|
|
|
|
locationId = location.getId();
|
|
|
|
@ -57,6 +67,7 @@ public class AskPhysicalServiceImpl implements AskPhysicalService {
|
|
|
|
|
// 检查记录保存到数据库中
|
|
|
|
|
DiagnosisPhysicalRecord diagnosisPhysicalRecord = new DiagnosisPhysicalRecord();
|
|
|
|
|
diagnosisPhysicalRecord.setProcessId(process.getId());
|
|
|
|
|
diagnosisPhysicalRecord.setPhysicalId(result.getId());
|
|
|
|
|
diagnosisPhysicalRecord.setToolId(tool.getId());
|
|
|
|
|
diagnosisPhysicalRecord.setLocationId(locationId);
|
|
|
|
|
diagnosisPhysicalRecord.setPrimaryId(reqVO.getPrimaryId());
|
|
|
|
@ -66,4 +77,9 @@ public class AskPhysicalServiceImpl implements AskPhysicalService {
|
|
|
|
|
diagnosisPhysicalRecord.insert();
|
|
|
|
|
return diagnosisPhysicalRecord;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<AskPhysicalHistoryResVO> queryAskPhysicalHistory(String processId) {
|
|
|
|
|
return diagnosisPhysicalRecordService.queryAskPhysicalHistory(processId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|