Browse Source

开单合理性维护

zhaops 4 years ago
parent
commit
354ac14b59

+ 2 - 0
src/main/java/com/diagbot/entity/node/Indication.java

@@ -14,6 +14,8 @@ import org.springframework.data.neo4j.annotation.QueryResult;
 @QueryResult
 public class Indication {
     private String ruleName;
+    private String ruleType;
+    private Integer type;
     private Long conceptId;
     private Long relationId;
     private Long conditionId;

+ 20 - 0
src/main/java/com/diagbot/entity/node/IndicationConcept.java

@@ -0,0 +1,20 @@
+package com.diagbot.entity.node;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.data.neo4j.annotation.QueryResult;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/19 13:26
+ */
+@Getter
+@Setter
+@QueryResult
+public class IndicationConcept {
+    private Long id;
+    private String name;
+    private Long status;
+    private String conceptLabel;
+}

+ 35 - 9
src/main/java/com/diagbot/facade/IndicationManFacade.java

@@ -2,10 +2,12 @@ package com.diagbot.facade;
 
 import com.diagbot.dto.DictionaryInfoDTO;
 import com.diagbot.entity.node.Indication;
+import com.diagbot.entity.node.IndicationConcept;
 import com.diagbot.entity.node.IndicationCondition;
 import com.diagbot.repository.IndicationRepository;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
+import com.diagbot.vo.ConceptIndexVO;
 import com.diagbot.vo.ConditionIndexVO;
 import com.diagbot.vo.IndicationPageVO;
 import com.google.common.collect.Lists;
@@ -48,12 +50,12 @@ public class IndicationManFacade {
         if (ListUtil.isNotEmpty(indicationPageVO.getTypes())) {
             for (Integer type : indicationPageVO.getTypes()) {
                 if (dicIndicationManTypeMap.containsKey(type.toString())
-                        && dicTypeConvertMap.containsKey(dicIndicationManTypeMap.containsKey(type.toString()))) {
+                        && dicTypeConvertMap.containsKey(dicIndicationManTypeMap.get(type.toString()))) {
                     labels.add(dicTypeConvertMap.get(dicIndicationManTypeMap.get(type.toString())));
                 }
             }
         }
-
+        indicationPageVO.setLabels(labels);
         Pageable pageable = PageRequest.of(indicationPageVO.getNumber(), indicationPageVO.getSize());
         Page<Indication> page = indicationRepository.getPage(indicationPageVO.getLabels(),
                 indicationPageVO.getConceptName(),
@@ -70,9 +72,6 @@ public class IndicationManFacade {
      * @return
      */
     public List<IndicationCondition> conditionIndex(ConditionIndexVO conditionIndexVO) {
-        //TODO 输血单独处理
-
-
         List<DictionaryInfoDTO> dicTypeConvert = dictionaryFacade.getListByGroupType(8);
         List<DictionaryInfoDTO> dicIndicationManType = dictionaryFacade.getListByGroupType(11);
         Map<String, String> dicTypeConvertMap
@@ -80,7 +79,7 @@ public class IndicationManFacade {
         Map<String, String> dicIndicationManTypeMap
                 = EntityUtil.makeMapWithKeyValue(dicIndicationManType, "val", "name");
         if (dicIndicationManTypeMap.containsKey(conditionIndexVO.getType().toString())
-                && dicTypeConvertMap.containsKey(dicIndicationManTypeMap.containsKey(conditionIndexVO.getType().toString()))) {
+                && dicTypeConvertMap.containsKey(dicIndicationManTypeMap.get(conditionIndexVO.getType().toString()))) {
             conditionIndexVO.setConceptLabel(dicTypeConvertMap.get(dicIndicationManTypeMap.get(conditionIndexVO.getType().toString())));
         }
         List<String> relationTypes = indicationRepository.getRelationTypes(conditionIndexVO.getConceptLabel());
@@ -88,9 +87,9 @@ public class IndicationManFacade {
         //条件明细筛选范围
         if (ListUtil.isNotEmpty(relationTypes)) {
             for (String relationType : relationTypes) {
-                String[] splitArr = relationType.split("禁忌");
-                if (splitArr != null && splitArr.length > 1) {
-                    conditionLabels.add(splitArr[splitArr.length - 1]);
+                int index = relationType.indexOf("禁忌");
+                if (index > 0) {
+                    conditionLabels.add(relationType.substring(index + 2));
                 }
             }
         }
@@ -109,4 +108,31 @@ public class IndicationManFacade {
 
         return conditions;
     }
+
+    /**
+     * 开单项检索
+     *
+     * @param conceptIndexVO
+     * @return
+     */
+    public List<IndicationConcept> conceptIndex(ConceptIndexVO conceptIndexVO) {
+        List<String> conceptLabels = Lists.newArrayList();
+        List<DictionaryInfoDTO> dicTypeConvert = dictionaryFacade.getListByGroupType(8);
+        List<DictionaryInfoDTO> dicIndicationManType = dictionaryFacade.getListByGroupType(11);
+        Map<String, String> dicTypeConvertMap
+                = EntityUtil.makeMapWithKeyValue(dicTypeConvert, "name", "val");
+        Map<String, String> dicIndicationManTypeMap
+                = EntityUtil.makeMapWithKeyValue(dicIndicationManType, "val", "name");
+        if (dicIndicationManTypeMap.containsKey(conceptIndexVO.getType().toString())
+                && dicTypeConvertMap.containsKey(dicIndicationManTypeMap.get(conceptIndexVO.getType().toString()))) {
+            conceptIndexVO.setConceptLabel(dicTypeConvertMap.get(dicIndicationManTypeMap.get(conceptIndexVO.getType().toString())));
+            conceptLabels.add(conceptIndexVO.getConceptLabel());
+        }
+        List<IndicationConcept> concepts = indicationRepository.conceptIndex(conceptLabels,
+                conceptIndexVO.getConceptName(),
+                conceptIndexVO.getConceptName(),
+                100);
+
+        return concepts;
+    }
 }

+ 30 - 1
src/main/java/com/diagbot/repository/IndicationRepository.java

@@ -1,6 +1,7 @@
 package com.diagbot.repository;
 
 import com.diagbot.entity.node.Indication;
+import com.diagbot.entity.node.IndicationConcept;
 import com.diagbot.entity.node.IndicationCondition;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
@@ -26,7 +27,14 @@ public interface IndicationRepository extends Neo4jRepository<Indication,Long> {
             "and type(r) contains('禁忌') \n" +
             "and m.状态=1 \n" +
             "and n.状态=1 \n" +
-            "return n.name + '开单' + m.name as ruleName, \n" +
+            "return n.name + '开单' + m.name as ruleName, r.规则类型 as ruleType,\n" +
+            "case labels(m)[0] " +
+            "when '实验室检查套餐名' then 1 " +
+            "when '辅助检查名称' then 2 " +
+            "when '辅助检查子项目名称' then 3 " +
+            "when '医保手术和操作名称' then 4 " +
+            "when '药品注册名称' then 5 " +
+            "end as type," +
             "id(m) as conceptId,m.name as conceptName,labels(m)[0] as conceptType,\n" +
             "id(r) as relationId,type(r) as relationName,r.状态 as relationStatus, \n" +
             "id(n) as conditionId,n.name as conditionName,labels(n)[0] as conditionType  \n" +
@@ -84,4 +92,25 @@ public interface IndicationRepository extends Neo4jRepository<Indication,Long> {
             "and type(r) contains '禁忌' \n" +
             "return ID(n) as id, n.name as name,n.状态 as status,labels(n)[0] as conditionLabel \n")
     List<IndicationCondition> getNotInConditions(@Param("conceptName") String conceptName, @Param("conceptLabel") String conceptLabel);
+
+    @Query("MATCH (n) \n" +
+            "WHERE (toLower(n.`name`) = toLower($name) OR toLower(n.`拼音编码`) = toLower($pycode))  \n" +
+            "AND labels(n)[0] in {labels}  \n" +
+            "RETURN ID(n) as id, n.name as name,n.状态 as status,labels(n)[0] as conceptLabel \n" +
+            "union \n" +
+            "MATCH (n) \n " +
+            "WHERE (toLower(n.`name`) starts with toLower($name) OR toLower(n.`拼音编码`) starts with toLower($pycode)) \n " +
+            "AND labels(n)[0] in {labels}  \n" +
+            "WITH n SKIP 0 LIMIT $size \n" +
+            "RETURN ID(n) as id, n.name as name,n.状态 as status,labels(n)[0] as conceptLabel  \n" +
+            "union \n" +
+            "MATCH (n) \n" +
+            "WHERE (toLower(n.`name`) CONTAINS toLower($name) OR toLower(n.`拼音编码`) CONTAINS toLower($pycode))  \n" +
+            "AND labels(n)[0] in {labels}  \n" +
+            "WITH n SKIP 0 LIMIT $size \n" +
+            "RETURN ID(n) as id, n.name as name,n.状态 as status,labels(n)[0] as conceptLabel \n")
+    List<IndicationConcept> conceptIndex(@Param("labels") List<String> labels,
+                                         @Param("name") String name,
+                                         @Param("pycode") String pycode,
+                                         @Param("size") Integer size);
 }

+ 23 - 0
src/main/java/com/diagbot/vo/ConceptIndexVO.java

@@ -0,0 +1,23 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/19 13:22
+ */
+@Getter
+@Setter
+public class ConceptIndexVO {
+    @NotBlank(message = "请选择开单项类型")
+    private Integer type;
+    @ApiModelProperty(hidden = true)
+    private String conceptLabel;
+    @NotBlank(message = "请选择开单项")
+    private String conceptName;
+}

+ 2 - 0
src/main/java/com/diagbot/vo/IndicationPageVO.java

@@ -1,5 +1,6 @@
 package com.diagbot.vo;
 
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -16,6 +17,7 @@ public class IndicationPageVO {
     private List<Integer> types;
     private int number = 0;
     private int size = 10;
+    @ApiModelProperty(hidden = true)
     private List<String> labels;
     private String conceptName;
     private String conditionName;

+ 13 - 2
src/main/java/com/diagbot/web/IndicationManController.java

@@ -2,8 +2,10 @@ package com.diagbot.web;
 
 import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.node.Indication;
+import com.diagbot.entity.node.IndicationConcept;
 import com.diagbot.entity.node.IndicationCondition;
 import com.diagbot.facade.IndicationManFacade;
+import com.diagbot.vo.ConceptIndexVO;
 import com.diagbot.vo.ConditionIndexVO;
 import com.diagbot.vo.IndicationPageVO;
 import io.swagger.annotations.Api;
@@ -33,7 +35,7 @@ public class IndicationManController {
     @ApiOperation(value = "获取开单合理项列表[zhaops]",
             notes = "number:页码<br>" +
                     "size:每页条目数<br>" +
-                    "types:术语类型(多选)1-检验、2-检查、3-检查子项、4-手术和操作、5-药品、6-输血<br>" +
+                    "types:术语类型(多选)1-检验套餐、2-检查、3-检查子项、4-手术和操作、5-药品注册名<br>" +
                     "conceptName:术语名称(模糊匹配)<br>" +
                     "conditionName:条件明细(模糊匹配)<br>" +
                     "relationStatus:启用禁用标志(0-禁用,1-启用)<br>")
@@ -44,7 +46,7 @@ public class IndicationManController {
     }
 
     @ApiOperation(value = "条件明细检索[zhaops]",
-            notes = "type:开单类型(1-检验、2-检查、3-检查子项、4-手术和操作、5-药品、6-输血)<br>" +
+            notes = "type:开单类型(1-检验套餐、2-检查、3-检查子项、4-手术和操作、5-药品注册名)<br>" +
                     "conceptName:开单项<br>" +
                     "ruleType:规则类型:文本类型、数值类型<br>" +
                     "conditionName:条件明细(模糊匹配)<br>")
@@ -53,4 +55,13 @@ public class IndicationManController {
         List<IndicationCondition> data = indicationManFacade.conditionIndex(conditionIndexVO);
         return RespDTO.onSuc(data);
     }
+
+    @ApiOperation(value = "开单项检索[zhaops]",
+            notes = "type:开单类型(1-检验套餐、2-检查、3-检查子项、4-手术和操作、5-药品注册名)<br>" +
+                    "conceptName:开单项(模糊匹配)<br>")
+    @PostMapping("/conceptIndex")
+    public RespDTO<IndicationConcept> conceptIndex(@RequestBody ConceptIndexVO conceptIndexVO) {
+        List<IndicationConcept> data = indicationManFacade.conceptIndex(conceptIndexVO);
+        return RespDTO.onSuc(data);
+    }
 }