|
@@ -0,0 +1,60 @@
|
|
|
+package com.diagbot.rule;
|
|
|
+
|
|
|
+import com.diagbot.biz.push.entity.Item;
|
|
|
+import com.diagbot.dto.RuleBaseDTO;
|
|
|
+import com.diagbot.dto.RuleSimpleDTO;
|
|
|
+import com.diagbot.dto.WordCrfDTO;
|
|
|
+import com.diagbot.enums.ConEnum;
|
|
|
+import com.diagbot.util.CoreUtil;
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @description: 科室规则
|
|
|
+ * @author: zhoutg
|
|
|
+ * @time: 2023/7/21 14:47
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class DeptRule {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 比较科室
|
|
|
+ *
|
|
|
+ * @param wordCrfDTO
|
|
|
+ * @param ruleBaseDTO
|
|
|
+ * @param ruleSimpleDTO
|
|
|
+ */
|
|
|
+ public Boolean bill(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, RuleSimpleDTO ruleSimpleDTO) {
|
|
|
+ boolean flag = getFlag(wordCrfDTO, ruleBaseDTO);
|
|
|
+ if (flag) {
|
|
|
+ List<String> contentList = Lists.newArrayList();
|
|
|
+ if (!contentList.contains(ruleBaseDTO.getBaseLibName())) {
|
|
|
+ contentList.add(ruleBaseDTO.getBaseLibName());
|
|
|
+ }
|
|
|
+ CoreUtil.setListAndType(ruleSimpleDTO, contentList, ConEnum.dept.getName());
|
|
|
+ }
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 匹配规则——返回状态
|
|
|
+ *
|
|
|
+ * @param wordCrfDTO
|
|
|
+ * @param ruleBaseDTO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public boolean getFlag(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO) {
|
|
|
+ String dept = ruleBaseDTO.getBaseLibName();
|
|
|
+ if (StringUtil.isNotBlank(dept) && wordCrfDTO.getDept() != null) {
|
|
|
+ for (Item item : wordCrfDTO.getDept()) {
|
|
|
+ if (dept.equals(item.getName())) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+}
|