Browse Source

添加辅检提醒的查询方法

MarkHuang 4 years ago
parent
commit
7a51979f6a

+ 45 - 0
src/main/java/com/diagbot/entity/node/PacsRemind.java

@@ -0,0 +1,45 @@
+package com.diagbot.entity.node;
+
+import com.diagbot.entity.node.base.BaseNode;
+import lombok.Getter;
+import lombok.Setter;
+import org.neo4j.ogm.annotation.NodeEntity;
+import org.neo4j.ogm.annotation.Property;
+import org.neo4j.ogm.annotation.Relationship;
+
+import java.util.HashSet;
+import java.util.Set;
+
+@Setter
+@Getter
+@NodeEntity(label = "辅检提醒指标")
+public class PacsRemind extends BaseNode  {
+
+	@Property(name = "年龄最小值")
+	private Integer minval;
+
+	@Property(name = "年龄最大值")
+	private Integer maxval;
+
+	@Property(name = "年龄范围")
+	private Integer range=0;
+
+	@Property(name = "性别")
+	private String gender;
+
+	@Property(name = "医保疾病名称")
+	private String disease;
+
+	@Property(name = "检查结果")
+    private String result;
+
+	@Property(name = "检查结论有")
+    private String postoken;
+
+	@Property(name = "检查结论无")
+    private String negtoken;
+
+	@Property(name = "提示语")
+	private String msg;
+
+}

+ 15 - 4
src/main/java/com/diagbot/facade/NeoFacade.java

@@ -2,13 +2,11 @@ package com.diagbot.facade;
 
 import com.alibaba.fastjson.JSONArray;
 import com.diagbot.biz.push.entity.Lis;
+import com.diagbot.biz.push.entity.Pacs;
 import com.diagbot.client.ChiefPresentSimilarityServiceClient;
 import com.diagbot.client.StandConvertServiceClient;
 import com.diagbot.dto.*;
-import com.diagbot.entity.node.LisRemind;
-import com.diagbot.entity.node.Medicine;
-import com.diagbot.entity.node.Symptom;
-import com.diagbot.entity.node.YiBaoDiseaseName;
+import com.diagbot.entity.node.*;
 import com.diagbot.enums.StandConvertEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
@@ -86,6 +84,8 @@ public class NeoFacade {
     TransfusionRemindRepository transfusionRemindRepository;
     @Autowired
     TransfusionSuggestRepository transfusionSuggestRepository;
+    @Autowired
+    PacsRemindRepository pacsRemindRepository;
 
     /**
      * 返回药品缓存信息
@@ -465,6 +465,17 @@ public class NeoFacade {
     }
 
 
+    /**
+     * 处理辅检提醒
+     */
+    public List<OtherTipPacsNeoDTO> getPacsReminds(WordCrfDTO wordCrfDTO) {
+        PacsRemindNode pacsRemindNode = new PacsRemindNode();
+        List<OtherTipPacsNeoDTO> otherTipPacsNeoDTOS = pacsRemindNode.getPacsReminds(wordCrfDTO, pacsRemindRepository);
+
+        return otherTipPacsNeoDTOS;
+    }
+
+
     /**
      * 处理处方开单合理性
      */

+ 1 - 1
src/main/java/com/diagbot/facade/OtherTipFacade.java

@@ -148,7 +148,7 @@ public class OtherTipFacade {
         otherTipProcess.processTransfusion(otherTipTransfusionNeoDTOList, res);
 
         // 其他提示——辅检
-        List<OtherTipPacsNeoDTO> otherTipPacsNeoDTOList = new ArrayList<>();
+        List<OtherTipPacsNeoDTO> otherTipPacsNeoDTOList = neoFacade.getPacsReminds(wordCrfDTO);
         // TODO 测试数据开始
         // OtherTipPacsNeoDTO otherTipPacsNeoDTO = new OtherTipPacsNeoDTO();
         // otherTipPacsNeoDTO.setMsg("该患者年龄在18-60岁,主胰管内径≥3mm,可考虑主胰管扩张");

+ 206 - 0
src/main/java/com/diagbot/repository/PacsRemindNode.java

@@ -0,0 +1,206 @@
+package com.diagbot.repository;
+
+
+import com.diagbot.biz.push.entity.Item;
+import com.diagbot.biz.push.entity.Lis;
+import com.diagbot.biz.push.entity.Pacs;
+import com.diagbot.dto.OtherTipPacsNeoDTO;
+import com.diagbot.dto.OtherTipTransfusionNeoDTO;
+import com.diagbot.dto.WordCrfDTO;
+import com.diagbot.entity.node.PacsRemind;
+import com.diagbot.entity.node.TransfusionSuggest;
+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 PacsRemindNode {
+
+	public List<OtherTipPacsNeoDTO> getReminds(List<PacsRemind> pacsReminds, WordCrfDTO wordCrfDTO) {
+
+		List<OtherTipPacsNeoDTO> otherPacsNeoDTOs = new ArrayList<>();
+
+		OtherTipPacsNeoDTO otherPacsNeoDTO;
+
+		Item item;
+		List<String> diseases = new ArrayList<>();
+		List<String> pacsresult = new ArrayList<>();
+		String pacsgender = "";
+		String disname, gender, psresult, posres, negres, msg;
+		Integer age, agerange;
+		Integer minage = null;
+		Integer maxage = null;
+
+
+		for (Item dg : wordCrfDTO.getDiag()) {
+			diseases.add(dg.getUniqueName());
+		}
+
+		for (Pacs pacs : wordCrfDTO.getPacs()) {
+			pacsresult.add(pacs.getResult());
+		}
+
+		if (wordCrfDTO.getSex()==1) {
+			pacsgender = "男";
+		}
+		else if (wordCrfDTO.getSex()==2) {
+			pacsgender = "女";
+		}
+
+		age = wordCrfDTO.getAge();
+
+		for (PacsRemind pr : pacsReminds) {
+
+			disname = "";
+			gender = "";
+			agerange = 0;
+			psresult = "";
+			posres = "";
+			negres = "";
+
+			msg = pr.getMsg();
+
+			if (StringUtil.isNotBlank(pr.getDisease())) {
+				disname = pr.getDisease();
+			}
+
+			if (StringUtil.isNotBlank(pr.getGender())) {
+				gender = pr.getGender();
+			}
+
+			agerange = pr.getRange();
+
+			if (null!=pr.getMinval()) {
+				minage = pr.getMinval();
+			}
+
+			if (null!=pr.getMaxval()) {
+				maxage = pr.getMaxval();
+			}
+
+			if (StringUtil.isNotBlank(pr.getResult())) {
+				psresult = pr.getResult();
+			}
+
+			if (StringUtil.isNotBlank(pr.getPostoken())) {
+				posres = pr.getPostoken();
+			}
+
+			if (StringUtil.isNotBlank(pr.getNegtoken())) {
+				negres = pr.getNegtoken();
+			}
+
+			otherPacsNeoDTO = null;
+			boolean proceed = true;
+			if (StringUtil.isNotBlank(psresult)) {
+
+				if (StringUtil.isNotBlank(disname) && proceed) {
+					if (disname.equals(diseases.get(0))) {
+					}
+					else {
+						proceed = false;
+					}
+				}
+
+				if (StringUtil.isNotBlank(gender) && proceed) {
+					if (gender.contains(pacsgender)) {
+					}
+					else {
+						proceed =false;
+					}
+				}
+
+				if (agerange==0 && proceed) {
+					if (null!=minage && null!=maxage && minage<maxage) {
+						if (age>minage && age<maxage) {
+						}
+						else {
+							proceed = false;
+						}
+					}
+				}
+				else if (agerange==1 && proceed) {
+					if (null!=minage) {
+						if (age<minage) {
+
+						}
+						else {
+							proceed =false;
+						}
+					}
+					else if (null!=maxage) {
+						if (age > maxage) {
+
+						}
+						else {
+							proceed = false;
+						}
+					}
+				}
+
+
+				if (pacsresult.get(0).contains(psresult)) {
+
+				}
+				else {
+					proceed = false;
+				}
+
+				if (StringUtil.isNotBlank(posres)) {
+					if (pacsresult.get(0).contains(posres)) {
+
+					} else {
+						proceed = false;
+					}
+				}
+
+				if (StringUtil.isNotBlank(negres)) {
+					if (!pacsresult.get(0).contains(negres)) {
+
+					} else {
+						proceed = false;
+					}
+				}
+
+			}
+
+			if (proceed) {
+				if (null==otherPacsNeoDTO) {
+					otherPacsNeoDTO = new OtherTipPacsNeoDTO();
+				}
+				otherPacsNeoDTO.setMsg(msg);
+				otherPacsNeoDTOs.add(otherPacsNeoDTO);
+			}
+		}
+
+
+
+		return otherPacsNeoDTOs;
+	}
+
+
+	/**
+	 * 获取建议输血提醒列表
+	 */
+	public List<OtherTipPacsNeoDTO> getPacsReminds(WordCrfDTO wordCrfDTO, PacsRemindRepository pacsRemindRepository) {
+
+		List<OtherTipPacsNeoDTO> tpNeoDTOs = new ArrayList<>();
+
+
+		List<PacsRemind> prlist;
+
+		prlist = pacsRemindRepository.findByNameContaining("");
+
+		if (ListUtil.isNotEmpty(prlist)) {
+			tpNeoDTOs = getReminds(prlist, wordCrfDTO);
+		}
+
+		return tpNeoDTOs;
+	}
+}
+

+ 16 - 0
src/main/java/com/diagbot/repository/PacsRemindRepository.java

@@ -0,0 +1,16 @@
+package com.diagbot.repository;
+
+import com.diagbot.entity.node.PacsRemind;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+
+import java.util.List;
+
+
+public interface PacsRemindRepository extends Neo4jRepository<PacsRemind, Long> {
+
+    List<PacsRemind> findByNameIs(String name);
+
+    List<PacsRemind> findByNameContaining(String name);
+
+}
+