diff --git a/virtual-patient-manage/pom.xml b/virtual-patient-manage/pom.xml index d104417f..6ac40deb 100644 --- a/virtual-patient-manage/pom.xml +++ b/virtual-patient-manage/pom.xml @@ -62,6 +62,12 @@ <artifactId>lombok</artifactId> <scope>provided</scope> </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> </dependencies> <build> diff --git a/virtual-patient-manage/src/test/java/com/supervision/manage/VirtualPatientManageApplicationTests.java b/virtual-patient-manage/src/test/java/com/supervision/manage/VirtualPatientManageApplicationTests.java new file mode 100644 index 00000000..1b3b7ff4 --- /dev/null +++ b/virtual-patient-manage/src/test/java/com/supervision/manage/VirtualPatientManageApplicationTests.java @@ -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); + } + + + + +}