|
@@ -1,12 +1,19 @@
|
|
|
package com.lantone.qc.kernel.catalogue.beilun.crisisvaluereport;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.lantone.qc.kernel.catalogue.QCCatalogue;
|
|
|
+import com.lantone.qc.kernel.client.SimilarityServiceClient;
|
|
|
import com.lantone.qc.pub.model.InputInfo;
|
|
|
import com.lantone.qc.pub.model.OutputInfo;
|
|
|
import com.lantone.qc.pub.model.doc.CrisisInfoDoc;
|
|
|
import com.lantone.qc.pub.model.doc.CrisisValueReportDoc;
|
|
|
+import com.lantone.qc.pub.model.entity.Annotation;
|
|
|
+import com.lantone.qc.pub.model.vo.SimilarityVo;
|
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
@@ -20,7 +27,8 @@ import java.util.List;
|
|
|
*/
|
|
|
@Component
|
|
|
public class CRI0382 extends QCCatalogue {
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ SimilarityServiceClient similarityServiceClient;
|
|
|
@Override
|
|
|
public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
|
status.set("0");
|
|
@@ -79,12 +87,16 @@ public class CRI0382 extends QCCatalogue {
|
|
|
for (CrisisValueReportDoc crisisValueReportDoc : crisisValueReportDocs) {
|
|
|
String recordTimeStr = crisisValueReportDoc.getStructureMap().get("病历日期");
|
|
|
String docReptContent = crisisValueReportDoc.getStructureMap().get("病情分析及处理");
|
|
|
+ //添加文本相似度去比较病情分析及处理
|
|
|
+ boolean flag = getLikeRate(submitContent(StringUtil.removeBlank(docReptContent))
|
|
|
+ ,StringUtil.removeBlank(crisisName));
|
|
|
if ((StringUtil.parseDateTime(recordTimeStr, dateFormats).getTime() - StringUtil.parseDateTime(reptTime, dateFormats).getTime()) < timeCha
|
|
|
&& (StringUtil.removeBlank(docReptContent).contains(StringUtil.removeBlank(crisisName)) ||
|
|
|
(StringUtil.isNotBlank(crisisNm) && StringUtil.isNotBlank(companyNum)
|
|
|
&& StringUtil.removeBlank(docReptContent).contains(StringUtil.removeBlank(crisisNm))
|
|
|
&& StringUtil.removeBlank(docReptContent).contains(StringUtil.removeBlank(companyNum))
|
|
|
- ))) {
|
|
|
+ ))
|
|
|
+ ||flag) {
|
|
|
findCrisises.add(reptTime);
|
|
|
break;
|
|
|
}
|
|
@@ -113,5 +125,69 @@ public class CRI0382 extends QCCatalogue {
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
+ /**
|
|
|
+ * @Author songxl
|
|
|
+ * @Description 内容截取
|
|
|
+ * @Date 2021/3/29
|
|
|
+ * @Param [content]
|
|
|
+ * @Return java.lang.String
|
|
|
+ * @MethodName submitContent
|
|
|
+ */
|
|
|
+ private String submitContent(String content) {
|
|
|
+ if(StringUtil.isNotBlank(content))
|
|
|
+ {
|
|
|
+ if(content.contains("具体为"))
|
|
|
+ {
|
|
|
+ content = content.split("具体为")[1];
|
|
|
+ }
|
|
|
+ if(content.contains("处理意见"))
|
|
|
+ {
|
|
|
+ content = content.split("处理意见")[0];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return content;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * @Author songxl
|
|
|
+ * @Description 获取文本相似度
|
|
|
+ * @Date 2021/3/29
|
|
|
+ * @Param [text_1, text_2]
|
|
|
+ * @Return boolean
|
|
|
+ * @MethodName getFlag
|
|
|
+ */
|
|
|
+ private boolean getLikeRate(String text_1, String text_2) {
|
|
|
+ JSONArray similarContent = new JSONArray();
|
|
|
+ JSONObject detailContent = new JSONObject();
|
|
|
+ detailContent.put("text_1", text_1);
|
|
|
+ detailContent.put("text_2", text_2);
|
|
|
+ similarContent.add(detailContent);
|
|
|
+ //存储CRF完整所需结构数据
|
|
|
+ SimilarityVo similarityVo = new SimilarityVo();
|
|
|
+ similarityVo.setData(similarContent);
|
|
|
+ //获取CRF模型返回数据
|
|
|
+ JSONArray data = getAnnotation(similarityServiceClient, similarityVo).getData();
|
|
|
+ double likeRate = 0d;
|
|
|
+ if (data.size() > 0) {
|
|
|
+ JSONObject dataContent = data.getJSONObject(0);
|
|
|
+ likeRate = dataContent.getDoubleValue("like_rate");
|
|
|
+ }
|
|
|
+ if(likeRate>0.8)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ private Annotation getAnnotation(SimilarityServiceClient similarityServiceClient, SimilarityVo similarityVo) {
|
|
|
+ Annotation annotation = new Annotation();
|
|
|
+ try {
|
|
|
+ String annotation_str = similarityServiceClient.getAnnotation(similarityVo);
|
|
|
+ annotation = JSON.parseObject(annotation_str, Annotation.class);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ return annotation;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|