|
|
|
@ -0,0 +1,82 @@
|
|
|
|
|
package com.supervision.manage;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.lang.Pair;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.supervision.manage.service.AskQuestionLibraryManageService;
|
|
|
|
|
import com.supervision.manage.service.DiseasePhysicalManageService;
|
|
|
|
|
import com.supervision.model.AskPatientAnswer;
|
|
|
|
|
import com.supervision.model.AskTemplateQuestionLibrary;
|
|
|
|
|
import com.supervision.service.AskPatientAnswerService;
|
|
|
|
|
import com.supervision.service.AskTemplateQuestionLibraryService;
|
|
|
|
|
import com.supervision.util.MinioUtil;
|
|
|
|
|
import com.supervision.vo.manage.DiseasePhysicalLocationNodeVo;
|
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@SpringBootTest
|
|
|
|
|
class VirtualPatientManageApplicationTests {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private AskPatientAnswerService askPatientAnswerService;;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private AskTemplateQuestionLibraryService askTemplateQuestionLibraryService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void generateVideo() throws Exception {
|
|
|
|
|
|
|
|
|
|
String medicalId = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取视频文件,及视频内容
|
|
|
|
|
List<Pair<String, File>> videoFileAndContent = getVideoFileAndContent(null);
|
|
|
|
|
|
|
|
|
|
//填充数据库中的资源id
|
|
|
|
|
Map<String, AskPatientAnswer> patientAnserMap = askPatientAnswerService.lambdaQuery().eq(AskPatientAnswer::getMedicalId, medicalId).list()
|
|
|
|
|
.stream().collect(Collectors.toMap(answer -> StrUtil.trim(answer.getAnswer()), answer -> answer));
|
|
|
|
|
|
|
|
|
|
List<AskTemplateQuestionLibrary> askTemplateQuestionLibraryList = askTemplateQuestionLibraryService.lambdaQuery().list();
|
|
|
|
|
|
|
|
|
|
for (Pair<String, File> pair : videoFileAndContent) {
|
|
|
|
|
AskPatientAnswer askPatientAnswer = patientAnserMap.get(pair.getKey());
|
|
|
|
|
if (Objects.isNull(askPatientAnswer)){
|
|
|
|
|
AskPatientAnswer answer = new AskPatientAnswer();
|
|
|
|
|
answer.setCode(null);
|
|
|
|
|
answer.setAnswer(pair.getKey());
|
|
|
|
|
answer.setMedicalId(medicalId);
|
|
|
|
|
String resourceId = MinioUtil.uploadFile(null);
|
|
|
|
|
answer.setAnswerResourceId(resourceId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取视频文件及内容
|
|
|
|
|
* @param videoPath 视频存放路径
|
|
|
|
|
* @return pair.getKey():视频内容 pair.getValue():视频文件对象
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
List<Pair<String, File>> getVideoFileAndContent(String videoPath) {
|
|
|
|
|
|
|
|
|
|
Pair<String, File> pair = Pair.of("", new File(""));
|
|
|
|
|
return CollUtil.newArrayList(pair);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|