|
@@ -4,7 +4,12 @@ import com.diagbot.biz.push.entity.Item;
|
|
|
import com.diagbot.biz.push.entity.Lis;
|
|
|
import com.diagbot.client.CRFServiceClient;
|
|
|
import com.diagbot.client.StandConvertServiceClient;
|
|
|
-import com.diagbot.dto.*;
|
|
|
+import com.diagbot.dto.BillMsg;
|
|
|
+import com.diagbot.dto.RuleDTO;
|
|
|
+import com.diagbot.dto.RuleExtDTO;
|
|
|
+import com.diagbot.dto.StandConvertCrfBatchDTO;
|
|
|
+import com.diagbot.dto.StandConvertCrfDTO;
|
|
|
+import com.diagbot.dto.WordCrfDTO;
|
|
|
import com.diagbot.enums.ConceptTypeEnum;
|
|
|
import com.diagbot.enums.LexiconEnum;
|
|
|
import com.diagbot.enums.RedisEnum;
|
|
@@ -12,15 +17,39 @@ import com.diagbot.enums.StandConvertEnum;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.model.ai.AIAnalyze;
|
|
|
+import com.diagbot.model.entity.BodyPart;
|
|
|
+import com.diagbot.model.entity.Clinical;
|
|
|
+import com.diagbot.model.entity.Modification;
|
|
|
import com.diagbot.model.entity.Operation;
|
|
|
-import com.diagbot.model.entity.*;
|
|
|
-import com.diagbot.model.label.*;
|
|
|
+import com.diagbot.model.entity.Pacs;
|
|
|
+import com.diagbot.model.entity.Vital;
|
|
|
+import com.diagbot.model.label.ChiefLabel;
|
|
|
+import com.diagbot.model.label.DiagLabel;
|
|
|
+import com.diagbot.model.label.PacsLabel;
|
|
|
+import com.diagbot.model.label.PastLabel;
|
|
|
+import com.diagbot.model.label.PresentLabel;
|
|
|
+import com.diagbot.model.label.VitalLabel;
|
|
|
import com.diagbot.rule.CommonRule;
|
|
|
-import com.diagbot.util.*;
|
|
|
-import com.diagbot.vo.*;
|
|
|
+import com.diagbot.util.AgeUtil;
|
|
|
+import com.diagbot.util.BeanUtil;
|
|
|
+import com.diagbot.util.CoreUtil;
|
|
|
+import com.diagbot.util.ListUtil;
|
|
|
+import com.diagbot.util.RedisUtil;
|
|
|
+import com.diagbot.util.ReflectUtil;
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
+import com.diagbot.vo.NeoPushVO;
|
|
|
+import com.diagbot.vo.RuleVO;
|
|
|
+import com.diagbot.vo.SearchData;
|
|
|
+import com.diagbot.vo.StandConvert;
|
|
|
+import com.diagbot.vo.StandConvertCrfVO;
|
|
|
+import com.diagbot.vo.neoPushEntity.ChiefPushVo;
|
|
|
import com.diagbot.vo.neoPushEntity.Diag;
|
|
|
+import com.diagbot.vo.neoPushEntity.DiagVo;
|
|
|
import com.diagbot.vo.neoPushEntity.Drug;
|
|
|
-import com.diagbot.vo.neoPushEntity.*;
|
|
|
+import com.diagbot.vo.neoPushEntity.LisPushVo;
|
|
|
+import com.diagbot.vo.neoPushEntity.PacsPushVo;
|
|
|
+import com.diagbot.vo.neoPushEntity.PresentPushVo;
|
|
|
+import com.diagbot.vo.neoPushEntity.Symptom;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import org.apache.commons.beanutils.BeanUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -30,7 +59,11 @@ import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.lang.reflect.Method;
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.util.*;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Iterator;
|
|
|
+import java.util.LinkedHashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -88,7 +121,7 @@ public class CommonFacade {
|
|
|
if (searchData.getAgeNum() != null) {
|
|
|
wordCrfDTO.setAgeNum(searchData.getAgeNum());
|
|
|
} else {
|
|
|
- wordCrfDTO.setAgeNum(CoreUtil.convertAge(searchData.getAge()));
|
|
|
+ wordCrfDTO.setAgeNum(AgeUtil.convertAge(searchData.getAge()));
|
|
|
}
|
|
|
wordCrfDTO.setAge(searchData.getAge());
|
|
|
wordCrfDTO.setSex(searchData.getSex());
|
|
@@ -162,6 +195,12 @@ public class CommonFacade {
|
|
|
if (StringUtil.isNotBlank(searchData.getVital())) {
|
|
|
wordCrfDTO.setVital(searchData.getVital());
|
|
|
}
|
|
|
+ if (ListUtil.isNotEmpty(searchData.getOtherAdvice())) {
|
|
|
+ wordCrfDTO.setOtherAdvice(searchData.getOtherAdvice());
|
|
|
+ }
|
|
|
+ if (ListUtil.isNotEmpty(searchData.getScale())) {
|
|
|
+ wordCrfDTO.setScale(searchData.getScale());
|
|
|
+ }
|
|
|
|
|
|
// 模型处理数据
|
|
|
aiAnalyze.aiProcess(searchData, wordCrfDTO);
|
|
@@ -406,8 +445,8 @@ public class CommonFacade {
|
|
|
// // 3、开单辅检项目
|
|
|
// CoreUtil.setPropertyList(wordCrfDTO.getPacsOrder(), "name", "uniqueName", map.get(StandConvertEnum.pacs.toString()));
|
|
|
|
|
|
-// CoreUtil.setUninameFromDetail(wordCrfDTO.getLis(), "detailName");
|
|
|
-// CoreUtil.setUninameFromDetail(wordCrfDTO.getLisOrder(), "name");
|
|
|
+ // CoreUtil.setUninameFromDetail(wordCrfDTO.getLis(), "detailName");
|
|
|
+ // CoreUtil.setUninameFromDetail(wordCrfDTO.getLisOrder(), "name");
|
|
|
lisGetAndSet(wordCrfDTO);
|
|
|
pacsGetAndSet(wordCrfDTO);
|
|
|
|
|
@@ -439,7 +478,7 @@ public class CommonFacade {
|
|
|
* 类型,疾病: disease,症状: symptom,手术和操作:operation,药品: drug,实验室检查:lis,辅助检查:pacs, 辅助检查:vital"
|
|
|
*
|
|
|
* @param standConvert
|
|
|
- * @return Map<String,Map<String,String>> -->Map<类型, Map<原始词, 标准词>>
|
|
|
+ * @return Map<String , Map < String , String>> -->Map<类型, Map<原始词, 标准词>>
|
|
|
*/
|
|
|
public Map<String, Map<String, String>> standConvertCrf(StandConvert standConvert) {
|
|
|
Map<String, Map<String, String>> map = new LinkedHashMap<>();
|
|
@@ -664,25 +703,25 @@ public class CommonFacade {
|
|
|
.distinct()
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
-// Map<String, Map<String, Long>> configMap = new LinkedHashMap<>();
|
|
|
+ // Map<String, Map<String, Long>> configMap = new LinkedHashMap<>();
|
|
|
if (ListUtil.isNotEmpty(operationList)) {
|
|
|
-// configMap = tranOperationConfigFacade.getConfigMap(wordCrfDTO.getHospitalId(), operationList, null);
|
|
|
+ // configMap = tranOperationConfigFacade.getConfigMap(wordCrfDTO.getHospitalId(), operationList, null);
|
|
|
Map<String, Map<String, Map<String, List<String>>>> operstionMap = mappingConfigFacade.groupByHisNameWithName(operationList, ConceptTypeEnum.Operation.getKey(), wordCrfDTO.getHospitalId());
|
|
|
// 1、主诉手术
|
|
|
-// setListProperty(wordCrfDTO.getChiefLabel(), "operations", "standName", configMap);
|
|
|
- setListProperty(wordCrfDTO.getChiefLabel(), "operations", ConceptTypeEnum.Operation.getKey(),"StandName",operstionMap);
|
|
|
+ // setListProperty(wordCrfDTO.getChiefLabel(), "operations", "standName", configMap);
|
|
|
+ setListProperty(wordCrfDTO.getChiefLabel(), "operations", ConceptTypeEnum.Operation.getKey(), "StandName", operstionMap);
|
|
|
// 2、现病史手术
|
|
|
-// setListProperty(wordCrfDTO.getPresentLabel(), "operations", "standName", configMap);
|
|
|
- setListProperty(wordCrfDTO.getPresentLabel(),"operations", ConceptTypeEnum.Operation.getKey(),"StandName",operstionMap);
|
|
|
+ // setListProperty(wordCrfDTO.getPresentLabel(), "operations", "standName", configMap);
|
|
|
+ setListProperty(wordCrfDTO.getPresentLabel(), "operations", ConceptTypeEnum.Operation.getKey(), "StandName", operstionMap);
|
|
|
// 3、既往史手术
|
|
|
-// setListProperty(wordCrfDTO.getPastLabel(), "operations", "standName", configMap);
|
|
|
- setListProperty(wordCrfDTO.getPastLabel(),"operations", ConceptTypeEnum.Operation.getKey(),"StandName",operstionMap);
|
|
|
+ // setListProperty(wordCrfDTO.getPastLabel(), "operations", "standName", configMap);
|
|
|
+ setListProperty(wordCrfDTO.getPastLabel(), "operations", ConceptTypeEnum.Operation.getKey(), "StandName", operstionMap);
|
|
|
// 4、结构化手术
|
|
|
-// setListProperty(wordCrfDTO, "operation", "uniqueName", configMap);
|
|
|
- setListProperty(wordCrfDTO, "operation", ConceptTypeEnum.Operation.getKey(),"UniqueName",operstionMap);
|
|
|
+ // setListProperty(wordCrfDTO, "operation", "uniqueName", configMap);
|
|
|
+ setListProperty(wordCrfDTO, "operation", ConceptTypeEnum.Operation.getKey(), "UniqueName", operstionMap);
|
|
|
// 5、手术
|
|
|
-// setListProperty(wordCrfDTO, "operationOrder", "uniqueName", configMap);
|
|
|
- setListProperty(wordCrfDTO, "operationOrder", ConceptTypeEnum.Operation.getKey(),"UniqueName",operstionMap);
|
|
|
+ // setListProperty(wordCrfDTO, "operationOrder", "uniqueName", configMap);
|
|
|
+ setListProperty(wordCrfDTO, "operationOrder", ConceptTypeEnum.Operation.getKey(), "UniqueName", operstionMap);
|
|
|
// 6、选中手术
|
|
|
if (wordCrfDTO.getOperationName() != null &&
|
|
|
StringUtil.isNotBlank(wordCrfDTO.getOperationName().getName()) &&
|
|
@@ -702,10 +741,10 @@ public class CommonFacade {
|
|
|
List<String> pacsList = new ArrayList<>();
|
|
|
// 1、结构化
|
|
|
CoreUtil.addList(pacsList, CoreUtil.filterUniqueList(wordCrfDTO.getPacs()));
|
|
|
-// // 2、开单
|
|
|
+ // // 2、开单
|
|
|
CoreUtil.addList(pacsList, CoreUtil.filterUniqueList(wordCrfDTO.getPacsOrder()));
|
|
|
PacsLabel pacsLabel = wordCrfDTO.getPacsLabel();
|
|
|
- if(pacsLabel != null){
|
|
|
+ if (pacsLabel != null) {
|
|
|
pacsList = pacsLabel.getItem().stream()
|
|
|
.map(x -> x.getName())
|
|
|
.collect(Collectors.toList());
|
|
@@ -713,9 +752,9 @@ public class CommonFacade {
|
|
|
|
|
|
if (ListUtil.isNotEmpty(pacsList)) {
|
|
|
Map<String, Map<String, Map<String, List<String>>>> pacsMap = mappingConfigFacade.groupByHisNameWithName(pacsList, ConceptTypeEnum.Pacs.getKey(), wordCrfDTO.getHospitalId());
|
|
|
- setListProperty(wordCrfDTO, "pacs", ConceptTypeEnum.Pacs.getKey(),"UniqueName",pacsMap);
|
|
|
- setListProperty(wordCrfDTO, "pacsOrder", ConceptTypeEnum.Pacs.getKey(),"UniqueName",pacsMap);
|
|
|
- setListProperty(pacsLabel, "item", ConceptTypeEnum.Pacs.getKey(),"UniqueName",pacsMap);
|
|
|
+ setListProperty(wordCrfDTO, "pacs", ConceptTypeEnum.Pacs.getKey(), "UniqueName", pacsMap);
|
|
|
+ setListProperty(wordCrfDTO, "pacsOrder", ConceptTypeEnum.Pacs.getKey(), "UniqueName", pacsMap);
|
|
|
+ setListProperty(pacsLabel, "item", ConceptTypeEnum.Pacs.getKey(), "UniqueName", pacsMap);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -729,7 +768,7 @@ public class CommonFacade {
|
|
|
List<String> lisHisNameList = Lists.newArrayList();
|
|
|
// 【所有化验】
|
|
|
List<Lis> lisList = wordCrfDTO.getLis();
|
|
|
- if(ListUtil.isNotEmpty(lisList)){
|
|
|
+ if (ListUtil.isNotEmpty(lisList)) {
|
|
|
lisHisNameList.addAll(lisList
|
|
|
.stream()
|
|
|
.filter(i -> StringUtil.isNotBlank(i.getName()) || StringUtil.isNotBlank(i.getUniqueName()))
|
|
@@ -742,7 +781,8 @@ public class CommonFacade {
|
|
|
.collect(Collectors.toList());
|
|
|
if (ListUtil.isNotEmpty(lisHisNameList)) {
|
|
|
Map<String, Map<String, Map<String, List<String>>>> lisConfigMap = mappingConfigFacade.groupByHisNameWithName(lisHisNameList, ConceptTypeEnum.LisPack.getKey(), wordCrfDTO.getHospitalId());
|
|
|
- setListProperty(wordCrfDTO, "lis", ConceptTypeEnum.LisPack.getKey(),"UniqueName",lisConfigMap);
|
|
|
+ setListProperty(wordCrfDTO, "lis", ConceptTypeEnum.LisPack.getKey(), "UniqueName", lisConfigMap);
|
|
|
+ setListProperty(wordCrfDTO, "lisOrder", ConceptTypeEnum.LisPack.getKey(), "UniqueName", lisConfigMap);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -761,9 +801,9 @@ public class CommonFacade {
|
|
|
ReflectUtil.setProperty(obj, listProperty, newList);
|
|
|
}
|
|
|
|
|
|
- public <T> void setListProperty(Object obj, String listProperty,Integer type,String propertyName, Map<String, Map<String, Map<String, List<String>>>> configMap) {
|
|
|
+ public <T> void setListProperty(Object obj, String listProperty, Integer type, String propertyName, Map<String, Map<String, Map<String, List<String>>>> configMap) {
|
|
|
Object tList = CoreUtil.getFieldValue(obj, listProperty);
|
|
|
- List<T> newList = convertStandName((List) tList,type, propertyName,configMap);
|
|
|
+ List<T> newList = convertStandName((List) tList, type, propertyName, configMap);
|
|
|
ReflectUtil.setProperty(obj, listProperty, newList);
|
|
|
}
|
|
|
|
|
@@ -825,7 +865,7 @@ public class CommonFacade {
|
|
|
* @param <T>
|
|
|
* @return
|
|
|
*/
|
|
|
- public <T> List<T> convertStandName(List<T> list,Integer type,String propertyName, Map<String, Map<String, Map<String, List<String>>>> configMap) {
|
|
|
+ public <T> List<T> convertStandName(List<T> list, Integer type, String propertyName, Map<String, Map<String, Map<String, List<String>>>> configMap) {
|
|
|
List<T> retList = new ArrayList<>();
|
|
|
if (ListUtil.isEmpty(list)) {
|
|
|
return list;
|
|
@@ -839,7 +879,7 @@ public class CommonFacade {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
-// String uniqueName = item.getClass().getMethod("getUniqueName").invoke(item).toString();
|
|
|
+ // String uniqueName = item.getClass().getMethod("getUniqueName").invoke(item).toString();
|
|
|
|
|
|
String uniqueName = ReflectUtil.getProperty(item, "uniqueName");
|
|
|
if (StringUtil.isNotBlank(uniqueName) && !"StandName".equals(propertyName)) {
|
|
@@ -848,7 +888,7 @@ public class CommonFacade {
|
|
|
}
|
|
|
|
|
|
String hisDetailName = "";
|
|
|
- if(type.equals(ConceptTypeEnum.LisPack.getKey())) {
|
|
|
+ if (type.equals(ConceptTypeEnum.LisPack.getKey())) {
|
|
|
hisDetailName = ReflectUtil.getProperty(item, "detailName");
|
|
|
if (StringUtil.isBlank(hisDetailName)) {
|
|
|
hisDetailName = "";
|
|
@@ -864,7 +904,7 @@ public class CommonFacade {
|
|
|
for (String form : thirdEntry.getValue()) {
|
|
|
T o = (T) item.getClass().newInstance();
|
|
|
BeanUtil.copyProperties(item, o);
|
|
|
- Method setUniqueName = o.getClass().getMethod("set"+propertyName, String.class);
|
|
|
+ Method setUniqueName = o.getClass().getMethod("set" + propertyName, String.class);
|
|
|
setUniqueName.invoke(o, thirdEntry.getKey());
|
|
|
Method setForm = o.getClass().getMethod("setForm", String.class);
|
|
|
setForm.invoke(o, form);
|
|
@@ -873,29 +913,27 @@ public class CommonFacade {
|
|
|
} else {
|
|
|
T o = (T) item.getClass().newInstance();
|
|
|
BeanUtil.copyProperties(item, o);
|
|
|
- Method setUniqueName = o.getClass().getMethod("set"+propertyName, String.class);
|
|
|
+ Method setUniqueName = o.getClass().getMethod("set" + propertyName, String.class);
|
|
|
setUniqueName.invoke(o, thirdEntry.getKey());
|
|
|
retList.add(o);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
} else {
|
|
|
List<String> standNames = new ArrayList<>(subMap.get(hisDetailName).keySet());
|
|
|
for (String stdName : standNames) {
|
|
|
T o = (T) item.getClass().newInstance();
|
|
|
BeanUtil.copyProperties(item, o);
|
|
|
- Method setUniqueName = o.getClass().getMethod("set"+propertyName, String.class);
|
|
|
+ Method setUniqueName = o.getClass().getMethod("set" + propertyName, String.class);
|
|
|
setUniqueName.invoke(o, stdName);
|
|
|
retList.add(o);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
+ setUniqueNameNoMapping(item, propertyName, name, hisDetailName);
|
|
|
retList.add(item);
|
|
|
}
|
|
|
} else {
|
|
|
- if (propertyName.equals("UniqueName")) {
|
|
|
- BeanUtils.copyProperty(item, "uniqueName", name);
|
|
|
- }
|
|
|
+ setUniqueNameNoMapping(item, propertyName, name, hisDetailName);
|
|
|
retList.add(item);
|
|
|
}
|
|
|
}
|
|
@@ -905,6 +943,28 @@ public class CommonFacade {
|
|
|
return retList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 映射没找到,如果有细项,就用细项;无细项用套餐
|
|
|
+ *
|
|
|
+ * @param item
|
|
|
+ * @param propertyName
|
|
|
+ * @param name
|
|
|
+ * @param detailName
|
|
|
+ */
|
|
|
+ public <T> void setUniqueNameNoMapping(T item, String propertyName, String name, String detailName) {
|
|
|
+ try {
|
|
|
+ if (propertyName.equals("UniqueName")) {
|
|
|
+ if (StringUtil.isNotBlank(detailName)) {
|
|
|
+ BeanUtils.copyProperty(item, "uniqueName", detailName);
|
|
|
+ } else {
|
|
|
+ BeanUtils.copyProperty(item, "uniqueName", name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 生成给图谱的入参(推送)
|
|
|
*/
|
|
@@ -1082,11 +1142,11 @@ public class CommonFacade {
|
|
|
getPacsStruct(pacsLabel, wordCrfDTO.getPresentLabel().getPacsLabel());
|
|
|
//结构化pacs
|
|
|
List<com.diagbot.biz.push.entity.Pacs> pacs = wordCrfDTO.getPacs();
|
|
|
- if(ListUtil.isNotEmpty(pacs)){
|
|
|
- pacs.forEach(p ->{
|
|
|
+ if (ListUtil.isNotEmpty(pacs)) {
|
|
|
+ pacs.forEach(p -> {
|
|
|
Item item = new Item();
|
|
|
- item.setName(p.getName()==null?"":p.getName());
|
|
|
- item.setUniqueName(p.getUniqueName()==null?"":p.getUniqueName());
|
|
|
+ item.setName(p.getName() == null ? "" : p.getName());
|
|
|
+ item.setUniqueName(p.getUniqueName() == null ? "" : p.getUniqueName());
|
|
|
pacsLabel.getItem().add(item);
|
|
|
});
|
|
|
}
|
|
@@ -1122,8 +1182,8 @@ public class CommonFacade {
|
|
|
if (ListUtil.isNotEmpty(res.getDisease())) {
|
|
|
for (Pacs pacs : res.getDisease()) {
|
|
|
Item item = new Item();
|
|
|
- item.setName(pacs.getName()==null?"":pacs.getName());
|
|
|
- item.setUniqueName(pacs.getStandName()==null?"":pacs.getStandName());
|
|
|
+ item.setName(pacs.getName() == null ? "" : pacs.getName());
|
|
|
+ item.setUniqueName(pacs.getStandName() == null ? "" : pacs.getStandName());
|
|
|
pacsResList.add(item);
|
|
|
}
|
|
|
}
|
|
@@ -1163,18 +1223,17 @@ public class CommonFacade {
|
|
|
*
|
|
|
* @param lises
|
|
|
* @param lisList
|
|
|
- *
|
|
|
*/
|
|
|
public void getLisStruct(List<com.diagbot.model.entity.Lis> lises, List<Lis> lisList) {
|
|
|
if (ListUtil.isNotEmpty(lises)) {
|
|
|
- lises.stream().forEach(x -> {
|
|
|
- String bigName = x.getBigItem().getName();//大项名
|
|
|
- String detailName = x.getName();//小项名
|
|
|
- String value = x.getPd().getValue();
|
|
|
- String unit = x.getPd().getUnit();
|
|
|
- String standName = x.getStandName();
|
|
|
- lisList.add(getLis(bigName,detailName,value,unit,standName));
|
|
|
- });
|
|
|
+ lises.stream().forEach(x -> {
|
|
|
+ String bigName = x.getBigItem().getName();//大项名
|
|
|
+ String detailName = x.getName();//小项名
|
|
|
+ String value = x.getPd().getValue();
|
|
|
+ String unit = x.getPd().getUnit();
|
|
|
+ String standName = x.getStandName();
|
|
|
+ lisList.add(getLis(bigName, detailName, value, unit, standName));
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
|