浏览代码

开单合理项维护

zhaops 4 年之前
父节点
当前提交
7663a398a8

+ 40 - 0
src/main/java/com/diagbot/facade/BillManFacade.java

@@ -128,6 +128,15 @@ public class BillManFacade {
                 billPageVO.getConditionName(),
                 billPageVO.getRelationStatus(),
                 pageable);
+
+        if(ListUtil.isNotEmpty(page.getContent())) {
+            for (BillItem record : page.getContent()) {
+                int index = record.getConditionName().indexOf("禁忌");
+                if (index > 0) {
+                    record.setConditionName(record.getConditionName().substring(index + 2));
+                }
+            }
+        }
         return page;
     }
 
@@ -255,6 +264,11 @@ public class BillManFacade {
                 billCondition.setRange(0);
             }
 
+            int index = billCondition.getName().indexOf("禁忌");
+            if (index > 0) {
+                billCondition.setName(billCondition.getName().substring(index + 2));
+            }
+
             if (dicTypeConvertMap.containsKey(billItem.getConceptLabel())
                     && dicIndicationManTypeMap.containsKey(dicTypeConvertMap.get(billItem.getConceptLabel()))) {
                 billSaveVO.setType(Integer.valueOf(dicIndicationManTypeMap.get(dicTypeConvertMap.get(billItem.getConceptLabel()))));
@@ -277,6 +291,16 @@ public class BillManFacade {
      * @return
      */
     public Boolean saveRecord(BillSaveVO billSaveVO) {
+        List<DictionaryInfoDTO> dicTypeConvert = dictionaryFacade.getListByGroupType(8);
+        List<DictionaryInfoDTO> dicIndicationManType = dictionaryFacade.getListByGroupType(11);
+        List<DictionaryInfoDTO> dicBillConditionType = dictionaryFacade.getListByGroupType(12);
+        Map<String, String> dicTypeConvertMap
+                = EntityUtil.makeMapWithKeyValue(dicTypeConvert, "name", "val");
+        Map<String, String> dicIndicationManTypeMap
+                = EntityUtil.makeMapWithKeyValue(dicIndicationManType, "val", "name");
+        Map<String, String> dicBillConditionTypeMap
+                = EntityUtil.makeMapWithKeyValue(dicBillConditionType, "name", "val");
+
         //文本类型: 开单项-[]->条件明细
         //数值类型: 开单项-[]->开单项+禁忌+条件明细
         String relationType
@@ -317,6 +341,22 @@ public class BillManFacade {
             }
         }
 
+        //条件明细筛选范围
+        List<String> conditionLabels = Lists.newArrayList();
+        List<String> relationTypes = billManRepository.getRelationTypes(concept.getConceptLabel());
+        if (ListUtil.isNotEmpty(relationTypes)) {
+            for (String item : relationTypes) {
+                int index = item.indexOf("禁忌");
+                if (index > 0 && dicBillConditionTypeMap.containsKey(item.substring(index + 2))) {
+                    conditionLabels.add(item.substring(index + 2));
+                }
+            }
+        }
+
+        if(!conditionLabels.contains(condition.getConditionLabel())){
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "开单项目与条件明细无关联");
+        }
+
         //数值类型特殊处理
         if (billSaveVO.getRuleType() != null
                 && billSaveVO.getRuleType().equals(2)) {

+ 8 - 14
src/main/java/com/diagbot/repository/BillManRepository.java

@@ -41,11 +41,7 @@ public interface BillManRepository extends Neo4jRepository<BillItemDetail,Long>
             "id(r) as relationId,type(r) as relationName,r.状态 as relationStatus, \n" +
             "id(n) as conditionId," +
             "(case labels(n)[0] " +
-            "when '体征' then n.体征指标 "+
-            "when '实验室检查' then n.实验室检查指标 "+
-            "when '禁忌人群' then n.禁忌人群指标 "+
-            "else n.name " +
-            "end )as conditionName," +
+            " n.name as conditionName," +
             "labels(n)[0] as conditionType  \n" +
             "order by id(r) desc",
             countQuery = "match(m)-[r]->(n) \n" +
@@ -73,14 +69,16 @@ public interface BillManRepository extends Neo4jRepository<BillItemDetail,Long>
 
     @Query("MATCH (n) \n" +
             "WHERE (toLower(n.`name`) = toLower($name) OR toLower(n.`拼音编码`) = toLower($pycode))  \n" +
-            "AND labels(n)[0] in {labels}  \n" +
+            //"AND labels(n)[0] in {labels}  \n" +
+            "and (n:性别 or n:实验室检查 or n:临床表现 or n:辅助检查名称描述 or n:疾病 or n:服用药品 or n:药物过敏原 or n:食物过敏原 or n:手术 or n:禁忌人群 or n:过敏原 or n:体征 or n:禁忌医疗器械及物品 or n:年龄 or n:给药途径 or n:开单项互斥) \n" +
             "AND not(exists(n.禁忌人群指标) or exists(n.实验室检查指标) or exists(n.体征指标)) \n" +
             "AND (case {notInIds} is not null and size({notInIds})>0 when true then not(id(n) in {notInIds}) else 1 = 1 end ) \n" +
             "RETURN ID(n) as id, n.name as name,n.状态 as status,labels(n)[0] as conditionLabel,n.最小值 as minValue,n.最大值 as maxValue,n.单位 as unit,n.范围 as range \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" +
+            //"AND labels(n)[0] in {labels}  \n" +
+            "and (n:性别 or n:实验室检查 or n:临床表现 or n:辅助检查名称描述 or n:疾病 or n:服用药品 or n:药物过敏原 or n:食物过敏原 or n:手术 or n:禁忌人群 or n:过敏原 or n:体征 or n:禁忌医疗器械及物品 or n:年龄 or n:给药途径 or n:开单项互斥) \n" +
             "AND not(exists(n.禁忌人群指标) or exists(n.实验室检查指标) or exists(n.体征指标)) \n" +
             "AND (case {notInIds} is not null and size({notInIds})>0 when true then not(id(n) in {notInIds}) else 1 = 1 end ) \n" +
             "WITH n SKIP 0 LIMIT $size \n" +
@@ -88,7 +86,8 @@ public interface BillManRepository extends Neo4jRepository<BillItemDetail,Long>
             "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" +
+            //"AND labels(n)[0] in {labels}  \n" +
+            "and (n:性别 or n:实验室检查 or n:临床表现 or n:辅助检查名称描述 or n:疾病 or n:服用药品 or n:药物过敏原 or n:食物过敏原 or n:手术 or n:禁忌人群 or n:过敏原 or n:体征 or n:禁忌医疗器械及物品 or n:年龄 or n:给药途径 or n:开单项互斥) \n" +
             "AND not(exists(n.禁忌人群指标) or exists(n.实验室检查指标) or exists(n.体征指标)) \n" +
             "AND (case {notInIds} is not null and size({notInIds})>0 when true then not(id(n) in {notInIds}) else 1 = 1 end ) \n" +
             "WITH n SKIP 0 LIMIT $size \n" +
@@ -151,12 +150,7 @@ public interface BillManRepository extends Neo4jRepository<BillItemDetail,Long>
             "type(r) as relationName,\n" +
             "r.状态 as relationStatus,\n" +
             "id(n) as conditionId,\n" +
-            "(case labels(n)[0] " +
-            "when '体征' then n.体征指标 "+
-            "when '实验室检查' then n.实验室检查指标 "+
-            "when '禁忌人群' then n.禁忌人群指标 "+
-            "else n.name " +
-            "end )as conditionName," +
+            " n.name as conditionName," +
             "labels(n)[0] as conditionLabel,\n" +
             "n.最小值 as conditionMinValue,\n" +
             "n.最大值 as conditionMaxValue,\n" +