|
|
|
@ -2,8 +2,11 @@ package com.supervision.manage;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
|
|
import cn.hutool.core.lang.Pair;
|
|
|
|
|
import cn.hutool.core.map.MapUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
import cn.hutool.log.Log;
|
|
|
|
|
import cn.hutool.poi.excel.ExcelReader;
|
|
|
|
|
import cn.hutool.poi.excel.ExcelUtil;
|
|
|
|
@ -41,13 +44,20 @@ class VirtualPatientManageApplicationTests {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void generateVideo() throws Exception {
|
|
|
|
|
void generateVideo(){
|
|
|
|
|
|
|
|
|
|
String medicalId = "";
|
|
|
|
|
String medicalId = "ww";
|
|
|
|
|
|
|
|
|
|
String videoPath = "F:\\tmp\\video";
|
|
|
|
|
String indexFile = "标准病人语料库v1.3.xlsx";
|
|
|
|
|
|
|
|
|
|
// 获取视频文件,及视频内容
|
|
|
|
|
List<Pair<String, File>> videoFileAndContent = getVideoFileAndContent(null);
|
|
|
|
|
// 1. 获取视频文件,及视频内容
|
|
|
|
|
List<Pair<String, File>> videoFileAndContent = getVideoFileAndContent(videoPath,indexFile,".mp4");
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isEmpty(videoFileAndContent)){
|
|
|
|
|
log.info("getVideoFileAndContent result is empty");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//填充数据库中疾病问诊的资源id
|
|
|
|
|
Map<String, AskPatientAnswer> patientAnserMap = askPatientAnswerService.lambdaQuery().eq(AskPatientAnswer::getMedicalId, medicalId).list()
|
|
|
|
@ -65,6 +75,7 @@ class VirtualPatientManageApplicationTests {
|
|
|
|
|
askPatientAnswer.setAnswerResourceId(resourceId);
|
|
|
|
|
resourceIds.add(resourceId);
|
|
|
|
|
askPatientAnswerService.updateById(askPatientAnswer);
|
|
|
|
|
log.info("update askPatientAnswer:{}", JSONUtil.toJsonStr(askPatientAnswer));
|
|
|
|
|
}else {
|
|
|
|
|
//todo: 获取模板中的数据
|
|
|
|
|
}
|
|
|
|
@ -88,20 +99,21 @@ class VirtualPatientManageApplicationTests {
|
|
|
|
|
* @return pair.getKey():视频内容 pair.getValue():视频文件对象
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
List<Pair<String, File>> getVideoFileAndContent(String videoPath) throws IOException {
|
|
|
|
|
List<Pair<String, File>> getVideoFileAndContent(String videoPath,String indexFileName,String videoSuffix){
|
|
|
|
|
|
|
|
|
|
try (ExcelReader reader = ExcelUtil.getReader(FileUtil.file(String.join(File.separator,videoPath,indexFileName)))){
|
|
|
|
|
|
|
|
|
|
ExcelReader reader = ExcelUtil.getReader(Files.newInputStream(new File("").toPath()));
|
|
|
|
|
org.apache.poi.ss.usermodel.Sheet sheet = reader.getSheet();
|
|
|
|
|
|
|
|
|
|
Pair<String, File> pair = Pair.of("", new File(""));
|
|
|
|
|
return CollUtil.newArrayList(pair);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws IOException {
|
|
|
|
|
ExcelReader reader = ExcelUtil.getReader(Files.newInputStream(new File("").toPath()));
|
|
|
|
|
return reader.readAll().stream().map(map -> {
|
|
|
|
|
String answerText = MapUtil.getStr(map, "A(answer)");
|
|
|
|
|
String fileName = MapUtil.getStr(map, "知识库A-ID\n[病征]");
|
|
|
|
|
if (StrUtil.isEmpty(answerText) || StrUtil.isEmpty(fileName)) {
|
|
|
|
|
log.info("文件内容不完整:answerText:{},fileName:{}", answerText, fileName);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return Pair.of(answerText, FileUtil.file(String.join(File.separator,videoPath,fileName)+videoSuffix));
|
|
|
|
|
}).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> maps = reader.readAll();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|