|
@@ -6,15 +6,13 @@ import com.diagbot.client.CRFServiceClient;
|
|
|
import com.diagbot.dto.WordCrfDTO;
|
|
|
import com.diagbot.enums.StandConvertEnum;
|
|
|
import com.diagbot.model.ai.AIAnalyze;
|
|
|
-import com.diagbot.model.label.ChiefLabel;
|
|
|
-import com.diagbot.model.label.DiagLabel;
|
|
|
-import com.diagbot.model.label.PastLabel;
|
|
|
-import com.diagbot.model.label.PresentLabel;
|
|
|
-import com.diagbot.model.label.VitalLabel;
|
|
|
+import com.diagbot.model.label.*;
|
|
|
import com.diagbot.util.CoreUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
+import com.diagbot.vo.NeoPushVO;
|
|
|
import com.diagbot.vo.SearchData;
|
|
|
import com.diagbot.vo.StandConvert;
|
|
|
+import com.diagbot.vo.neoPushEntity.*;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -35,8 +33,8 @@ public class CommonFacade {
|
|
|
CRFServiceClient crfServiceClient;
|
|
|
|
|
|
//组装好的label
|
|
|
- public WordCrfDTO crf_process(SearchData searchData){
|
|
|
-
|
|
|
+ public WordCrfDTO crf_process(SearchData searchData) {
|
|
|
+
|
|
|
AIAnalyze aiAnalyze = new AIAnalyze(crfServiceClient);
|
|
|
WordCrfDTO wordCrfDTO = new WordCrfDTO();
|
|
|
wordCrfDTO.setAge(searchData.getAge());
|
|
@@ -52,7 +50,7 @@ public class CommonFacade {
|
|
|
}
|
|
|
|
|
|
//返回给图谱的词,这些词需要转换成标准词
|
|
|
- public StandConvert dataTypeGet(WordCrfDTO wordCrfDTO){
|
|
|
+ public StandConvert dataTypeGet(WordCrfDTO wordCrfDTO) {
|
|
|
StandConvert standConvert = new StandConvert();
|
|
|
|
|
|
//所有的症状(主诉、现病史)
|
|
@@ -73,17 +71,17 @@ public class CommonFacade {
|
|
|
|
|
|
//所有化验(结构化数据)
|
|
|
List<Lis> lis = wordCrfDTO.getLis();
|
|
|
- if(ListUtil.isNotEmpty(lis)){
|
|
|
+ if (ListUtil.isNotEmpty(lis)) {
|
|
|
List<String> lis_unique = lis.stream().filter(x -> StringUtils.isBlank(x.getUniqueName()))
|
|
|
- .map(x ->x.getName()+x.getDetailName()).collect(Collectors.toList());
|
|
|
+ .map(x -> x.getName() + x.getDetailName()).collect(Collectors.toList());
|
|
|
standConvert.setLisList(lis_unique);
|
|
|
}
|
|
|
|
|
|
//所有辅助检查(结构化数据)
|
|
|
List<Pacs> pacs = wordCrfDTO.getPacs();
|
|
|
- if(ListUtil.isNotEmpty(pacs)){
|
|
|
+ if (ListUtil.isNotEmpty(pacs)) {
|
|
|
List<String> pacss_unique = pacs.stream().filter(x -> StringUtils.isBlank(x.getUniqueName()))
|
|
|
- .map(x ->x.getName()).collect(Collectors.toList());
|
|
|
+ .map(x -> x.getName()).collect(Collectors.toList());
|
|
|
standConvert.setPacsList(pacss_unique);
|
|
|
}
|
|
|
|
|
@@ -115,7 +113,7 @@ public class CommonFacade {
|
|
|
}
|
|
|
|
|
|
//把图谱返回的标准词set到label中
|
|
|
- public void dataTypeSet(WordCrfDTO wordCrfDTO, Map<String, Map<String, String>> map){
|
|
|
+ public void dataTypeSet(WordCrfDTO wordCrfDTO, Map<String, Map<String, String>> map) {
|
|
|
ChiefLabel chiefLabel = wordCrfDTO.getChiefLabel();
|
|
|
PresentLabel presentLabel = wordCrfDTO.getPresentLabel();
|
|
|
PastLabel pastLabel = wordCrfDTO.getPastLabel();
|
|
@@ -125,22 +123,90 @@ public class CommonFacade {
|
|
|
VitalLabel vitalLabel = wordCrfDTO.getVitalLabel();
|
|
|
|
|
|
//症状回填
|
|
|
- CoreUtil.setPropertyList(chiefLabel.getClinicals(),map.get(StandConvertEnum.clinical.getName()));
|
|
|
- CoreUtil.setPropertyList(presentLabel.getClinicals(),map.get(StandConvertEnum.clinical.getName()));
|
|
|
+ CoreUtil.setPropertyList(chiefLabel.getClinicals(), map.get(StandConvertEnum.clinical.getName()));
|
|
|
+ CoreUtil.setPropertyList(presentLabel.getClinicals(), map.get(StandConvertEnum.clinical.getName()));
|
|
|
//诊断回填
|
|
|
- CoreUtil.setPropertyList(diagLabel.getDiags(),map.get(StandConvertEnum.disease.getName()));
|
|
|
+ CoreUtil.setPropertyList(diagLabel.getDiags(), map.get(StandConvertEnum.disease.getName()));
|
|
|
//药品回填
|
|
|
- CoreUtil.setPropertyList(presentLabel.getMedicines(),map.get(StandConvertEnum.drug.getName()));
|
|
|
- CoreUtil.setPropertyList(pastLabel.getAllergyMedicines(),map.get(StandConvertEnum.drug.getName()));
|
|
|
+ CoreUtil.setPropertyList(presentLabel.getMedicines(), map.get(StandConvertEnum.drug.getName()));
|
|
|
+ CoreUtil.setPropertyList(pastLabel.getAllergyMedicines(), map.get(StandConvertEnum.drug.getName()));
|
|
|
// TODO: 2020/8/5 化验回填
|
|
|
- CoreUtil.setPropertyList(lis,"name","detailName","uniqueName",map.get(StandConvertEnum.lis.getName()));
|
|
|
+ CoreUtil.setPropertyList(lis, "name", "detailName", "uniqueName", map.get(StandConvertEnum.lis.getName()));
|
|
|
// TODO: 2020/8/5 辅助检查回填
|
|
|
- CoreUtil.setPropertyList(pacs,"name","uniqueName",map.get(StandConvertEnum.pacs.getName()));
|
|
|
+ CoreUtil.setPropertyList(pacs, "name", "uniqueName", map.get(StandConvertEnum.pacs.getName()));
|
|
|
//体征回填
|
|
|
- CoreUtil.setPropertyList(vitalLabel.getVitals(),map.get(StandConvertEnum.vital.getName()));
|
|
|
+ CoreUtil.setPropertyList(vitalLabel.getVitals(), map.get(StandConvertEnum.vital.getName()));
|
|
|
//手术回填
|
|
|
- CoreUtil.setPropertyList(presentLabel.getOperations(),map.get(StandConvertEnum.operation.getName()));
|
|
|
- CoreUtil.setPropertyList(pastLabel.getOperations(),map.get(StandConvertEnum.operation.getName()));
|
|
|
+ CoreUtil.setPropertyList(presentLabel.getOperations(), map.get(StandConvertEnum.operation.getName()));
|
|
|
+ CoreUtil.setPropertyList(pastLabel.getOperations(), map.get(StandConvertEnum.operation.getName()));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 生成给图谱的入参(推送)
|
|
|
+ */
|
|
|
+ public NeoPushVO generatePushImput(WordCrfDTO wordCrfDTO) {
|
|
|
+ NeoPushVO pushVO = new NeoPushVO();
|
|
|
+ ChiefLabel chiefLabel = wordCrfDTO.getChiefLabel();
|
|
|
+ PresentLabel presentLabel = wordCrfDTO.getPresentLabel();
|
|
|
+ PastLabel pastLabel = wordCrfDTO.getPastLabel();
|
|
|
+ List<Lis> lis = wordCrfDTO.getLis();
|
|
|
+ List<Pacs> pacs = wordCrfDTO.getPacs();
|
|
|
+ pushVO.setAge(wordCrfDTO.getAge());
|
|
|
+ pushVO.setSex(wordCrfDTO.getSex());
|
|
|
+ if (chiefLabel != null) {
|
|
|
+ List<Symptom> cjiefClinicals = chiefLabel.getClinicals().stream().filter(x -> x.getNegative() == null).map(z ->
|
|
|
+ {
|
|
|
+ Symptom symptom = new Symptom();
|
|
|
+ symptom.setName(z.getStandName());
|
|
|
+ return symptom;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ if (ListUtil.isNotEmpty(cjiefClinicals)) {
|
|
|
+ ChiefPushVo chiefPushVo = new ChiefPushVo();
|
|
|
+ chiefPushVo.setSymptoms(cjiefClinicals);
|
|
|
+ pushVO.setChiefPushVo(chiefPushVo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(presentLabel != null){
|
|
|
+ PresentPushVo presentPushVo = new PresentPushVo();
|
|
|
+ List<Symptom> presentClinicals = presentLabel.getClinicals().stream().filter(x -> x.getNegative() == null).map(z ->
|
|
|
+ {
|
|
|
+ Symptom symptom = new Symptom();
|
|
|
+ symptom.setName(z.getStandName());
|
|
|
+ return symptom;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ presentPushVo.setSymptoms(presentClinicals);
|
|
|
+
|
|
|
+ List<Diag> presentdiags = presentLabel.getDiags().stream().filter(x -> x.getNegative() == null).map(z ->
|
|
|
+ {
|
|
|
+ Diag diag = new Diag();
|
|
|
+ diag.setName(z.getStandName());
|
|
|
+ return diag;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ presentPushVo.setDiags(presentdiags);
|
|
|
+
|
|
|
+ List<Drug> presentdrugs = presentLabel.getMedicines().stream().filter(x -> x.getNegative() == null).map(z ->
|
|
|
+ {
|
|
|
+ Drug drug = new Drug();
|
|
|
+ drug.setName(z.getStandName());
|
|
|
+ return drug;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ presentPushVo.setDrugs(presentdrugs);
|
|
|
+
|
|
|
+ pushVO.setPresentPushVo(presentPushVo);
|
|
|
+ }
|
|
|
+ if(ListUtil.isNotEmpty(lis)){
|
|
|
+ LisPushVo lisPushVo = new LisPushVo();
|
|
|
+ lisPushVo.setLises(lis);
|
|
|
+ pushVO.setLisPushVo(lisPushVo);
|
|
|
+ }
|
|
|
+ if(ListUtil.isNotEmpty(pacs)){
|
|
|
+ PacsPushVo pacsPushVo = new PacsPushVo();
|
|
|
+ pacsPushVo.setPacs(pacs);
|
|
|
+ pushVO.setPacsPushVo(pacsPushVo);
|
|
|
+ }
|
|
|
+
|
|
|
+ return pushVO;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|