|
@@ -2,8 +2,8 @@ package com.lantone.qc.kernel.catalogue.behospitalized;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.lantone.qc.kernel.catalogue.QCCatalogue;
|
|
|
-import com.lantone.qc.kernel.client.SimilarityServiceClient;
|
|
|
-import com.lantone.qc.kernel.structure.ai.FirstCourseRecordAI;
|
|
|
+import com.lantone.qc.kernel.client.ChiefPresentSimilarityServiceClient;
|
|
|
+import com.lantone.qc.kernel.structure.ai.ModelAI;
|
|
|
import com.lantone.qc.pub.model.InputInfo;
|
|
|
import com.lantone.qc.pub.model.OutputInfo;
|
|
|
import com.lantone.qc.pub.model.doc.BeHospitalizedDoc;
|
|
@@ -14,6 +14,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -27,7 +28,7 @@ import java.util.stream.Collectors;
|
|
|
@Component
|
|
|
public class BEH0449 extends QCCatalogue {
|
|
|
@Autowired
|
|
|
- SimilarityServiceClient similarityServiceClient;
|
|
|
+ ChiefPresentSimilarityServiceClient chiefPresentSimilarityServiceClient;
|
|
|
|
|
|
public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
|
if (inputInfo.getBeHospitalizedDoc() == null) {
|
|
@@ -41,29 +42,32 @@ public class BEH0449 extends QCCatalogue {
|
|
|
status.set("0");
|
|
|
return;
|
|
|
} else {
|
|
|
- List<Clinical> clinicals_chief = beHospitalizedDoc.getChiefLabel().getClinicals();
|
|
|
- List<Clinical> clinicals_present = beHospitalizedDoc.getPresentLabel().getClinicals();
|
|
|
- if (ListUtil.isNotEmpty(clinicals_chief) && ListUtil.isNotEmpty(clinicals_present)) {
|
|
|
- Clinical clinical_chief = clinicals_chief.get(0);
|
|
|
- clinicals_present = clinicals_present.stream().filter(clinical -> clinical.getNegative() == null).collect(Collectors.toList());
|
|
|
- for (Clinical cliPre : clinicals_present) {
|
|
|
- String name_pre = cliPre.getName();
|
|
|
- String name_chief = clinical_chief.getName();
|
|
|
- if (name_chief.equals(name_pre)) {
|
|
|
+ List<Clinical> chiefClinicals = beHospitalizedDoc.getChiefLabel().getClinicals();
|
|
|
+ List<Clinical> presentClinicals = beHospitalizedDoc.getPresentLabel().getClinicals();
|
|
|
+ if (ListUtil.isNotEmpty(chiefClinicals) && ListUtil.isNotEmpty(presentClinicals)) {
|
|
|
+ Clinical chiefClinical = chiefClinicals.get(0);
|
|
|
+ String chiefClinic = chiefClinical.getName();
|
|
|
+ /* 去除阴性症状,只保留阳性症状 */
|
|
|
+ presentClinicals = presentClinicals.stream().filter(clinical -> clinical.getNegative() == null).collect(Collectors.toList());
|
|
|
+ for (Clinical cliPre : presentClinicals) {
|
|
|
+ String presentClinical = cliPre.getName();
|
|
|
+ if (chiefClinic.equals(presentClinical)) {
|
|
|
status.set("0");
|
|
|
return;
|
|
|
- } else if (name_pre.contains(name_chief) || name_chief.contains(name_pre)) {
|
|
|
+ } else if (presentClinical.contains(chiefClinic) || chiefClinic.contains(presentClinical)) {
|
|
|
+ status.set("0");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<String> clinicName = getClinicName(presentClinicals);
|
|
|
+ /* 文本相似度模型 */
|
|
|
+ ModelAI modelAI = new ModelAI();
|
|
|
+ JSONArray jsonArray = modelAI.loadChiefPresentSimilarAI(chiefClinic, clinicName, false, chiefPresentSimilarityServiceClient);
|
|
|
+ if (jsonArray.size() == 2) {
|
|
|
+ double likeRate = jsonArray.getDoubleValue(1);
|
|
|
+ if (likeRate > 0.9) {
|
|
|
status.set("0");
|
|
|
return;
|
|
|
- } else {
|
|
|
- JSONArray similarContent = new JSONArray();
|
|
|
- FirstCourseRecordAI firstCourseRecordAI = new FirstCourseRecordAI();
|
|
|
- firstCourseRecordAI.putContent(similarContent, name_chief, name_pre);
|
|
|
- double likeRate = firstCourseRecordAI.loadSimilarAI(similarContent, similarityServiceClient);
|
|
|
- if (likeRate > 0.9) {
|
|
|
- status.set("0");
|
|
|
- return;
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -83,4 +87,12 @@ public class BEH0449 extends QCCatalogue {
|
|
|
status.set("0");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private List<String> getClinicName(List<Clinical> presentClinicals) {
|
|
|
+ List<String> clinicNames = new ArrayList<>();
|
|
|
+ for (Clinical clinical : presentClinicals) {
|
|
|
+ clinicNames.add(clinical.getName());
|
|
|
+ }
|
|
|
+ return clinicNames;
|
|
|
+ }
|
|
|
}
|