|
@@ -42,12 +42,14 @@ 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;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
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;
|
|
@@ -66,6 +68,8 @@ public class CommonFacade {
|
|
|
@Autowired
|
|
|
PacsConfigFacade pacsConfigFacade;
|
|
|
@Autowired
|
|
|
+ TranOperationConfigFacade tranOperationConfigFacade;
|
|
|
+ @Autowired
|
|
|
CommonRule commonRule;
|
|
|
@Autowired
|
|
|
RedisUtil redisUtil;
|
|
@@ -206,23 +210,23 @@ public class CommonFacade {
|
|
|
}
|
|
|
standConvert.setDiaglList(diagList);
|
|
|
|
|
|
- // 【所有化验】
|
|
|
- List<String> allLis = new ArrayList<>();
|
|
|
- // 1、普通化验——取明细
|
|
|
- CoreUtil.addList(allLis, CoreUtil.filterUniqueList(wordCrfDTO.getLis(), "detailName"));
|
|
|
- // 2、开单化验——取套餐
|
|
|
- CoreUtil.addList(allLis, CoreUtil.filterUniqueList(wordCrfDTO.getLisOrder()));
|
|
|
- standConvert.setLisList(allLis);
|
|
|
-
|
|
|
- // 【所有辅助项目】
|
|
|
- List<String> allPacs = new ArrayList<>();
|
|
|
- // 1、模型解析辅检项目
|
|
|
- CoreUtil.addList(allPacs, CoreUtil.filterUniqueList(wordCrfDTO.getPacsLabel().getItem()));
|
|
|
- // 2、结构化辅检项目
|
|
|
- CoreUtil.addList(allPacs, CoreUtil.filterUniqueList(wordCrfDTO.getPacs()));
|
|
|
- // 3、开单辅检项目
|
|
|
- CoreUtil.addList(allPacs, CoreUtil.filterUniqueList(wordCrfDTO.getPacsOrder()));
|
|
|
- standConvert.setPacsList(allPacs);
|
|
|
+ // // 【所有化验】
|
|
|
+ // List<String> allLis = new ArrayList<>();
|
|
|
+ // // 1、普通化验——取明细
|
|
|
+ // CoreUtil.addList(allLis, CoreUtil.filterUniqueList(wordCrfDTO.getLis(), "detailName"));
|
|
|
+ // // 2、开单化验——取套餐
|
|
|
+ // CoreUtil.addList(allLis, CoreUtil.filterUniqueList(wordCrfDTO.getLisOrder()));
|
|
|
+ // standConvert.setLisList(allLis);
|
|
|
+ //
|
|
|
+ // // 【所有辅助项目】
|
|
|
+ // List<String> allPacs = new ArrayList<>();
|
|
|
+ // // 1、模型解析辅检项目
|
|
|
+ // CoreUtil.addList(allPacs, CoreUtil.filterUniqueList(wordCrfDTO.getPacsLabel().getItem()));
|
|
|
+ // // 2、结构化辅检项目
|
|
|
+ // CoreUtil.addList(allPacs, CoreUtil.filterUniqueList(wordCrfDTO.getPacs()));
|
|
|
+ // // 3、开单辅检项目
|
|
|
+ // CoreUtil.addList(allPacs, CoreUtil.filterUniqueList(wordCrfDTO.getPacsOrder()));
|
|
|
+ // standConvert.setPacsList(allPacs);
|
|
|
|
|
|
// 【所有药品】
|
|
|
List<String> drugList = new ArrayList<>();
|
|
@@ -240,23 +244,23 @@ public class CommonFacade {
|
|
|
CoreUtil.addList(drugList, CoreUtil.filterUniqueList(wordCrfDTO.getDrug()));
|
|
|
standConvert.setDrugList(drugList);
|
|
|
|
|
|
- // 【所有手术】
|
|
|
- List<String> operationList = new ArrayList<>();
|
|
|
- // 1、主诉手术
|
|
|
- CoreUtil.addList(operationList, CoreUtil.getPropertyList(chiefLabel.getOperations()));
|
|
|
- // 2、现病史手术
|
|
|
- CoreUtil.addList(operationList, CoreUtil.getPropertyList(presentLabel.getOperations()));
|
|
|
- // 3、既往史手术
|
|
|
- CoreUtil.addList(operationList, CoreUtil.getPropertyList(pastLabel.getOperations()));
|
|
|
- // 4、开单手术
|
|
|
- CoreUtil.addList(operationList, CoreUtil.filterUniqueList(wordCrfDTO.getOperationOrder()));
|
|
|
- // 5、结构化手术
|
|
|
- CoreUtil.addList(operationList, CoreUtil.filterUniqueList(wordCrfDTO.getOperation()));
|
|
|
- // 6、选中手术
|
|
|
- if (wordCrfDTO.getOperationName() != null && StringUtils.isBlank(wordCrfDTO.getOperationName().getUniqueName())) {
|
|
|
- operationList.add(wordCrfDTO.getOperationName().getName());
|
|
|
- }
|
|
|
- standConvert.setOperationList(operationList);
|
|
|
+ // // 【所有手术】
|
|
|
+ // List<String> operationList = new ArrayList<>();
|
|
|
+ // // 1、主诉手术
|
|
|
+ // CoreUtil.addList(operationList, CoreUtil.getPropertyList(chiefLabel.getOperations()));
|
|
|
+ // // 2、现病史手术
|
|
|
+ // CoreUtil.addList(operationList, CoreUtil.getPropertyList(presentLabel.getOperations()));
|
|
|
+ // // 3、既往史手术
|
|
|
+ // CoreUtil.addList(operationList, CoreUtil.getPropertyList(pastLabel.getOperations()));
|
|
|
+ // // 4、开单手术
|
|
|
+ // CoreUtil.addList(operationList, CoreUtil.filterUniqueList(wordCrfDTO.getOperationOrder()));
|
|
|
+ // // 5、结构化手术
|
|
|
+ // CoreUtil.addList(operationList, CoreUtil.filterUniqueList(wordCrfDTO.getOperation()));
|
|
|
+ // // 6、选中手术
|
|
|
+ // if (wordCrfDTO.getOperationName() != null && StringUtils.isBlank(wordCrfDTO.getOperationName().getUniqueName())) {
|
|
|
+ // operationList.add(wordCrfDTO.getOperationName().getName());
|
|
|
+ // }
|
|
|
+ // standConvert.setOperationList(operationList);
|
|
|
|
|
|
// 【所有体征】(临床表现、体征结果)
|
|
|
List<String> vitalList = new ArrayList<>();
|
|
@@ -337,20 +341,133 @@ public class CommonFacade {
|
|
|
|
|
|
// 【手术回填】
|
|
|
// 1、主诉手术
|
|
|
- CoreUtil.setPropertyList(chiefLabel.getOperations(), map.get(StandConvertEnum.operation.toString()));
|
|
|
+ // CoreUtil.setPropertyList(chiefLabel.getOperations(), map.get(StandConvertEnum.operation.toString()));
|
|
|
+ // // 2、现病史手术
|
|
|
+ // CoreUtil.setPropertyList(presentLabel.getOperations(), map.get(StandConvertEnum.operation.toString()));
|
|
|
+ // // 3、既往史手术
|
|
|
+ // CoreUtil.setPropertyList(pastLabel.getOperations(), map.get(StandConvertEnum.operation.toString()));
|
|
|
+ // // 4、开单手术
|
|
|
+ // CoreUtil.setPropertyList(wordCrfDTO.getOperationOrder(), "name", "uniqueName", map.get(StandConvertEnum.operation.toString()));
|
|
|
+ // // 5、结构化手术
|
|
|
+ // CoreUtil.setPropertyList(wordCrfDTO.getOperation(), "name", "uniqueName", map.get(StandConvertEnum.operation.toString()));
|
|
|
+ // // 6、选中手术
|
|
|
+ // CoreUtil.setPropertyList(wordCrfDTO.getOperationName(), "name", "uniqueName", map.get(StandConvertEnum.operation.toString()));
|
|
|
+ operateGetAndSet(wordCrfDTO);
|
|
|
+
|
|
|
+ //【输血回填】
|
|
|
+ CoreUtil.setPropertyList(wordCrfDTO.getTransfusionOrder(), "name", "uniqueName", map.get(StandConvertEnum.transfusion.toString()));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 手术映射(关闭同义词转换)
|
|
|
+ *
|
|
|
+ * @param wordCrfDTO
|
|
|
+ */
|
|
|
+ public void operateGetAndSet(WordCrfDTO wordCrfDTO) {
|
|
|
+ // 【所有手术】
|
|
|
+ List<String> operationList = new ArrayList<>();
|
|
|
+ // 1、主诉手术
|
|
|
+ CoreUtil.addList(operationList, CoreUtil.getPropertyList(wordCrfDTO.getChiefLabel().getOperations()));
|
|
|
// 2、现病史手术
|
|
|
- CoreUtil.setPropertyList(presentLabel.getOperations(), map.get(StandConvertEnum.operation.toString()));
|
|
|
+ CoreUtil.addList(operationList, CoreUtil.getPropertyList(wordCrfDTO.getPresentLabel().getOperations()));
|
|
|
// 3、既往史手术
|
|
|
- CoreUtil.setPropertyList(pastLabel.getOperations(), map.get(StandConvertEnum.operation.toString()));
|
|
|
+ CoreUtil.addList(operationList, CoreUtil.getPropertyList(wordCrfDTO.getPastLabel().getOperations()));
|
|
|
// 4、开单手术
|
|
|
- CoreUtil.setPropertyList(wordCrfDTO.getOperationOrder(), "name", "uniqueName", map.get(StandConvertEnum.operation.toString()));
|
|
|
+ CoreUtil.addList(operationList, CoreUtil.filterUniqueList(wordCrfDTO.getOperationOrder()));
|
|
|
// 5、结构化手术
|
|
|
- CoreUtil.setPropertyList(wordCrfDTO.getOperation(), "name", "uniqueName", map.get(StandConvertEnum.operation.toString()));
|
|
|
+ CoreUtil.addList(operationList, CoreUtil.filterUniqueList(wordCrfDTO.getOperation()));
|
|
|
// 6、选中手术
|
|
|
- CoreUtil.setPropertyList(wordCrfDTO.getOperationName(), "name", "uniqueName", map.get(StandConvertEnum.operation.toString()));
|
|
|
+ if (wordCrfDTO.getOperationName() != null && StringUtils.isBlank(wordCrfDTO.getOperationName().getUniqueName())) {
|
|
|
+ operationList.add(wordCrfDTO.getOperationName().getName());
|
|
|
+ }
|
|
|
+ operationList = operationList
|
|
|
+ .stream()
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ Map<String, Map<String, Long>> configMap = new LinkedHashMap<>();
|
|
|
+ if (ListUtil.isNotEmpty(operationList)) {
|
|
|
+ configMap = tranOperationConfigFacade.getConfigMap(wordCrfDTO.getHospitalId(), operationList, null);
|
|
|
+ // 1、主诉手术
|
|
|
+ setListProperty(wordCrfDTO.getChiefLabel(), "operations", "standName", configMap);
|
|
|
+ // 2、现病史手术
|
|
|
+ setListProperty(wordCrfDTO.getPresentLabel(), "operations", "standName", configMap);
|
|
|
+ // 3、既往史手术
|
|
|
+ setListProperty(wordCrfDTO.getPastLabel(), "operations", "standName", configMap);
|
|
|
+ // 4、开单手术
|
|
|
+ setListProperty(wordCrfDTO, "operation", "uniqueName", configMap);
|
|
|
+ // 5、结构化手术
|
|
|
+ setListProperty(wordCrfDTO, "operationOrder", "uniqueName", configMap);
|
|
|
+ // 6、选中手术
|
|
|
+ if (wordCrfDTO.getOperationName() != null &&
|
|
|
+ StringUtil.isNotBlank(wordCrfDTO.getOperationName().getName()) &&
|
|
|
+ StringUtil.isBlank(wordCrfDTO.getOperationName().getUniqueName())) {
|
|
|
+ wordCrfDTO.getOperationName().setUniqueName(wordCrfDTO.getOperationName().getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- //【输血回填】
|
|
|
- CoreUtil.setPropertyList(wordCrfDTO.getTransfusionOrder(), "name", "uniqueName", map.get(StandConvertEnum.transfusion.toString()));
|
|
|
+ /**
|
|
|
+ * 替换映射内容
|
|
|
+ *
|
|
|
+ * @param obj 对象
|
|
|
+ * @param listProperty 获取List属性名
|
|
|
+ * @param objProperty 对象属性名
|
|
|
+ * @param configMap 映射Map
|
|
|
+ */
|
|
|
+ public void setListProperty(Object obj, String listProperty, String objProperty, Map<String, Map<String, Long>> configMap) {
|
|
|
+ Object tList = CoreUtil.getFieldValue(obj, listProperty);
|
|
|
+ List<Operation> operationNewList = convertStandName((List)tList, configMap, objProperty);
|
|
|
+ CoreUtil.setFieldValue(obj, listProperty, operationNewList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 标准名称转换
|
|
|
+ *
|
|
|
+ * @param list
|
|
|
+ * @param configMap
|
|
|
+ * @param fieldName
|
|
|
+ * @param <T>
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public <T> List<T> convertStandName(List<T> list, Map<String, Map<String, Long>> configMap, String fieldName) {
|
|
|
+ List<T> retList = new ArrayList<>();
|
|
|
+ try {
|
|
|
+ if (ListUtil.isEmpty(list)) {
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+ for (T item : list) {
|
|
|
+ String name = item.getClass().getMethod("getName").invoke(item).toString();
|
|
|
+ if (StringUtil.isBlank(name)) {
|
|
|
+ retList.add(item);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (fieldName.equals("uniqueName")) {
|
|
|
+ String uniqueName = item.getClass().getMethod("getUniqueName").invoke(item).toString();
|
|
|
+ if (StringUtil.isNotBlank(uniqueName)) {
|
|
|
+ retList.add(item);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (configMap.containsKey(name)) {
|
|
|
+ List<String> standNames = new ArrayList<>(configMap.get(name).keySet());
|
|
|
+ for (String stdName : standNames) {
|
|
|
+ T o = (T) item.getClass().newInstance();
|
|
|
+ BeanUtil.copyProperties(item, o);
|
|
|
+ BeanUtils.copyProperty(o, fieldName, stdName);
|
|
|
+ retList.add(o);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (fieldName.equals("uniqueName")) {
|
|
|
+ BeanUtils.copyProperty(item, fieldName, name);
|
|
|
+ }
|
|
|
+ retList.add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return retList;
|
|
|
}
|
|
|
|
|
|
/**
|