|
|
|
|
@ -135,7 +135,7 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
|
|
|
|
|
String outputImagePath = fileUrl + imgPath.substring(i + 1, imgPath.length());
|
|
|
|
|
List<List<Point>> resultToPoints = ImageUtils.semanticResultToPoints(semanticResult);
|
|
|
|
|
if (resultToPoints.size() > 0) {
|
|
|
|
|
ImageUtils.drawDashedRectangleOnImages(file.getAbsolutePath(), resultToPoints, outputImagePath);
|
|
|
|
|
ImageUtils.drawDashedRectangleOnImages(file.getAbsolutePath(), resultToPoints, outputImagePath,"red");
|
|
|
|
|
ocrIdentifyDetail.setDrawDashedImageUrl(outputImagePath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -433,9 +433,9 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
|
|
|
|
|
} else {
|
|
|
|
|
ocrResultDTO.setTextRate(new BigDecimal(d).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
|
|
|
|
}
|
|
|
|
|
System.out.println("-----------------");
|
|
|
|
|
/*System.out.println("-----------------");
|
|
|
|
|
System.out.println(failureReason);
|
|
|
|
|
System.out.println("-----------------");
|
|
|
|
|
System.out.println("-----------------");*/
|
|
|
|
|
if (StringUtils.isNotBlank(imgPath)) {
|
|
|
|
|
SourceImage sourceImage = new SourceImage();
|
|
|
|
|
sourceImage.setPath(imgPath);
|
|
|
|
|
@ -702,7 +702,7 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (hasPoints){
|
|
|
|
|
ImageUtils.drawDashedRectangleOnImages(file.getAbsolutePath(), resultToPoints, outputImagePath);
|
|
|
|
|
ImageUtils.drawDashedRectangleOnImages(file.getAbsolutePath(), resultToPoints, outputImagePath,"green");
|
|
|
|
|
imgPath = outputImagePath;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -721,6 +721,9 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
|
|
|
|
|
String fieldName = value.getFieldName();//校验的字段名称
|
|
|
|
|
String ruleInfo = value.getRuleInfo();//是否绝对判断 0-绝对判断,1-不绝对判断
|
|
|
|
|
String inputText = value.getInputText();//校验文本 ,ocr识别的文本如果不包含该内容,则算作失败
|
|
|
|
|
if (StringUtils.isBlank(fieldName)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
List<String> fieldNameList = Arrays.asList(fieldName.split(","));
|
|
|
|
|
text = null;
|
|
|
|
|
//boolean b = ArrayOUtils.containsStringList(fieldNameList, new ArrayList<>(semanticResult.getJSONObject("semantic_result").keySet()));
|
|
|
|
|
@ -728,7 +731,18 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
|
|
|
|
|
//TODO 注意,ocr 识别返回的 字段是多个结果(数组),有一个值匹配上即为正确
|
|
|
|
|
List<JSONObject> ocrArray = new ArrayList<>();
|
|
|
|
|
for (String s : fieldNameList) {
|
|
|
|
|
JSONArray jsonArray = semanticResult.getJSONObject("semantic_result").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{
|
|
|
|
|
jsonArray = semanticResult.getJSONObject("semantic_result").getJSONArray(s);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (jsonArray != null && jsonArray.size() > 0) {
|
|
|
|
|
ocrArray.addAll(jsonArray.toJavaList(JSONObject.class));
|
|
|
|
|
}
|
|
|
|
|
|