|
|
|
@ -28,7 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|
|
|
|
|
|
|
|
|
import java.security.PublicKey;
|
|
|
|
|
import java.io.Console;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@ -48,6 +48,7 @@ public class VecTest {
|
|
|
|
|
private static final String BASE_URL = "http://192.168.10.137:8719";
|
|
|
|
|
@Test
|
|
|
|
|
public void questionCompareGenerateTest() {
|
|
|
|
|
// initVecData first step
|
|
|
|
|
String filePath = "F:\\tmp\\1\\副本医生临床问诊问题收集v1.xlsx";
|
|
|
|
|
|
|
|
|
|
ExcelReader reader = ExcelUtil.getReader(filePath,1);
|
|
|
|
@ -62,7 +63,17 @@ public class VecTest {
|
|
|
|
|
|
|
|
|
|
for (Map<String, Object> map : dataList) {
|
|
|
|
|
String question = MapUtil.getStr(map, "部分问诊问题(示例)");
|
|
|
|
|
String questionCode = askMatch(StrUtil.trim(question));
|
|
|
|
|
//String questionCode = askMatch(StrUtil.trim(question));
|
|
|
|
|
String questionCode = "";
|
|
|
|
|
String matchQuestion = "";
|
|
|
|
|
String matchScore = "";
|
|
|
|
|
List<Map<String, Object>> maps = questionMatch(StrUtil.trim(question));
|
|
|
|
|
if (CollUtil.isNotEmpty(maps)){
|
|
|
|
|
Map<String, Object> matchMap = maps.get(0);
|
|
|
|
|
questionCode = MapUtil.getStr(matchMap,"matchQuestionCode");
|
|
|
|
|
matchQuestion = MapUtil.getStr(matchMap, "matchQuestion");
|
|
|
|
|
matchScore = MapUtil.getStr(matchMap, "matchScore");
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isEmpty(questionCode)){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
@ -73,7 +84,7 @@ public class VecTest {
|
|
|
|
|
}
|
|
|
|
|
AskTemplateQuestionLibrary library = idMapQuestion.get(questionCode);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(library)){
|
|
|
|
|
map.put("匹配到的问题",library.getDescription());
|
|
|
|
|
map.put("匹配到的问题",matchQuestion);
|
|
|
|
|
CommonDic commonDic = pathMapDic.get(library.getDictId());
|
|
|
|
|
if (ObjectUtil.isNotEmpty(commonDic)){
|
|
|
|
|
String nameZhPath = commonDic.getNameZhPath();
|
|
|
|
@ -91,13 +102,13 @@ public class VecTest {
|
|
|
|
|
}
|
|
|
|
|
map.put("匹配到的问题路径",commonDic.getNameZhPath());
|
|
|
|
|
map.put("匹配到的字典id",commonDic.getId());
|
|
|
|
|
map.put("相似度",matchScore);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.info("开始把结果数据写入表格");
|
|
|
|
|
ExcelUtil.getWriter(filePath,"结果对比-2").write(dataList).flush() ;
|
|
|
|
|
ExcelUtil.getWriter(filePath,"结果对比-3").write(dataList).flush() ;
|
|
|
|
|
log.info("结束把结果数据写入表格");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -351,7 +362,7 @@ public class VecTest {
|
|
|
|
|
map.put("matchScore", score);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ExcelWriter writer = ExcelUtil.getWriter(path, "问询结果");
|
|
|
|
|
ExcelWriter writer = ExcelUtil.getWriter(path, "问询结果-1");
|
|
|
|
|
writer.addHeaderAlias("病例", "病例");
|
|
|
|
|
writer.addHeaderAlias("日常问诊", "日常问诊");
|
|
|
|
|
writer.addHeaderAlias("targetId", "目标问题");
|
|
|
|
@ -603,4 +614,27 @@ public class VecTest {
|
|
|
|
|
writer.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void questionListClean(){
|
|
|
|
|
List<AskTemplateQuestionLibrary> questionLibraries = askTemplateQuestionLibraryService.lambdaQuery().eq(AskTemplateQuestionLibrary::getId, "1761963910199513090").orderByDesc(AskTemplateQuestionLibrary::getId).list();
|
|
|
|
|
|
|
|
|
|
Console console = System.console();
|
|
|
|
|
for (AskTemplateQuestionLibrary questionLibrary : questionLibraries) {
|
|
|
|
|
String description = questionLibrary.getDescription();
|
|
|
|
|
List<String> question = questionLibrary.getQuestion();
|
|
|
|
|
|
|
|
|
|
List<String> addList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
for (String single : question) {
|
|
|
|
|
log.info("description:{}, single:{}",description,single);
|
|
|
|
|
log.info("remove is Y else is other");
|
|
|
|
|
String input = console.readLine();
|
|
|
|
|
if (!"Y".equals(input) && !"y".equals(input)){
|
|
|
|
|
addList.add(single);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//askTemplateQuestionLibraryService.lambdaUpdate().set(AskTemplateQuestionLibrary::getQuestion,addList).eq(AskTemplateQuestionLibrary::getId,questionLibrary.getId()).update();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|