|
|
|
@ -6,13 +6,13 @@ import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.supervision.exception.BusinessException;
|
|
|
|
|
import com.supervision.model.*;
|
|
|
|
|
import com.supervision.model.Process;
|
|
|
|
|
import com.supervision.pojo.vo.ChooseNode;
|
|
|
|
|
import com.supervision.pojo.vo.DiagnosticBasisForPrimaryReqVO;
|
|
|
|
|
import com.supervision.pojo.vo.RecordForPrimaryChooseVO;
|
|
|
|
|
import com.supervision.pojo.vo.SaveDiagnosisPrimaryReqVO;
|
|
|
|
|
import com.supervision.vo.ask.DiagnosticBasisForPrimaryResVO;
|
|
|
|
|
import com.supervision.vo.ask.*;
|
|
|
|
|
import com.supervision.service.*;
|
|
|
|
|
import com.supervision.util.UserUtil;
|
|
|
|
|
import com.supervision.vo.ask.DiagnosisPrimaryVO;
|
|
|
|
|
import com.supervision.vo.ask.ModifyPrimaryDiseaseInfoReqVO;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
@ -62,9 +62,81 @@ public class AskPrimaryServiceImpl implements AskPrimaryService {
|
|
|
|
|
diagnosisPrimary.setCreateUserId(UserUtil.getUser().getId());
|
|
|
|
|
diagnosisPrimaryService.save(diagnosisPrimary);
|
|
|
|
|
// 然后开始保存初步诊断关键的诊断
|
|
|
|
|
List<DiagnosisPrimaryRelation> primaryRecordList = reqVO.getPrimaryRecordList();
|
|
|
|
|
primaryRecordList.forEach(e -> e.setPrimaryId(diagnosisPrimary.getId()));
|
|
|
|
|
diagnosisPrimaryRelationService.saveBatch(primaryRecordList);
|
|
|
|
|
RecordForPrimaryChooseVO choose = reqVO.getChoose();
|
|
|
|
|
if (CollUtil.isNotEmpty(choose.getAskList())){
|
|
|
|
|
List<DiagnosisPrimaryRelation> askRelationList = choose.getAskList().stream().map(e -> {
|
|
|
|
|
DiagnosisPrimaryRelation relation = new DiagnosisPrimaryRelation();
|
|
|
|
|
relation.setProcessId(diagnosisPrimary.getProcessId());
|
|
|
|
|
relation.setPrimaryId(diagnosisPrimary.getId());
|
|
|
|
|
relation.setType(1);
|
|
|
|
|
relation.setRelationId(e.getNodeId());
|
|
|
|
|
relation.setCreateUserId(UserUtil.getUser().getId());
|
|
|
|
|
return relation;
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
diagnosisPrimaryRelationService.saveBatch(askRelationList);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(choose.getPhysicalList())){
|
|
|
|
|
List<DiagnosisPrimaryRelation> physicalRelationList = choose.getPhysicalList().stream().map(e -> {
|
|
|
|
|
DiagnosisPrimaryRelation relation = new DiagnosisPrimaryRelation();
|
|
|
|
|
relation.setProcessId(diagnosisPrimary.getProcessId());
|
|
|
|
|
relation.setPrimaryId(diagnosisPrimary.getId());
|
|
|
|
|
relation.setType(2);
|
|
|
|
|
relation.setRelationId(e.getNodeId());
|
|
|
|
|
relation.setCreateUserId(UserUtil.getUser().getId());
|
|
|
|
|
return relation;
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
diagnosisPrimaryRelationService.saveBatch(physicalRelationList);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(choose.getAncillaryList())){
|
|
|
|
|
List<DiagnosisPrimaryRelation> ancillaryRelationList = choose.getAncillaryList().stream().map(e -> {
|
|
|
|
|
DiagnosisPrimaryRelation relation = new DiagnosisPrimaryRelation();
|
|
|
|
|
relation.setProcessId(diagnosisPrimary.getProcessId());
|
|
|
|
|
relation.setPrimaryId(diagnosisPrimary.getId());
|
|
|
|
|
relation.setType(3);
|
|
|
|
|
relation.setRelationId(e.getNodeId());
|
|
|
|
|
relation.setCreateUserId(UserUtil.getUser().getId());
|
|
|
|
|
return relation;
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
diagnosisPrimaryRelationService.saveBatch(ancillaryRelationList);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RecordForPrimaryChooseVO queryRecordForPrimaryChoose(String processId) {
|
|
|
|
|
RecordForPrimaryChooseVO resVO = new RecordForPrimaryChooseVO();
|
|
|
|
|
// 查询语音问诊记录
|
|
|
|
|
List<DiagnosisQaRecord> list = diagnosisQaRecordService.lambdaQuery().eq(DiagnosisQaRecord::getProcessId, processId).orderByAsc(DiagnosisQaRecord::getCreateTime).list();
|
|
|
|
|
List<ChooseNode> askRecordList = list.stream().map(e -> {
|
|
|
|
|
ChooseNode chooseNode = new ChooseNode();
|
|
|
|
|
chooseNode.setNodeId(e.getId());
|
|
|
|
|
chooseNode.setName(e.getQuestion());
|
|
|
|
|
return chooseNode;
|
|
|
|
|
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
resVO.setAskList(askRecordList);
|
|
|
|
|
// 查询体格检查记录
|
|
|
|
|
List<AskPhysicalHistoryResVO> physicalHistoryList = diagnosisPhysicalRecordService.queryAskPhysicalHistory(processId);
|
|
|
|
|
List<ChooseNode> physicalList = physicalHistoryList.stream().map(e -> {
|
|
|
|
|
ChooseNode chooseNode = new ChooseNode();
|
|
|
|
|
chooseNode.setNodeId(e.getId());
|
|
|
|
|
chooseNode.setName(StrUtil.join(" | ", e.getToolName(), e.getLocationName()));
|
|
|
|
|
return chooseNode;
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
resVO.setPhysicalList(physicalList);
|
|
|
|
|
List<AskAncillaryHistoryResVO> ancillaryHistoryList = diagnosisAncillaryRecordService.queryAncillaryRecord(processId);
|
|
|
|
|
List<ChooseNode> ancillaryList = ancillaryHistoryList.stream().map(e -> {
|
|
|
|
|
ChooseNode chooseNode = new ChooseNode();
|
|
|
|
|
chooseNode.setNodeId(e.getId());
|
|
|
|
|
chooseNode.setName(e.getItemName());
|
|
|
|
|
return chooseNode;
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
resVO.setAncillaryList(ancillaryList);
|
|
|
|
|
return resVO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|