master
周文涛 2 years ago
parent 9049166cde
commit f7b45222f7

@ -177,7 +177,31 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
//TODO 注意ocr 识别返回的 字段是多个结果(数组),有一个值匹配上即为正确
List<JSONObject> ocrArray = new ArrayList<>();
for (String s : fieldNameList) {
JSONArray jsonArray = semanticResult.getJSONArray(s);
JSONArray jsonArray = new JSONArray();
if (Arrays.asList("医生名称","姓名","医生").contains(s)) {
for (String s1 : Arrays.asList("医生名称", "姓名", "医生")) {
JSONArray semantic_result = semanticResult.getJSONObject("semantic_result").getJSONArray(s1);
if (CollectionUtils.isNotEmpty(semantic_result)) {
jsonArray.addAll(semantic_result);
}
}
}else if (Arrays.asList("科室名称","科室").contains(s)) {
for (String s1 : Arrays.asList("科室名称","科室")) {
JSONArray semantic_result = semanticResult.getJSONObject("semantic_result").getJSONArray(s1);
if (CollectionUtils.isNotEmpty(semantic_result)) {
jsonArray.addAll(semantic_result);
}
}
}else if (Arrays.asList("医院名称","医院").contains(s)) {
for (String s1 : Arrays.asList("医院名称","医院")) {
JSONArray semantic_result = semanticResult.getJSONObject("semantic_result").getJSONArray(s1);
if (CollectionUtils.isNotEmpty(semantic_result)) {
jsonArray.addAll(semantic_result);
}
}
}else{
jsonArray = semanticResult.getJSONObject("semantic_result").getJSONArray(s);
}
if (jsonArray != null && jsonArray.size() > 0) {
ocrArray.addAll(jsonArray.toJavaList(JSONObject.class));
}
@ -740,6 +764,20 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
jsonArray.addAll(semantic_result);
}
}
}else if (Arrays.asList("科室名称","科室").contains(s)) {
for (String s1 : Arrays.asList("科室名称","科室")) {
JSONArray semantic_result = semanticResult.getJSONObject("semantic_result").getJSONArray(s1);
if (CollectionUtils.isNotEmpty(semantic_result)) {
jsonArray.addAll(semantic_result);
}
}
}else if (Arrays.asList("医院名称","医院").contains(s)) {
for (String s1 : Arrays.asList("医院名称","医院")) {
JSONArray semantic_result = semanticResult.getJSONObject("semantic_result").getJSONArray(s1);
if (CollectionUtils.isNotEmpty(semantic_result)) {
jsonArray.addAll(semantic_result);
}
}
}else{
jsonArray = semanticResult.getJSONObject("semantic_result").getJSONArray(s);
}

Loading…
Cancel
Save