|
|
|
@ -12,7 +12,9 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
@ -35,14 +37,18 @@ public class MedicalAiAnswerSetter {
|
|
|
|
|
|
|
|
|
|
private final String directoryId = "1796467642475745282";
|
|
|
|
|
@Test
|
|
|
|
|
@Transactional
|
|
|
|
|
public void setByFileAndMedical() throws Exception {
|
|
|
|
|
|
|
|
|
|
String medicalId = "";
|
|
|
|
|
// 董婉平
|
|
|
|
|
String medicalId = "1768548145559506946";
|
|
|
|
|
// 动态视频
|
|
|
|
|
String dynamicFile = "D:\\virtual-patient-manage\\src\\main\\resources\\static\\medical\\" + medicalId + ".txt";
|
|
|
|
|
String dynamicFilePath = "F:\\tmp\\数字人\\董婉萍-动态视频-1.mp4";
|
|
|
|
|
// 静态视频
|
|
|
|
|
String staticFile = "D:\\virtual-patient-manage\\src\\main\\resources\\static\\medical\\" + medicalId + ".silence.txt";
|
|
|
|
|
String staticFilePath = "F:\\tmp\\数字人\\董婉萍静态视频-1.mp4";
|
|
|
|
|
|
|
|
|
|
File staticFile = new File(staticFilePath);
|
|
|
|
|
File dynamicFile = new File(dynamicFilePath);
|
|
|
|
|
FileResource staticFileResource = fileManageService.uploadFile(new FileInputStream(staticFile));
|
|
|
|
|
FileResource dynamicFileResource = fileManageService.uploadFile(new FileInputStream(dynamicFile));
|
|
|
|
|
|
|
|
|
@ -50,13 +56,13 @@ public class MedicalAiAnswerSetter {
|
|
|
|
|
MaterialLibrary staticMaterial = new MaterialLibrary();
|
|
|
|
|
staticMaterial.setDirectoryId(directoryId);
|
|
|
|
|
staticMaterial.setMaterialType(1);
|
|
|
|
|
staticMaterial.setMaterialName(staticFileResource.getFileName());
|
|
|
|
|
staticMaterial.setMaterialName(staticFile.getName());
|
|
|
|
|
staticMaterial.setFileResourceId(staticFileResource.getId());
|
|
|
|
|
|
|
|
|
|
MaterialLibrary dynamicMaterial = new MaterialLibrary();
|
|
|
|
|
dynamicMaterial.setDirectoryId(directoryId);
|
|
|
|
|
dynamicMaterial.setMaterialType(1);
|
|
|
|
|
dynamicMaterial.setMaterialName(dynamicFileResource.getFileName());
|
|
|
|
|
dynamicMaterial.setMaterialName(dynamicFile.getName());
|
|
|
|
|
dynamicMaterial.setFileResourceId(dynamicFileResource.getId());
|
|
|
|
|
materialLibraryManageService.uploadMaterial(List.of(staticMaterial,dynamicMaterial));
|
|
|
|
|
|
|
|
|
@ -86,6 +92,6 @@ public class MedicalAiAnswerSetter {
|
|
|
|
|
askPatientAnswer.setAnswerResourceId(fileId);
|
|
|
|
|
askPatientAnswer.setAnswerType(1);
|
|
|
|
|
}
|
|
|
|
|
askPatientAnswerService.save(askPatientAnswer);
|
|
|
|
|
askPatientAnswerService.saveOrUpdate(askPatientAnswer);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|