|
@@ -1,27 +1,34 @@
|
|
package com.lantone.qc.kernel.catalogue.threelevelward;
|
|
package com.lantone.qc.kernel.catalogue.threelevelward;
|
|
|
|
|
|
|
|
+import com.google.common.collect.Lists;
|
|
|
|
+import com.google.common.collect.Maps;
|
|
import com.lantone.qc.kernel.catalogue.QCCatalogue;
|
|
import com.lantone.qc.kernel.catalogue.QCCatalogue;
|
|
import com.lantone.qc.kernel.util.CatalogueUtil;
|
|
import com.lantone.qc.kernel.util.CatalogueUtil;
|
|
|
|
+import com.lantone.qc.kernel.util.SimilarityUtil;
|
|
import com.lantone.qc.pub.model.InputInfo;
|
|
import com.lantone.qc.pub.model.InputInfo;
|
|
import com.lantone.qc.pub.model.OutputInfo;
|
|
import com.lantone.qc.pub.model.OutputInfo;
|
|
-import com.lantone.qc.pub.model.doc.DoctorAdviceDoc;
|
|
|
|
-import com.lantone.qc.pub.model.doc.FirstCourseRecordDoc;
|
|
|
|
-import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
|
|
|
|
|
|
+import com.lantone.qc.pub.model.doc.*;
|
|
|
|
+import com.lantone.qc.pub.model.doc.consultation.ConsultationDoc;
|
|
|
|
+import com.lantone.qc.pub.model.doc.consultation.ConsultationResultsDoc;
|
|
|
|
+import com.lantone.qc.pub.model.doc.operation.OperationDiscussionDoc;
|
|
|
|
+import com.lantone.qc.pub.model.doc.operation.OperationDoc;
|
|
|
|
+import com.lantone.qc.pub.model.doc.operation.OperationRecordDoc;
|
|
|
|
+import com.lantone.qc.pub.model.entity.Drug;
|
|
|
|
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
|
|
|
|
+import com.lantone.qc.pub.util.DateUtil;
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
|
-import java.util.Arrays;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
-import java.util.Set;
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.regex.Matcher;
|
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @ClassName : THR02985
|
|
* @ClassName : THR02985
|
|
* @Description : 医嘱有抗生素使用病程无记录
|
|
* @Description : 医嘱有抗生素使用病程无记录
|
|
- * 药品类型(0.普药 1.抗生素 2.激素)
|
|
|
|
|
|
+ * 药品类型(0.普药 1.抗生素 2.抗生素)
|
|
* @Author : 胡敬
|
|
* @Author : 胡敬
|
|
* @Date: 2020-06-23 10:04
|
|
* @Date: 2020-06-23 10:04
|
|
*/
|
|
*/
|
|
@@ -39,86 +46,278 @@ public class THR02985 extends QCCatalogue {
|
|
"利福平胶囊",
|
|
"利福平胶囊",
|
|
"异烟肼针"
|
|
"异烟肼针"
|
|
};
|
|
};
|
|
|
|
+ @Autowired
|
|
|
|
+ SimilarityUtil similarityUtil;
|
|
|
|
|
|
public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
List<DoctorAdviceDoc> doctorAdviceDocs = inputInfo.getDoctorAdviceDocs();
|
|
List<DoctorAdviceDoc> doctorAdviceDocs = inputInfo.getDoctorAdviceDocs();
|
|
List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
|
|
List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
|
|
|
|
+ FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
|
|
|
|
+ BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
|
|
|
|
+ List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
|
|
|
|
+ LeaveHospitalDoc leaveHospitalDoc = inputInfo.getLeaveHospitalDoc();
|
|
|
|
+ List<ConsultationDoc> consultationDocs = inputInfo.getConsultationDocs();
|
|
if (doctorAdviceDocs.size() == 0 || threeLevelWardDocs.size() == 0) {
|
|
if (doctorAdviceDocs.size() == 0 || threeLevelWardDocs.size() == 0) {
|
|
status.set("0");
|
|
status.set("0");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- Map<Date, String> doctorAdviceDrugMap = new HashMap<>();
|
|
|
|
|
|
+ List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
|
|
|
|
+ if (allDoctorWradDocs.size() == 0) {
|
|
|
|
+ status.set("0");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ Map<Date, String> doctorAdviceDrugMap = Maps.newLinkedHashMap();
|
|
for (DoctorAdviceDoc adviceDoc : doctorAdviceDocs) {
|
|
for (DoctorAdviceDoc adviceDoc : doctorAdviceDocs) {
|
|
Map<String, String> adviceDocStructureMap = adviceDoc.getStructureMap();
|
|
Map<String, String> adviceDocStructureMap = adviceDoc.getStructureMap();
|
|
String name = adviceDocStructureMap.get("医嘱项目名称");
|
|
String name = adviceDocStructureMap.get("医嘱项目名称");
|
|
String drugCategory = adviceDocStructureMap.get("药品类型");
|
|
String drugCategory = adviceDocStructureMap.get("药品类型");
|
|
String startDateStr = adviceDocStructureMap.get("医嘱开始时间");
|
|
String startDateStr = adviceDocStructureMap.get("医嘱开始时间");
|
|
- if (StringUtil.isNotBlank(drugCategory) && drugCategory.equals("抗生素")) {
|
|
|
|
|
|
+ if (StringUtil.isNotBlank(drugCategory) && drugCategory.contains("抗生素")) {
|
|
if (StringUtil.isNotBlank(name)) {
|
|
if (StringUtil.isNotBlank(name)) {
|
|
|
|
+ name = name.replaceAll("[针]", "");
|
|
|
|
+ if (name.contains(" ")) {
|
|
|
|
+ name = name.split(" ")[0];
|
|
|
|
+ }
|
|
if (Arrays.asList(KSS).contains(name)) {
|
|
if (Arrays.asList(KSS).contains(name)) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- doctorAdviceDrugMap.put(StringUtil.parseDateTime(startDateStr), name);
|
|
|
|
|
|
+ Date startDate = StringUtil.parseDateTime(startDateStr);
|
|
|
|
+ if (startDate != null) {
|
|
|
|
+ startDate = DateUtil.dateZeroClear(startDate);
|
|
|
|
+ doctorAdviceDrugMap.put(startDate, name);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
|
|
|
|
- if (allDoctorWradDocs.size() == 0) {
|
|
|
|
- status.set("0");
|
|
|
|
- return;
|
|
|
|
|
|
+
|
|
|
|
+ Map<String, Date> info = Maps.newLinkedHashMap();
|
|
|
|
+ //入院记录中获取信息
|
|
|
|
+ if (beHospitalizedDoc != null) {
|
|
|
|
+ Map<String, String> structureMap = beHospitalizedDoc.getStructureMap();
|
|
|
|
+ getInfo(info, structureMap, "入院记录", "入院日期", "治疗计划");
|
|
}
|
|
}
|
|
|
|
+ //从首程治疗计划中获取信息
|
|
|
|
+ if (firstCourseRecordDoc != null) {
|
|
|
|
+ Map<String, String> structureMap = firstCourseRecordDoc.getStructureMap();
|
|
|
|
+ getInfo(info, structureMap, "首次病程录", "记录时间", "治疗计划");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //从手术记录中获取信息
|
|
|
|
+ if (operationDocs.size() > 0) {
|
|
|
|
+ //手术记录
|
|
|
|
+ List<Map<String, String>> operationRecordStructMap = operationDocs
|
|
|
|
+ .stream()
|
|
|
|
+ .map(OperationDoc::getOperationRecordDoc)
|
|
|
|
+ .filter(Objects::nonNull)
|
|
|
|
+ .map(OperationRecordDoc::getStructureMap)
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ operationRecordStructMap.forEach(x -> getInfo(info, x, "手术记录", "病历日期", "手术经过"));
|
|
|
|
+ //术后首程
|
|
|
|
+ List<Map<String, String>> operationDiscussionStructMap = operationDocs
|
|
|
|
+ .stream()
|
|
|
|
+ .map(OperationDoc::getOperationDiscussionDoc)
|
|
|
|
+ .filter(Objects::nonNull)
|
|
|
|
+ .map(OperationDiscussionDoc::getStructureMap)
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ operationDiscussionStructMap.forEach(x -> getInfo(info, x, "术后首程", "记录日期", "手术经过", "治疗计划和措施"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //从会诊记录中获取信息
|
|
|
|
+ if (consultationDocs.size() > 0) {
|
|
|
|
+ List<Map<String, String>> consultationResultStructMap = consultationDocs
|
|
|
|
+ .stream()
|
|
|
|
+ .map(ConsultationDoc::getConsultationResultsDoc)
|
|
|
|
+ .filter(Objects::nonNull)
|
|
|
|
+ .map(ConsultationResultsDoc::getStructureMap)
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ consultationResultStructMap.forEach(x -> getInfo(info, x, "会诊结果单", "会诊日期及时间", "会诊意见"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //从出院小结中获取信息
|
|
|
|
+ if (leaveHospitalDoc != null) {
|
|
|
|
+ Map<String, String> structureMap = leaveHospitalDoc.getStructureMap();
|
|
|
|
+ getInfo(info, structureMap, "出院小结", "出院时间", "诊治经过");
|
|
|
|
+ }
|
|
|
|
+
|
|
String infoStr = "";
|
|
String infoStr = "";
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
for (Map.Entry<Date, String> doctorAdviceDrug : doctorAdviceDrugMap.entrySet()) {
|
|
for (Map.Entry<Date, String> doctorAdviceDrug : doctorAdviceDrugMap.entrySet()) {
|
|
Date doctorAdviceDate = doctorAdviceDrug.getKey();
|
|
Date doctorAdviceDate = doctorAdviceDrug.getKey();
|
|
- Set<String> splitDrugs = CatalogueUtil.getRegexWords(doctorAdviceDrug.getValue(), "[((\\[][^\\[\\]()()]+[\\]))]");
|
|
|
|
-
|
|
|
|
- boolean isFind = false;
|
|
|
|
- for (String drug : splitDrugs) {
|
|
|
|
- int matchSum = 0;
|
|
|
|
- if (drug.equals("合资") || drug.equals("进口") || drug.equals("国产")) {
|
|
|
|
- continue;
|
|
|
|
|
|
+ String drugs = doctorAdviceDrug.getValue();
|
|
|
|
+ drugs = removeBracket(drugs);
|
|
|
|
+ Set<String> splitDrugs = CatalogueUtil.getRegexWords(drugs, "[((\\[][^\\[\\]()()]+[\\]))]")
|
|
|
|
+ .stream().filter(x -> !x.equals("合资") && !x.equals("进口") && !x.equals("国产")).collect(Collectors.toSet());
|
|
|
|
+ String missDrug = "";
|
|
|
|
+ for (Map.Entry<String, Date> map : info.entrySet()) {
|
|
|
|
+ missDrug = getMissDrug(map.getKey(), map.getValue(), doctorAdviceDate, splitDrugs, 2, missDrug);
|
|
|
|
+ //当前抗生素药(drugs)在info中已找到,直接跳出当前循环
|
|
|
|
+ if (StringUtil.isBlank(missDrug)) {
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
- matchSum = getMatchSum(inputInfo.getFirstCourseRecordDoc(), allDoctorWradDocs, doctorAdviceDate, drug.replace("针", ""), matchSum, 2);
|
|
|
|
- if (matchSum > 0) {
|
|
|
|
- isFind = true;
|
|
|
|
|
|
+ }
|
|
|
|
+ if (StringUtil.isBlank(missDrug)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ boolean modelFind = false;
|
|
|
|
+ int wardNum = 0;
|
|
|
|
+ for (ThreeLevelWardDoc threeLevelWardDoc : allDoctorWradDocs) {
|
|
|
|
+ /*****************纯文本匹配******************/
|
|
|
|
+ Map<String, String> wardDocStructureMap = threeLevelWardDoc.getStructureMap();
|
|
|
|
+ String wardDateStr = wardDocStructureMap.get("查房日期");
|
|
|
|
+ String content = wardDocStructureMap.get("病情记录") + wardDocStructureMap.get("治疗计划和措施");
|
|
|
|
+ Date wardDate = StringUtil.parseDateTime(wardDateStr);
|
|
|
|
+ missDrug = getMissDrug(content, wardDate, doctorAdviceDate, splitDrugs, 2, missDrug);
|
|
|
|
+ //当前抗生素药(drugs)在查房记录中已找到,直接跳出当前查房记录的循环
|
|
|
|
+ /*****************药品相似度模型******************/
|
|
|
|
+ List<ThreeLevelWardLabel> label = threeLevelWardDoc.getThreeLevelWardLabel();
|
|
|
|
+ if (label.size() > 0) {
|
|
|
|
+ List<Drug> drugList = label.get(0).getDrugs();
|
|
|
|
+ for (Drug drug : drugList) {
|
|
|
|
+ for (String adDrug : splitDrugs) {
|
|
|
|
+ if (compareStandard(drug.getName(), adDrug)) {
|
|
|
|
+ modelFind = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (modelFind) {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (StringUtil.isNotBlank(missDrug) && !modelFind) {//missDrug不为空,只有两种可能:1.确实是缺失的药 2.字符串为“时间不匹配”
|
|
|
|
+ wardNum++; //当前所有查房记录都没找到药,该医嘱时间再与系统当前时间对比,若超过48小时则提示该药缺失
|
|
|
|
+ }
|
|
|
|
+ if (StringUtil.isBlank(missDrug) || modelFind) {
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (!isFind) {
|
|
|
|
- String.format(infoStr = CatalogueUtil.concatInfo(infoStr, doctorAdviceDrug.getValue() + "<医嘱时间>:" + sdf.format(doctorAdviceDate)));
|
|
|
|
|
|
+ //如果目前所有查房记录都没有
|
|
|
|
+ if (wardNum == allDoctorWradDocs.size() && CatalogueUtil.compareTime(doctorAdviceDate, new Date(), 48 * 60L)) {
|
|
|
|
+ infoStr = CatalogueUtil.concatInfo(infoStr, splitDrugs.toString().replaceAll("[\\[\\]]", "") + "(" + DateUtil.formatDate(doctorAdviceDate) + ")");
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ if (StringUtil.isNotBlank(missDrug) && !"时间不匹配".equals(missDrug) && !modelFind) {
|
|
|
|
+ infoStr = CatalogueUtil.concatInfo(infoStr, missDrug + "(" + DateUtil.formatDate(doctorAdviceDate) + ")");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if (StringUtil.isNotBlank(infoStr)) {
|
|
if (StringUtil.isNotBlank(infoStr)) {
|
|
- status.set("-1");
|
|
|
|
- info.set(infoStr);
|
|
|
|
|
|
+ this.status.set("-1");
|
|
|
|
+ this.info.set(infoStr);
|
|
} else {
|
|
} else {
|
|
- status.set("0");
|
|
|
|
|
|
+ this.status.set("0");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private int getMatchSum(FirstCourseRecordDoc firstCourseRecordDoc, List<ThreeLevelWardDoc> allDoctorWradDocs, Date doctorAdviceDate, String drug, int matchSum, int days) {
|
|
|
|
- if (firstCourseRecordDoc != null) {
|
|
|
|
- String wardDateStr = firstCourseRecordDoc.getStructureMap().get("病历日期");
|
|
|
|
- String content = firstCourseRecordDoc.getStructureMap().get("治疗计划") + firstCourseRecordDoc.getStructureMap().get("诊疗计划");
|
|
|
|
- Date wardDate = StringUtil.parseDateTime(wardDateStr);
|
|
|
|
- if (doctorAdviceDate.before(wardDate) && !CatalogueUtil.compareTime(doctorAdviceDate, wardDate, days * 24 * 60L)) {
|
|
|
|
- if (content.contains(drug)) {
|
|
|
|
- matchSum++;
|
|
|
|
- }
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取各模块信息<入院记录、首次病程录、手术记录、术后首程、会诊结果单、查房记录、出院小结>
|
|
|
|
+ *
|
|
|
|
+ * @param structureMap
|
|
|
|
+ * @param info
|
|
|
|
+ */
|
|
|
|
+ private void getInfo(Map<String, Date> info, Map<String, String> structureMap, String modelType, String dateKey, String... contentKey) {
|
|
|
|
+ String content = CatalogueUtil.structureMapJoin(structureMap, Lists.newArrayList(contentKey));
|
|
|
|
+ String recordDateStr = structureMap.get(dateKey);
|
|
|
|
+ if (StringUtil.isNotBlank(recordDateStr)) {
|
|
|
|
+ Date date = StringUtil.parseDateTime(recordDateStr);
|
|
|
|
+ if (StringUtil.isNotBlank(content) && date != null) {
|
|
|
|
+ info.put(modelType + "->" + content, date);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- for (ThreeLevelWardDoc threeLevelWardDoc : allDoctorWradDocs) {
|
|
|
|
- Map<String, String> wardDocStructureMap = threeLevelWardDoc.getStructureMap();
|
|
|
|
- String wardDateStr = wardDocStructureMap.get("查房日期");
|
|
|
|
- String content = wardDocStructureMap.get("病情记录") + wardDocStructureMap.get("治疗计划和措施");
|
|
|
|
- Date wardDate = StringUtil.parseDateTime(wardDateStr);
|
|
|
|
- if (doctorAdviceDate.before(wardDate) && !CatalogueUtil.compareTime(doctorAdviceDate, wardDate, days * 24 * 60L)) {
|
|
|
|
- if (content.contains(drug)) {
|
|
|
|
- matchSum++;
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 核心:从文本中找药
|
|
|
|
+ *
|
|
|
|
+ * @param content 文本
|
|
|
|
+ * @param wardDate
|
|
|
|
+ * @param doctorAdviceDate
|
|
|
|
+ * @param drugs
|
|
|
|
+ * @param days
|
|
|
|
+ * @return 如果文本中找到该药,则返回空字符串
|
|
|
|
+ */
|
|
|
|
+ private String getMissDrug(String content, Date wardDate, Date doctorAdviceDate, Set<String> drugs, int days, String missDrug) {
|
|
|
|
+ if ("时间不匹配".equals(missDrug)) {
|
|
|
|
+ missDrug = "";//初始化缺失药物
|
|
|
|
+ }
|
|
|
|
+ //开医嘱时间起,昨天今天明天记录内查找药
|
|
|
|
+ if ((doctorAdviceDate.before(wardDate) && !CatalogueUtil.compareTime(doctorAdviceDate, wardDate, days * 24 * 60L))
|
|
|
|
+ || (wardDate.before(doctorAdviceDate) && !CatalogueUtil.compareTime(wardDate, doctorAdviceDate, 24 * 60L))) {
|
|
|
|
+ boolean findDrug = false;
|
|
|
|
+ for (String drug : drugs) {
|
|
|
|
+ if (StringUtil.isBlank(drug)) {
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
|
|
+ if (content.contains(drug.replaceAll("[^\\u4e00-\\u9fa5]", ""))
|
|
|
|
+ || regexFind(content, "继续", "治疗") || regexFind(content, "维持", "治疗")
|
|
|
|
+ || regexFind(content, "继续", "抗感染") || regexFind(content, "治疗", "同前")) {
|
|
|
|
+ findDrug = true;
|
|
|
|
+ break;
|
|
|
|
+ } else {
|
|
|
|
+ missDrug = concatInfo(missDrug, drug);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (findDrug) {
|
|
|
|
+ missDrug = "";//如果找到一种抗生素药,就把报错信息置为空
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (StringUtil.isBlank(missDrug)) {
|
|
|
|
+ missDrug = "时间不匹配";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return missDrug;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private String concatInfo(String infoStr, String content) {
|
|
|
|
+ if (StringUtil.isBlank(infoStr)) {
|
|
|
|
+ infoStr += content;
|
|
|
|
+ } else {
|
|
|
|
+ if (!infoStr.contains(content)) {
|
|
|
|
+ infoStr += "或" + content;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return matchSum;
|
|
|
|
|
|
+ return infoStr;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private boolean regexFind(String content, String... str) {
|
|
|
|
+ String s = "";
|
|
|
|
+ for (String word : str) {
|
|
|
|
+ s += word + ".*";
|
|
|
|
+ }
|
|
|
|
+ s = s.substring(0, s.lastIndexOf(".*"));
|
|
|
|
+ Pattern p = Pattern.compile(s);
|
|
|
|
+ Matcher m = p.matcher(content);
|
|
|
|
+ return m.find();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 比较两个抗生素标准词是否一致
|
|
|
|
+ *
|
|
|
|
+ * @param firstWord
|
|
|
|
+ * @param secordWord
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private boolean compareStandard(String firstWord, String secordWord) {
|
|
|
|
+ if (StringUtil.isBlank(firstWord) || StringUtil.isBlank(secordWord)) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ String drugStandardWord1 = similarityUtil.getDrugStandardWord(firstWord);
|
|
|
|
+ String drugStandardWord2 = similarityUtil.getDrugStandardWord(secordWord);
|
|
|
|
+ if (drugStandardWord1 == null || drugStandardWord2 == null) {
|
|
|
|
+ return firstWord.equals(secordWord) || firstWord.contains(secordWord) || secordWord.contains(firstWord);
|
|
|
|
+ }
|
|
|
|
+ return drugStandardWord1.equals(drugStandardWord2);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 如果文本包含中括号([海正]美罗培南针),取括号之后的文字
|
|
|
|
+ *
|
|
|
|
+ * @param str
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private String removeBracket(String str) {
|
|
|
|
+ if (str.contains("]") && str.indexOf("]") != str.length() - 1) {
|
|
|
|
+ return str.substring(str.indexOf("]") + 1);
|
|
|
|
+ }
|
|
|
|
+ return str;
|
|
}
|
|
}
|
|
}
|
|
}
|