|
@@ -2,6 +2,7 @@ package com.diagbot.rule;
|
|
|
|
|
|
import com.diagbot.biz.push.entity.Lis;
|
|
|
import com.diagbot.dto.BillMsg;
|
|
|
+import com.diagbot.dto.LisCtritalDTO;
|
|
|
import com.diagbot.dto.LisOtherDTO;
|
|
|
import com.diagbot.dto.MatchDTO;
|
|
|
import com.diagbot.dto.RuleBaseDTO;
|
|
@@ -35,6 +36,10 @@ public class LisRule {
|
|
|
CommonRule commonRule;
|
|
|
@Autowired
|
|
|
MsgNewUtil msgNewUtil;
|
|
|
+ @Autowired
|
|
|
+ SexRule sexRule;
|
|
|
+ @Autowired
|
|
|
+ AgeRule ageRule;
|
|
|
|
|
|
/**
|
|
|
* 比较化验——开单合理性
|
|
@@ -90,10 +95,11 @@ public class LisRule {
|
|
|
*/
|
|
|
public void otherLis(Lis lisBean, List<RuleBaseDTO> ruleBaseDTOList, List<BillMsg> otherList, WordCrfDTO wordCrfDTO, String msg) {
|
|
|
if (ListUtil.isEmpty(ruleBaseDTOList)) {
|
|
|
- return ;
|
|
|
+ return;
|
|
|
}
|
|
|
LisOtherDTO lisOtherDTO = new LisOtherDTO();
|
|
|
int i = 0;
|
|
|
+ out: // 直接跳出for循环
|
|
|
for (RuleBaseDTO ruleBaseDTO : ruleBaseDTOList) {
|
|
|
if (LexiconEnum.getEnum(ruleBaseDTO.getBaseLibType()) != null) { // 避免空指针
|
|
|
Map<String, Object> map = null;
|
|
@@ -107,7 +113,7 @@ public class LisRule {
|
|
|
lisOtherDTO.setName(matchDTO.getContent());
|
|
|
lisOtherDTO.setLisNameDetail(matchDTO.getLisNameDetail());
|
|
|
} else {
|
|
|
- break;
|
|
|
+ break out;// 直接跳出for循环
|
|
|
}
|
|
|
} else {
|
|
|
// 其他化验——暂无数据
|
|
@@ -117,29 +123,44 @@ public class LisRule {
|
|
|
List<String> msgLis = matchDTOList.stream().map(r -> r.getContent()).collect(Collectors.toList());
|
|
|
lisOtherDTO.setLisMsg(msgLis);
|
|
|
} else {
|
|
|
- break;
|
|
|
+ break out;// 直接跳出for循环
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case Group: // 人群
|
|
|
map = groupRule.rule(wordCrfDTO, ruleBaseDTO);
|
|
|
if (CoreUtil.getMapFlag(map)) {
|
|
|
- lisOtherDTO.getGroupMsg().add((String)map.get("msg"));
|
|
|
+ lisOtherDTO.getGroupMsg().add((String) map.get("msg"));
|
|
|
i++;
|
|
|
+ } else {
|
|
|
+ break out;// 直接跳出for循环
|
|
|
}
|
|
|
break;
|
|
|
case Disease: // 诊断
|
|
|
map = commonRule.compareItem(wordCrfDTO.getDiag(), ruleBaseDTO);
|
|
|
if (CoreUtil.getMapFlag(map)) {
|
|
|
- lisOtherDTO.setDiseaseMsg((List<String>)map.get("msgList"));
|
|
|
+ lisOtherDTO.setDiseaseMsg((List<String>) map.get("msgList"));
|
|
|
i++;
|
|
|
+ } else {
|
|
|
+ break out;// 直接跳出for循环
|
|
|
}
|
|
|
break;
|
|
|
case Medicine: // 药品
|
|
|
map = commonRule.compareItem(wordCrfDTO.getDrugSource(), ruleBaseDTO);
|
|
|
if (CoreUtil.getMapFlag(map)) {
|
|
|
- lisOtherDTO.setDrugMsg((List<String>)map.get("msgList"));
|
|
|
+ lisOtherDTO.setDrugMsg((List<String>) map.get("msgList"));
|
|
|
i++;
|
|
|
+ } else {
|
|
|
+ break out;// 直接跳出for循环
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case Gender: // 性别
|
|
|
+ boolean flag = sexRule.getFlag(wordCrfDTO, ruleBaseDTO);
|
|
|
+ if (flag) {
|
|
|
+ lisOtherDTO.setSexMsg(ruleBaseDTO.getBaseLibName());
|
|
|
+ i++;
|
|
|
+ } else {
|
|
|
+ break out;// 直接跳出for循环
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
@@ -189,6 +210,12 @@ public class LisRule {
|
|
|
CoreUtil.addBeanToList(otherList, billMsg);
|
|
|
}
|
|
|
}
|
|
|
+ // 性别
|
|
|
+ if (StringUtil.isNotBlank(lisOtherDTO.getSexMsg())) {
|
|
|
+ BillMsg billMsg = msgNewUtil.getCommonOtherMsg(TypeEnum.lis.getName(), lisOtherDTO.getName(),
|
|
|
+ lisOtherDTO.getSexMsg(), TypeEnum.gender.getName(), lisBean, msg, lisNameDetail);
|
|
|
+ CoreUtil.addBeanToList(otherList, billMsg);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -204,7 +231,7 @@ public class LisRule {
|
|
|
*/
|
|
|
public void otherTransfusion(Lis lisBean, List<RuleBaseDTO> ruleBaseDTOList, String msg, List<BillMsg> otherList, WordCrfDTO wordCrfDTO) {
|
|
|
if (ListUtil.isEmpty(ruleBaseDTOList)) {
|
|
|
- return ;
|
|
|
+ return;
|
|
|
}
|
|
|
LisOtherDTO lisOtherDTO = new LisOtherDTO();
|
|
|
lisOtherDTO.setMsg(msg);
|
|
@@ -239,20 +266,20 @@ public class LisRule {
|
|
|
case Disease: // 诊断
|
|
|
map = commonRule.compareItem(wordCrfDTO.getDiag(), ruleBaseDTO);
|
|
|
if (CoreUtil.getMapFlag(map)) {
|
|
|
- lisOtherDTO.setDiseaseMsg((List<String>)map.get("msgList"));
|
|
|
+ lisOtherDTO.setDiseaseMsg((List<String>) map.get("msgList"));
|
|
|
i++;
|
|
|
}
|
|
|
break;
|
|
|
case Medicine: // 药品
|
|
|
map = commonRule.compareItem(wordCrfDTO.getDrugSource(), ruleBaseDTO);
|
|
|
if (CoreUtil.getMapFlag(map)) {
|
|
|
- lisOtherDTO.setDrugMsg((List<String>)map.get("msgList"));
|
|
|
+ lisOtherDTO.setDrugMsg((List<String>) map.get("msgList"));
|
|
|
i++;
|
|
|
}
|
|
|
case Operation: // 手术
|
|
|
map = commonRule.compareItem(wordCrfDTO.getOperation(), ruleBaseDTO);
|
|
|
if (CoreUtil.getMapFlag(map)) {
|
|
|
- lisOtherDTO.setOperationMsg((List<String>)map.get("msgList"));
|
|
|
+ lisOtherDTO.setOperationMsg((List<String>) map.get("msgList"));
|
|
|
i++;
|
|
|
}
|
|
|
break;
|
|
@@ -316,12 +343,14 @@ public class LisRule {
|
|
|
* @param ruleBaseDTOList
|
|
|
* @param criticalList
|
|
|
*/
|
|
|
- public void critical(Lis lisBean, List<RuleBaseDTO> ruleBaseDTOList, List<BillMsg> criticalList, WordCrfDTO wordCrfDTO) {
|
|
|
+ public void critical(Lis lisBean, List<RuleBaseDTO> ruleBaseDTOList, List<BillMsg> criticalList, WordCrfDTO wordCrfDTO, String msg) {
|
|
|
if (ListUtil.isEmpty(ruleBaseDTOList)) {
|
|
|
- return ;
|
|
|
+ return;
|
|
|
}
|
|
|
- String msg = "";
|
|
|
+
|
|
|
+ LisCtritalDTO lisCtritalDTO = new LisCtritalDTO();
|
|
|
int i = 0;
|
|
|
+ out: // 直接跳出for循环
|
|
|
for (RuleBaseDTO ruleBaseDTO : ruleBaseDTOList) {
|
|
|
if (LexiconEnum.getEnum(ruleBaseDTO.getBaseLibType()) != null) { // 避免空指针
|
|
|
Map map = null;
|
|
@@ -332,9 +361,9 @@ public class LisRule {
|
|
|
MatchDTO matchDTO = CoreUtil.compareLis(ruleBaseDTO, lisBean);
|
|
|
if (matchDTO != null) {
|
|
|
i++;
|
|
|
- msg = matchDTO.getContent();
|
|
|
+ lisCtritalDTO.setName(matchDTO.getContent());
|
|
|
} else {
|
|
|
- break;
|
|
|
+ break out;// 直接跳出for循环
|
|
|
}
|
|
|
} else {
|
|
|
// 其他化验
|
|
@@ -342,7 +371,7 @@ public class LisRule {
|
|
|
if (ListUtil.isNotEmpty(matchDTOList)) {
|
|
|
i++;
|
|
|
} else {
|
|
|
- break;
|
|
|
+ break out;// 直接跳出for循环
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
@@ -350,15 +379,55 @@ public class LisRule {
|
|
|
map = groupRule.rule(wordCrfDTO, ruleBaseDTO);
|
|
|
if (CoreUtil.getMapFlag(map)) {
|
|
|
i++;
|
|
|
+ lisCtritalDTO.setGroupMsg(ruleBaseDTO.getBaseLibName());
|
|
|
+ } else {
|
|
|
+ break out;// 直接跳出for循环
|
|
|
}
|
|
|
break;
|
|
|
- default: break;
|
|
|
+ case Age: // 年龄
|
|
|
+ boolean flag = ageRule.getFlag(wordCrfDTO, ruleBaseDTO);
|
|
|
+ if (flag) {
|
|
|
+ i++;
|
|
|
+ lisCtritalDTO.setAgeMsg(wordCrfDTO.getAge());
|
|
|
+ } else {
|
|
|
+ break out;// 直接跳出for循环
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (i == ruleBaseDTOList.size()) {
|
|
|
- BillMsg criticalMsg = MsgUtil.getCommonCriticalMsg(msg, TypeEnum.lis.getName());
|
|
|
- criticalList.add(criticalMsg);
|
|
|
+ if (StringUtil.isNotBlank(lisCtritalDTO.getName())) {
|
|
|
+ // 就化验本身一个条件符合
|
|
|
+ if (i == 1) {
|
|
|
+ BillMsg billMsg = msgNewUtil.getCriticalMsg(TypeEnum.lis.getName(),
|
|
|
+ lisCtritalDTO.getName(), "", TypeEnum.lisSelf.getName(), msg);
|
|
|
+ CoreUtil.addBeanToList(criticalList, billMsg);
|
|
|
+ } else { // 有其他条件符合
|
|
|
+ // 化验——暂无数据
|
|
|
+ if (ListUtil.isNotEmpty(lisCtritalDTO.getLisMsg())) {
|
|
|
+ for (String str : lisCtritalDTO.getLisMsg()) {
|
|
|
+ BillMsg billMsg = msgNewUtil.getCriticalMsg(TypeEnum.lis.getName(), lisCtritalDTO.getName(),
|
|
|
+ str, TypeEnum.lis.getName(), msg);
|
|
|
+ CoreUtil.addBeanToList(criticalList, billMsg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 人群
|
|
|
+ if (StringUtil.isNotBlank(lisCtritalDTO.getGroupMsg())) {
|
|
|
+ BillMsg billMsg = msgNewUtil.getCriticalMsg(TypeEnum.lis.getName(), lisCtritalDTO.getName(),
|
|
|
+ lisCtritalDTO.getGroupMsg(), TypeEnum.group.getName(), msg);
|
|
|
+ CoreUtil.addBeanToList(criticalList, billMsg);
|
|
|
+ }
|
|
|
+ // 年龄
|
|
|
+ if (StringUtil.isNotBlank(lisCtritalDTO.getAgeMsg())) {
|
|
|
+ BillMsg billMsg = msgNewUtil.getCriticalMsg(TypeEnum.lis.getName(), lisCtritalDTO.getName(),
|
|
|
+ lisCtritalDTO.getAgeMsg(), TypeEnum.age.getName(), msg);
|
|
|
+ CoreUtil.addBeanToList(criticalList, billMsg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|