|
@@ -0,0 +1,160 @@
|
|
|
+package com.diagbot.repository;
|
|
|
+
|
|
|
+
|
|
|
+import com.diagbot.dto.OtherTipTransfusionNeoDTO;
|
|
|
+import com.diagbot.dto.WordCrfDTO;
|
|
|
+import com.diagbot.entity.node.TransfusionSuggest;
|
|
|
+import com.diagbot.biz.push.entity.Item;
|
|
|
+import com.diagbot.biz.push.entity.Lis;
|
|
|
+import com.diagbot.entity.node.YiBaoDiseaseName;
|
|
|
+import com.diagbot.entity.node.YiBaoOperationName;
|
|
|
+import com.diagbot.util.ListUtil;
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+public class TransfusionSuggestNode {
|
|
|
+
|
|
|
+ public List<OtherTipTransfusionNeoDTO> findSuggest(List<TransfusionSuggest> transfusionSuggests, WordCrfDTO wordCrfDTO) {
|
|
|
+
|
|
|
+ List<OtherTipTransfusionNeoDTO> ottfNeoDTOs = new ArrayList<>();
|
|
|
+
|
|
|
+ OtherTipTransfusionNeoDTO otherTipTfNeoDTO = new OtherTipTransfusionNeoDTO();
|
|
|
+
|
|
|
+ Item item;
|
|
|
+ List<String> diseases = new ArrayList<>();
|
|
|
+ List<String> surgery = new ArrayList<>();
|
|
|
+ Map<String, Lis> lismap = new HashMap<>();
|
|
|
+ String disname, surgname, lisname;
|
|
|
+ Lis lisresult;
|
|
|
+
|
|
|
+ for (Item dg : wordCrfDTO.getDiag()) {
|
|
|
+ diseases.add(dg.getUniqueName());
|
|
|
+ }
|
|
|
+
|
|
|
+ for (Item op : wordCrfDTO.getOperation()) {
|
|
|
+ surgery.add(op.getUniqueName());
|
|
|
+ }
|
|
|
+
|
|
|
+ for (Lis lisitem : wordCrfDTO.getLis()) {
|
|
|
+ lismap.put(lisitem.getUniqueName(), lisitem);
|
|
|
+ }
|
|
|
+
|
|
|
+ for (TransfusionSuggest tf : transfusionSuggests) {
|
|
|
+
|
|
|
+ lisname = "";
|
|
|
+ disname = "";
|
|
|
+ surgname = "";
|
|
|
+ lisresult = null;
|
|
|
+ Double val;
|
|
|
+
|
|
|
+ if (tf.getNode_label().equals(Constants.lisname)) {
|
|
|
+ lisname = tf.getIndex_name();
|
|
|
+ lisresult = lismap.get(lisname);
|
|
|
+ if (lisresult!=null) {
|
|
|
+ val = lisresult.getValue();
|
|
|
+ if (tf.getRange() == 0) {
|
|
|
+ if (null==tf.getMinval() && null==tf.getMaxval()) {
|
|
|
+ lisresult = null;
|
|
|
+ }
|
|
|
+ else if (null==tf.getMinval() && val > tf.getMaxval()) {
|
|
|
+ lisresult = null;
|
|
|
+ }
|
|
|
+ else if(null==tf.getMaxval() && val < tf.getMinval()) {
|
|
|
+ lisresult = null;
|
|
|
+ }
|
|
|
+ else if (null!=tf.getMinval() && null!=tf.getMaxval() &&
|
|
|
+ (val > tf.getMaxval() || val < tf.getMinval())) {
|
|
|
+ lisresult = null;
|
|
|
+ }
|
|
|
+ } else if (tf.getRange() == 1) {
|
|
|
+ if (null==tf.getMinval() && null==tf.getMaxval()) {
|
|
|
+ lisresult = null;
|
|
|
+ }
|
|
|
+ else if (null!=tf.getMaxval() && val < tf.getMaxval()) {
|
|
|
+ lisresult = null;
|
|
|
+ }
|
|
|
+ else if (null!=tf.getMinval() && val > tf.getMinval()){
|
|
|
+ lisresult = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ lisname = "";
|
|
|
+ lisresult = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (tf.getDiseases().size()>0) {
|
|
|
+ List<YiBaoDiseaseName> ybdisease = new ArrayList(tf.getDiseases());
|
|
|
+ if (diseases.contains(ybdisease.get(0).getName())) {
|
|
|
+ disname = ybdisease.get(0).getName();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (tf.getOperations().size()>0) {
|
|
|
+ List<YiBaoOperationName> yboperation = new ArrayList(tf.getOperations());
|
|
|
+ if (surgery.contains(yboperation.get(0).getName())) {
|
|
|
+ surgname = yboperation.get(0).getName();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (StringUtil.isNotBlank(lisname) || StringUtil.isNotBlank(disname) || StringUtil.isNotBlank(surgname)) {
|
|
|
+
|
|
|
+ if (StringUtil.isNotBlank(lisname) && null!=lisresult) {
|
|
|
+ otherTipTfNeoDTO.getLisList().add(lisresult);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtil.isNotBlank(surgname)) {
|
|
|
+ item = new Item();
|
|
|
+ item.setName(surgname);
|
|
|
+ item.setUniqueName(surgname);
|
|
|
+
|
|
|
+ otherTipTfNeoDTO.getOperation().add(item);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtil.isNotBlank(disname)) {
|
|
|
+ item = new Item();
|
|
|
+ item.setName(disname);
|
|
|
+ item.setUniqueName(disname);
|
|
|
+
|
|
|
+ otherTipTfNeoDTO.getDiag().add(item);
|
|
|
+ }
|
|
|
+
|
|
|
+ ottfNeoDTOs.add(otherTipTfNeoDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return ottfNeoDTOs;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取建议输血提醒列表
|
|
|
+ */
|
|
|
+ public List<OtherTipTransfusionNeoDTO> getTransfusionSuggest(WordCrfDTO wordCrfDTO, TransfusionSuggestRepository transfusionSugRepository) {
|
|
|
+
|
|
|
+ List<OtherTipTransfusionNeoDTO> tfNeoDTOs = new ArrayList<>();
|
|
|
+ List<OtherTipTransfusionNeoDTO> ottfDTOs;
|
|
|
+
|
|
|
+
|
|
|
+ List<TransfusionSuggest> tslist;
|
|
|
+
|
|
|
+ tslist = transfusionSugRepository.findByNameContaining("");
|
|
|
+
|
|
|
+ if (ListUtil.isNotEmpty(tslist)) {
|
|
|
+ ottfDTOs = findSuggest(tslist, wordCrfDTO);
|
|
|
+
|
|
|
+ tfNeoDTOs.addAll(ottfDTOs);
|
|
|
+ }
|
|
|
+
|
|
|
+ return tfNeoDTOs;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|