|
@@ -117,8 +117,8 @@ public class CommonFacade {
|
|
|
//模型处理数据
|
|
|
aiAnalyze.aiProcess(searchData, wordCrfDTO);
|
|
|
|
|
|
- // 处理现病史中的化验和辅检,放入结构化
|
|
|
- processPresentLisPacs(wordCrfDTO);
|
|
|
+ // 统一处理化验、辅检、诊断,放入结构化
|
|
|
+ processLisPacsDiag(wordCrfDTO);
|
|
|
|
|
|
// 现病史中体征内容放入体征标签
|
|
|
processPresentVital(wordCrfDTO);
|
|
@@ -412,7 +412,12 @@ public class CommonFacade {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void processPresentLisPacs(WordCrfDTO wordCrfDTO) {
|
|
|
+ /**
|
|
|
+ * 统一处理化验、辅检、诊断,放入结构化
|
|
|
+ *
|
|
|
+ * @param wordCrfDTO
|
|
|
+ */
|
|
|
+ public void processLisPacsDiag(WordCrfDTO wordCrfDTO) {
|
|
|
DiagLabel diagLabel = wordCrfDTO.getDiagLabel();
|
|
|
List<com.diagbot.model.entity.Diag> diags = diagLabel.getDiags();
|
|
|
if (ListUtil.isNotEmpty(diags)) {
|
|
@@ -423,110 +428,35 @@ public class CommonFacade {
|
|
|
return i;
|
|
|
}).collect(Collectors.toList()));
|
|
|
}
|
|
|
- PresentLabel presentLabel = wordCrfDTO.getPresentLabel();
|
|
|
- List<com.diagbot.model.entity.Lis> lises = presentLabel.getLises();
|
|
|
List<Lis> lisList = new ArrayList<>();
|
|
|
- if (ListUtil.isNotEmpty(lises)) {
|
|
|
- List<String> lisNames = lises.stream().map(x -> x.getBigItem().getName()).distinct().collect(Collectors.toList());
|
|
|
- Map<String, Map<String, Map<String, Long>>> configMap = lisConfigFacade.getConfigMap(wordCrfDTO.getHospitalId(), lisNames, null);
|
|
|
- if (configMap.size() > 0) {
|
|
|
- lises.stream().forEach(x -> {
|
|
|
- String bigName = x.getBigItem().getName();//大项名
|
|
|
- String detailName = x.getName();//小项名
|
|
|
- String value = x.getPd().getValue();
|
|
|
- String unit = x.getPd().getUnit();
|
|
|
- if (configMap.containsKey(bigName)) {
|
|
|
- Map<String, Map<String, Long>> uniqueDetailMap = configMap.get(bigName);
|
|
|
- if (uniqueDetailMap.containsKey(detailName)) {
|
|
|
- List<String> uniques = uniqueDetailMap.get(detailName).keySet().stream().collect(Collectors.toList());//所有的公表项
|
|
|
- if (ListUtil.isNotEmpty(uniques)) {
|
|
|
- List<Lis> lisStream = uniques.stream().map(z -> {
|
|
|
- return getLis(bigName, detailName, value, unit, z);
|
|
|
- }).collect(Collectors.toList());
|
|
|
- lisList.addAll(lisStream);
|
|
|
- }
|
|
|
- } else {
|
|
|
- Lis lis = getLis(bigName, detailName, value, unit, null);
|
|
|
- lisList.add(lis);
|
|
|
- }
|
|
|
- } else {
|
|
|
- Lis lis = getLis(bigName, detailName, value, unit, null);
|
|
|
- lisList.add(lis);
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- lises.stream().forEach(x -> {
|
|
|
- Lis lis = getLis(x.getBigItem().getName(), x.getName(), x.getPd().getValue(), x.getPd().getUnit(), null);
|
|
|
- lisList.add(lis);
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- wordCrfDTO.getLis().addAll(lisList);
|
|
|
|
|
|
- // 处理辅检信息,将现病史和结构化辅检统一放到pacsLable中
|
|
|
- PacsLabel pacsLabel = wordCrfDTO.getPacsLabel();
|
|
|
- List<Item> pacsResList = pacsLabel.getRes();
|
|
|
- PacsLabel pacsPresentLabel = wordCrfDTO.getPresentLabel().getPacsLabel();
|
|
|
- if (pacsPresentLabel != null) {
|
|
|
- // 添加辅检项目名称
|
|
|
- if (ListUtil.isNotEmpty(pacsPresentLabel.getItem())) {
|
|
|
- pacsLabel.getItem().addAll(pacsPresentLabel.getItem());
|
|
|
- }
|
|
|
- // 添加辅检的诊断
|
|
|
- if (ListUtil.isNotEmpty(pacsPresentLabel.getDisease())) {
|
|
|
- pacsLabel.getDisease().addAll(pacsPresentLabel.getDisease());
|
|
|
- }
|
|
|
- // 添加辅检的描述
|
|
|
- if (ListUtil.isNotEmpty(pacsPresentLabel.getPacsResults())) {
|
|
|
- pacsLabel.getPacsResults().addAll(pacsPresentLabel.getPacsResults());
|
|
|
- }
|
|
|
+ /**************************化验结构化处理开始*****************************/
|
|
|
+ // 处理主诉化验
|
|
|
+ getLisStruct(wordCrfDTO.getChiefLabel().getLises(), lisList, wordCrfDTO.getHospitalId());
|
|
|
+ // 处理现病史化验
|
|
|
+ getLisStruct(wordCrfDTO.getPresentLabel().getLises(), lisList, wordCrfDTO.getHospitalId());
|
|
|
+ // 统一放置化验结构
|
|
|
+ if (ListUtil.isNotEmpty(lisList)) {
|
|
|
+ wordCrfDTO.getLis().addAll(lisList);
|
|
|
}
|
|
|
+ /*************************化验结构化处理结束******************************/
|
|
|
|
|
|
- if (ListUtil.isNotEmpty(pacsLabel.getDisease())) {
|
|
|
- for (Pacs pacs : pacsLabel.getDisease()) {
|
|
|
- Item item = new Item();
|
|
|
- item.setName(pacs.getName());
|
|
|
- item.setUniqueName(pacs.getStandName());
|
|
|
- pacsResList.add(item);
|
|
|
- }
|
|
|
+ /**************************辅检结构化处理开始*****************************/
|
|
|
+ // 处理辅检信息
|
|
|
+ PacsLabel pacsLabel = wordCrfDTO.getPacsLabel();
|
|
|
+ // 处理主诉辅检
|
|
|
+ getPacsStruct(pacsLabel, wordCrfDTO.getChiefLabel().getPacsLabel());
|
|
|
+ // 处理现病史辅检
|
|
|
+ getPacsStruct(pacsLabel, wordCrfDTO.getPresentLabel().getPacsLabel());
|
|
|
+ // 辅检结果去重
|
|
|
+ if (ListUtil.isNotEmpty(pacsLabel.getRes())) {
|
|
|
+ dealMsgWithItem(pacsLabel.getRes());
|
|
|
}
|
|
|
- // 添加辅检的描述
|
|
|
- if (ListUtil.isNotEmpty(pacsLabel.getPacsResults())) {
|
|
|
- for (Pacs pacs : pacsLabel.getPacsResults()) {
|
|
|
- Item item = new Item();
|
|
|
- item.setName(pacs.getName());
|
|
|
- item.setUniqueName(pacs.getStandName());
|
|
|
- pacsResList.add(item);
|
|
|
- // 部位 + 描述循环放入
|
|
|
- for (BodyPart bodyPart : pacs.getBodyPartList()) {
|
|
|
- Item itemPart = new Item();
|
|
|
- itemPart.setName(bodyPart.getName() + pacs.getName());
|
|
|
- itemPart.setUniqueName(bodyPart.getStandName() + pacs.getStandName());
|
|
|
- pacsResList.add(itemPart);
|
|
|
- }
|
|
|
-
|
|
|
- // 描述 + 修饰、 修饰 + 描述 循环放入
|
|
|
- for (Modification modification : pacs.getModification()) {
|
|
|
- Item itemModification = new Item();
|
|
|
- itemModification.setName(pacs.getName() + modification.getName());
|
|
|
- itemModification.setUniqueName(pacs.getStandName() + modification.getStandName());
|
|
|
- pacsResList.add(itemModification);
|
|
|
-
|
|
|
- Item itemModificationRe = new Item();
|
|
|
- itemModificationRe.setName(modification.getName() + pacs.getName());
|
|
|
- itemModificationRe.setUniqueName(modification.getStandName() + pacs.getStandName());
|
|
|
- pacsResList.add(itemModificationRe);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 辅检项目去重
|
|
|
- if (ListUtil.isNotEmpty(pacsLabel.getRes())) {
|
|
|
- dealMsgWithItem(pacsLabel.getRes());
|
|
|
- }
|
|
|
- if (ListUtil.isNotEmpty(pacsLabel.getItem())) {
|
|
|
- dealMsgWithItem(pacsLabel.getItem());
|
|
|
- }
|
|
|
+ // 辅检名称去重
|
|
|
+ if (ListUtil.isNotEmpty(pacsLabel.getItem())) {
|
|
|
+ dealMsgWithItem(pacsLabel.getItem());
|
|
|
}
|
|
|
+ /*************************辅检结构化处理结束******************************/
|
|
|
|
|
|
//处理辅检
|
|
|
// List<com.diagbot.biz.push.entity.Pacs> pacs = new ArrayList<>();
|
|
@@ -583,6 +513,108 @@ public class CommonFacade {
|
|
|
// pacsLabel.getPacsNewList().addAll(packagePacs);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public void getPacsStruct(PacsLabel res, PacsLabel dealPacsLabel) {
|
|
|
+ List<Item> pacsResList = res.getRes();
|
|
|
+ if (dealPacsLabel != null) {
|
|
|
+ // 添加辅检项目名称
|
|
|
+ if (ListUtil.isNotEmpty(dealPacsLabel.getItem())) {
|
|
|
+ res.getItem().addAll(dealPacsLabel.getItem());
|
|
|
+ }
|
|
|
+ // 添加辅检的诊断
|
|
|
+ if (ListUtil.isNotEmpty(dealPacsLabel.getDisease())) {
|
|
|
+ res.getDisease().addAll(dealPacsLabel.getDisease());
|
|
|
+ }
|
|
|
+ // 添加辅检的描述
|
|
|
+ if (ListUtil.isNotEmpty(dealPacsLabel.getPacsResults())) {
|
|
|
+ res.getPacsResults().addAll(dealPacsLabel.getPacsResults());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ListUtil.isNotEmpty(res.getDisease())) {
|
|
|
+ for (Pacs pacs : res.getDisease()) {
|
|
|
+ Item item = new Item();
|
|
|
+ item.setName(pacs.getName());
|
|
|
+ item.setUniqueName(pacs.getStandName());
|
|
|
+ pacsResList.add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 添加辅检的描述
|
|
|
+ if (ListUtil.isNotEmpty(res.getPacsResults())) {
|
|
|
+ for (Pacs pacs : res.getPacsResults()) {
|
|
|
+ Item item = new Item();
|
|
|
+ item.setName(pacs.getName());
|
|
|
+ item.setUniqueName(pacs.getStandName());
|
|
|
+ pacsResList.add(item);
|
|
|
+ // 部位 + 描述循环放入
|
|
|
+ for (BodyPart bodyPart : pacs.getBodyPartList()) {
|
|
|
+ Item itemPart = new Item();
|
|
|
+ itemPart.setName(bodyPart.getName() + pacs.getName());
|
|
|
+ itemPart.setUniqueName(bodyPart.getStandName() + pacs.getStandName());
|
|
|
+ pacsResList.add(itemPart);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 描述 + 修饰、 修饰 + 描述 循环放入
|
|
|
+ for (Modification modification : pacs.getModification()) {
|
|
|
+ Item itemModification = new Item();
|
|
|
+ itemModification.setName(pacs.getName() + modification.getName());
|
|
|
+ itemModification.setUniqueName(pacs.getStandName() + modification.getStandName());
|
|
|
+ pacsResList.add(itemModification);
|
|
|
+
|
|
|
+ Item itemModificationRe = new Item();
|
|
|
+ itemModificationRe.setName(modification.getName() + pacs.getName());
|
|
|
+ itemModificationRe.setUniqueName(modification.getStandName() + pacs.getStandName());
|
|
|
+ pacsResList.add(itemModificationRe);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取化验的结构
|
|
|
+ *
|
|
|
+ * @param lises
|
|
|
+ * @param lisList
|
|
|
+ * @param hospitalId
|
|
|
+ */
|
|
|
+ public void getLisStruct(List<com.diagbot.model.entity.Lis> lises, List<Lis> lisList, Long hospitalId) {
|
|
|
+ if (ListUtil.isNotEmpty(lises)) {
|
|
|
+ List<String> lisNames = lises.stream().map(x -> x.getBigItem().getName()).distinct().collect(Collectors.toList());
|
|
|
+ Map<String, Map<String, Map<String, Long>>> configMap = lisConfigFacade.getConfigMap(hospitalId, lisNames, null);
|
|
|
+ if (configMap.size() > 0) {
|
|
|
+ lises.stream().forEach(x -> {
|
|
|
+ String bigName = x.getBigItem().getName();//大项名
|
|
|
+ String detailName = x.getName();//小项名
|
|
|
+ String value = x.getPd().getValue();
|
|
|
+ String unit = x.getPd().getUnit();
|
|
|
+ if (configMap.containsKey(bigName)) {
|
|
|
+ Map<String, Map<String, Long>> uniqueDetailMap = configMap.get(bigName);
|
|
|
+ if (uniqueDetailMap.containsKey(detailName)) {
|
|
|
+ List<String> uniques = uniqueDetailMap.get(detailName).keySet().stream().collect(Collectors.toList());//所有的公表项
|
|
|
+ if (ListUtil.isNotEmpty(uniques)) {
|
|
|
+ List<Lis> lisStream = uniques.stream().map(z -> {
|
|
|
+ return getLis(bigName, detailName, value, unit, z);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ lisList.addAll(lisStream);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ Lis lis = getLis(bigName, detailName, value, unit, null);
|
|
|
+ lisList.add(lis);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ Lis lis = getLis(bigName, detailName, value, unit, null);
|
|
|
+ lisList.add(lis);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ lises.stream().forEach(x -> {
|
|
|
+ Lis lis = getLis(x.getBigItem().getName(), x.getName(), x.getPd().getValue(), x.getPd().getUnit(), null);
|
|
|
+ lisList.add(lis);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private Lis getLis(String bigName, String detailName, String value, String unit, String uniqueName) {
|
|
|
Lis lis = new Lis();
|
|
|
lis.setUnits(unit);
|