|
@@ -13,10 +13,12 @@ import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.model.entity.AllergyMedicine;
|
|
|
import com.diagbot.model.label.PastLabel;
|
|
|
import com.diagbot.service.impl.KlRegularConfigServiceImpl;
|
|
|
+import com.diagbot.util.EntityUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
import com.diagbot.vo.IndicationPushVO;
|
|
|
-import com.diagbot.vo.RegularConfigDataVO;
|
|
|
import com.diagbot.vo.RegularConfigSaveVO;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
@@ -32,13 +34,11 @@ import java.util.regex.Pattern;
|
|
|
@Component
|
|
|
public class KlRegularConfigFacade extends KlRegularConfigServiceImpl {
|
|
|
|
|
|
- public List<RegularValueDTO> getRegularConfigDatas(RegularConfigDataVO regularConfigDataVO) {
|
|
|
+ public List<RegularValueDTO> getRegularConfigDatas(String text, List<KlRegularConfig> regularConfigs) {
|
|
|
List<RegularValueDTO> listData = new ArrayList<>();
|
|
|
- QueryWrapper<KlRegularConfig> regularQuery = new QueryWrapper<>();
|
|
|
- regularQuery.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .eq(regularConfigDataVO.getRulesCode() != null, "rules_code", regularConfigDataVO.getRulesCode())
|
|
|
- .eq(regularConfigDataVO.getRulesTepy() != null, "rules_tepy", regularConfigDataVO.getRulesTepy());
|
|
|
- List<KlRegularConfig> regularConfigs = list(regularQuery);
|
|
|
+ if (StringUtil.isBlank(text)) {
|
|
|
+ return Lists.newArrayList();
|
|
|
+ }
|
|
|
if (ListUtil.isNotEmpty(regularConfigs)) {
|
|
|
for (KlRegularConfig data : regularConfigs) {
|
|
|
String pattern = "";
|
|
@@ -52,7 +52,7 @@ public class KlRegularConfigFacade extends KlRegularConfigServiceImpl {
|
|
|
// 创建 Pattern 对象
|
|
|
Pattern r = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE);
|
|
|
// 现在创建 matcher 对象
|
|
|
- Matcher m = r.matcher(regularConfigDataVO.getText());
|
|
|
+ Matcher m = r.matcher(text);
|
|
|
int trueMin = 0;
|
|
|
while (m.find()) {
|
|
|
//System.out.println(m.group());
|
|
@@ -77,7 +77,7 @@ public class KlRegularConfigFacade extends KlRegularConfigServiceImpl {
|
|
|
if (data.getRulesTepy().equals(RegularConfigEnum.allergy.getKey())) {
|
|
|
Pattern rMax = Pattern.compile(patternMax, Pattern.CASE_INSENSITIVE);
|
|
|
// 现在创建 matcher 对象
|
|
|
- Matcher mMax = rMax.matcher(regularConfigDataVO.getText());
|
|
|
+ Matcher mMax = rMax.matcher(text);
|
|
|
while (mMax.find()) {
|
|
|
if (data.getRulesTepy().equals(RegularConfigEnum.allergy.getKey())) {
|
|
|
trueMax++;
|
|
@@ -108,9 +108,16 @@ public class KlRegularConfigFacade extends KlRegularConfigServiceImpl {
|
|
|
public WordCrfDTO getRegularConfigs(WordCrfDTO wordCrfDTO, IndicationPushVO indicationPushVO) {
|
|
|
String allergyStr = indicationPushVO.getAllergy();
|
|
|
String symptom = wordCrfDTO.getSymptom();//现病史
|
|
|
- RegularConfigDataVO regularConfigData = new RegularConfigDataVO();
|
|
|
- regularConfigData.setText(symptom);
|
|
|
- List<RegularValueDTO> regularConfigDatas = getRegularConfigDatas(regularConfigData);
|
|
|
+ String pasts = wordCrfDTO.getPasts();//既往史
|
|
|
+ if (StringUtil.isBlank(symptom) && StringUtil.isBlank(pasts)) {
|
|
|
+ return wordCrfDTO;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 现病史化验和过敏史
|
|
|
+ QueryWrapper<KlRegularConfig> regularQuery = new QueryWrapper<>();
|
|
|
+ regularQuery.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
+ List<KlRegularConfig> regularConfigs = list(regularQuery);
|
|
|
+ List<RegularValueDTO> regularConfigDatas = getRegularConfigDatas(symptom, regularConfigs);
|
|
|
List<Lis> lisData = wordCrfDTO.getLis();
|
|
|
PastLabel pastLabel = wordCrfDTO.getPastLabel();//获取过敏史数据
|
|
|
List<AllergyMedicine> allergies = pastLabel.getAllergyMedicines();
|
|
@@ -133,11 +140,10 @@ public class KlRegularConfigFacade extends KlRegularConfigServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- String pasts = wordCrfDTO.getPasts();//既往史
|
|
|
- RegularConfigDataVO regularConfigPasts = new RegularConfigDataVO();
|
|
|
- regularConfigData.setText(pasts);
|
|
|
- regularConfigData.setRulesTepy(RegularConfigEnum.allergy.getKey());
|
|
|
- List<RegularValueDTO> regularConfigPastss = getRegularConfigDatas(regularConfigData);
|
|
|
+
|
|
|
+ // 既往史过敏史
|
|
|
+ List<RegularValueDTO> regularConfigPastss = getRegularConfigDatas(pasts,
|
|
|
+ EntityUtil.makeEntityListMap(regularConfigs, "rulesTepy").get(RegularConfigEnum.allergy.getKey()));
|
|
|
if (ListUtil.isNotEmpty(regularConfigPastss)) {
|
|
|
for (RegularValueDTO dataPasts : regularConfigPastss) {
|
|
|
AllergyMedicine allergy = new AllergyMedicine();
|