|
@@ -1,17 +1,29 @@
|
|
package com.diagbot.process;
|
|
package com.diagbot.process;
|
|
|
|
|
|
import com.diagbot.biz.push.entity.Item;
|
|
import com.diagbot.biz.push.entity.Item;
|
|
|
|
+import com.diagbot.biz.push.entity.Lis;
|
|
|
|
+import com.diagbot.biz.push.entity.Pacs;
|
|
|
|
+import com.diagbot.client.IcssPushServiceClient;
|
|
import com.diagbot.dto.*;
|
|
import com.diagbot.dto.*;
|
|
|
|
+import com.diagbot.dto.icss.FeatureRate;
|
|
|
|
+import com.diagbot.dto.icss.Response;
|
|
|
|
+import com.diagbot.dto.icss.ResponseData;
|
|
|
|
+import com.diagbot.entity.PreResult;
|
|
import com.diagbot.enums.DiseaseTypeEnum;
|
|
import com.diagbot.enums.DiseaseTypeEnum;
|
|
import com.diagbot.enums.MedicalAdviceEnum;
|
|
import com.diagbot.enums.MedicalAdviceEnum;
|
|
import com.diagbot.enums.StandConvertEnum;
|
|
import com.diagbot.enums.StandConvertEnum;
|
|
import com.diagbot.facade.CommonFacade;
|
|
import com.diagbot.facade.CommonFacade;
|
|
import com.diagbot.facade.NeoFacade;
|
|
import com.diagbot.facade.NeoFacade;
|
|
import com.diagbot.util.ListUtil;
|
|
import com.diagbot.util.ListUtil;
|
|
|
|
+import com.diagbot.vo.IcssVo;
|
|
import com.diagbot.vo.NeoPushVO;
|
|
import com.diagbot.vo.NeoPushVO;
|
|
import com.diagbot.vo.PushVO;
|
|
import com.diagbot.vo.PushVO;
|
|
import com.diagbot.vo.neoPushEntity.Diag;
|
|
import com.diagbot.vo.neoPushEntity.Diag;
|
|
import com.diagbot.vo.neoPushEntity.DiagVo;
|
|
import com.diagbot.vo.neoPushEntity.DiagVo;
|
|
|
|
+import com.google.common.collect.Lists;
|
|
|
|
+import com.google.common.collect.Maps;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
@@ -30,6 +42,111 @@ public class PushProcess {
|
|
NeoFacade neoFacade;
|
|
NeoFacade neoFacade;
|
|
@Autowired
|
|
@Autowired
|
|
CommonFacade commonFacade;
|
|
CommonFacade commonFacade;
|
|
|
|
+ @Autowired
|
|
|
|
+ IcssPushServiceClient icssPushServiceClient;
|
|
|
|
+
|
|
|
|
+ public PushDTO processIcss(PushVO pushVo){
|
|
|
|
+ List<Item> diag1 = pushVo.getDiag();
|
|
|
|
+ int length = pushVo.getLength();
|
|
|
|
+ Map<String, List<String>> typeWords = Maps.newHashMap();
|
|
|
|
+ List<String> ruleTypeList = Arrays.asList(pushVo.getFeatureType().split(","));
|
|
|
|
+ List<String> pushDiags = Lists.newArrayList();
|
|
|
|
+ PushDTO pushDTO = new PushDTO();
|
|
|
|
+ IcssVo icssVo = pushVo2IcssVo(pushVo);
|
|
|
|
+ Response<ResponseData> annotation = icssPushServiceClient.getAnnotation(icssVo);
|
|
|
|
+ if(annotation != null){
|
|
|
|
+ ResponseData data = annotation.getData();
|
|
|
|
+ if(data != null){
|
|
|
|
+ List<FeatureRate> dis = data.getDis();
|
|
|
|
+ if(ListUtil.isNotEmpty(dis)){
|
|
|
|
+ pushDiags = dis.stream().filter(x -> x.getDesc() == null || x.getDesc().contains("确诊") || x.getDesc().contains("拟诊"))
|
|
|
|
+ .map(x -> x.getFeatureName()).collect(Collectors.toList());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Map<String, List<PushBaseDTO>> dis = new HashMap<>();
|
|
|
|
+ if (ListUtil.isNotEmpty(pushDiags)) {
|
|
|
|
+ //先把所有疾病推出来
|
|
|
|
+ if (ruleTypeList.contains("7")) {
|
|
|
|
+ List<PushBaseDTO> diseeases = pushDiags.stream().map(x -> {
|
|
|
|
+ PushBaseDTO pushBaseDTO = new PushBaseDTO();
|
|
|
|
+ pushBaseDTO.setName(x);
|
|
|
|
+ return pushBaseDTO;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+ diseeases = diseeases.subList(0, diseeases.size() >= length ? length : diseeases.size());
|
|
|
|
+ dis.put(DiseaseTypeEnum.possibleDis.getName(), diseeases);
|
|
|
|
+ pushDTO.setDis(dis);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ //把第一个推送出来的诊断set到diagOrder中,再反推
|
|
|
|
+ NeoPushVO pushVO = new NeoPushVO();
|
|
|
|
+ DiagVo diagVo = new DiagVo();
|
|
|
|
+ diagVo.setDiags(pushDiags.stream().map(x ->{
|
|
|
|
+ Diag diag = new Diag();
|
|
|
|
+ diag.setName(x);
|
|
|
|
+ return diag;
|
|
|
|
+ }).collect(Collectors.toList()));
|
|
|
|
+ pushVO.setDiagVo(diagVo);
|
|
|
|
+ //调用反推
|
|
|
|
+ reversePushPackage(length, pushDTO, ruleTypeList, typeWords, pushVO, dis);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return pushDTO;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * pushVo转Icss入参
|
|
|
|
+ * @param pushVo
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public IcssVo pushVo2IcssVo(PushVO pushVo){
|
|
|
|
+ IcssVo icssVo = new IcssVo();
|
|
|
|
+ icssVo.setAge(Integer.parseInt(pushVo.getAge()));
|
|
|
|
+ String sexs = "";
|
|
|
|
+ Integer sex = pushVo.getSex();
|
|
|
|
+ if(sex == 1){
|
|
|
|
+ sexs = "M";
|
|
|
|
+ }else if(sex == 2){
|
|
|
|
+ sexs = "F";
|
|
|
|
+ }
|
|
|
|
+ icssVo.setSex(sexs);
|
|
|
|
+ icssVo.setChief(pushVo.getChief());
|
|
|
|
+ icssVo.setSymptom(pushVo.getSymptom());
|
|
|
|
+ icssVo.setVital(pushVo.getVital());
|
|
|
|
+ icssVo.setPasts(pushVo.getPasts());
|
|
|
|
+ icssVo.setPersonal(pushVo.getPersonal());
|
|
|
|
+ icssVo.setFeatureType(pushVo.getFeatureType());
|
|
|
|
+
|
|
|
|
+ List<Lis> lis = pushVo.getLis();
|
|
|
|
+ List<PreResult> lis_icss = lis.stream().map(x ->{
|
|
|
|
+ PreResult instantiate = BeanUtils.instantiate(PreResult.class);
|
|
|
|
+ BeanUtils.copyProperties(x,instantiate);
|
|
|
|
+ instantiate.setValue(x.getValue().toString());
|
|
|
|
+ instantiate.setMaxValue(x.getMaxValue().toString());
|
|
|
|
+ instantiate.setMinValue(x.getMinValue().toString());
|
|
|
|
+ return instantiate;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+ icssVo.setLis(lis_icss);
|
|
|
|
+
|
|
|
|
+ List<Pacs> pacs = pushVo.getPacs();
|
|
|
|
+ List<PreResult> pacs_icss = pacs.stream().map(x ->{
|
|
|
|
+ PreResult instantiate = new PreResult();
|
|
|
|
+ BeanUtils.copyProperties(x,instantiate);
|
|
|
|
+ return instantiate;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+ icssVo.setPacs(pacs_icss);
|
|
|
|
+ if(ListUtil.isNotEmpty(pushVo.getDiag())){
|
|
|
|
+ List<PreResult> diagOrder = pushVo.getDiag().stream().map(x ->{
|
|
|
|
+ String name = x.getName();
|
|
|
|
+ PreResult preResult = new PreResult();
|
|
|
|
+ preResult.setValue(name);
|
|
|
|
+ return preResult;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+ icssVo.setDiagOrder(diagOrder);
|
|
|
|
+ }
|
|
|
|
+ return icssVo;
|
|
|
|
+ }
|
|
|
|
|
|
public PushDTO process(PushVO pushVo, Map<String, Map<String, String>> standConvertMap, WordCrfDTO wordCrfDTO) {
|
|
public PushDTO process(PushVO pushVo, Map<String, Map<String, String>> standConvertMap, WordCrfDTO wordCrfDTO) {
|
|
int length = pushVo.getLength();
|
|
int length = pushVo.getLength();
|
|
@@ -58,32 +175,7 @@ public class PushProcess {
|
|
reversePushPackage(length, pushDTO, ruleTypeList, typeWords, pushVO, dis);
|
|
reversePushPackage(length, pushDTO, ruleTypeList, typeWords, pushVO, dis);
|
|
}
|
|
}
|
|
return pushDTO;
|
|
return pushDTO;
|
|
- /*//如果下的诊断有数据就反推
|
|
|
|
- if (pushVO.getDiagVo() != null && ListUtil.isNotEmpty(pushVO.getDiagVo().getDiags())) {
|
|
|
|
- reversePushPackage(length, pushDTO, ruleTypeList, typeWords, pushVO, dis);
|
|
|
|
- } else {
|
|
|
|
- //正推
|
|
|
|
- List<String> push = neoFacade.getPush(pushVO);
|
|
|
|
- if (ListUtil.isNotEmpty(push)) {
|
|
|
|
- //先把所有疾病推出来
|
|
|
|
- if (ruleTypeList.contains("7")) {
|
|
|
|
-// List<PushBaseDTO> diseeases = push.stream().filter(x -> x.getDisease() != null).map(x -> x.getDisease()).collect(Collectors.toList());
|
|
|
|
- List<PushBaseDTO> diseeases = push.stream().map(x -> {
|
|
|
|
- PushBaseDTO pushBaseDTO = new PushBaseDTO();
|
|
|
|
- pushBaseDTO.setName(x);
|
|
|
|
- return pushBaseDTO;
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
- diseeases = diseeases.subList(0, diseeases.size() >= length ? length : diseeases.size());
|
|
|
|
- dis.put(DiseaseTypeEnum.possibleDis.getName(), diseeases);
|
|
|
|
- pushDTO.setDis(dis);
|
|
|
|
- }
|
|
|
|
- //把第一个推送出来的诊断set到diagOrder中,再反推
|
|
|
|
- setPushVo(pushVO, push);
|
|
|
|
- //调用反推
|
|
|
|
- reversePushPackage(length, pushDTO, ruleTypeList, typeWords, pushVO, dis);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return pushDTO;*/
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
private void setPushVo(NeoPushVO pushVO, List<String> push) {
|
|
private void setPushVo(NeoPushVO pushVO, List<String> push) {
|
|
@@ -207,8 +299,10 @@ public class PushProcess {
|
|
|
|
|
|
private List<PushBaseDTO> getPackagePushBaseDTO(Map<String, List<String>> typeWords, List<String> symptoms, StandConvertEnum symptom) {
|
|
private List<PushBaseDTO> getPackagePushBaseDTO(Map<String, List<String>> typeWords, List<String> symptoms, StandConvertEnum symptom) {
|
|
List<PushBaseDTO> symptomPush = symptoms.stream()
|
|
List<PushBaseDTO> symptomPush = symptoms.stream()
|
|
- .filter(x -> !typeWords.get(symptom.toString()).contains(x))
|
|
|
|
.map(x -> {
|
|
.map(x -> {
|
|
|
|
+ x = ListUtil.isNotEmpty(typeWords.get(symptom.toString()))?!typeWords.get(symptom.toString()).contains(x)?x:"":x;
|
|
|
|
+ return x;
|
|
|
|
+ }).filter(x -> StringUtils.isNotBlank(x)).map(x -> {
|
|
PushBaseDTO pushBaseDTO = new PushBaseDTO();
|
|
PushBaseDTO pushBaseDTO = new PushBaseDTO();
|
|
pushBaseDTO.setName(x);
|
|
pushBaseDTO.setName(x);
|
|
return pushBaseDTO;
|
|
return pushBaseDTO;
|