1178232204@qq.com 3 سال پیش
والد
کامیت
55c8c243be
2فایلهای تغییر یافته به همراه293 افزوده شده و 8 حذف شده
  1. 292 8
      src/components/knowledgeExtra/AddNewRule.vue
  2. 1 0
      src/components/knowledgeExtra/RuleManager.vue

+ 292 - 8
src/components/knowledgeExtra/AddNewRule.vue

@@ -260,7 +260,9 @@ export default {
         parLenCode: '',
         klRuleByIdSub: []
       },
-      rules: formRules
+      rules: formRules,
+      dragVal: null,
+      dragArr: null
     };
   },
   created() {
@@ -335,12 +337,66 @@ export default {
 
         // disable
         if (this.form.parHasSub && this.firstPlace) {
+          const del =
+            localStorage
+              .getItem('zskDelDict')
+              .match(
+                new RegExp(this.firstPlace.checkedType + '-\\d+' + '-\\d+', 'g')
+              ) || [];
           if (arr[i - 1] && arr[i - 1].groupId == item.groupId) {
             this.$set(item, 'disabled', false);
+            if (del.length > 0 && item.subType == del[0].split('-')[2]) {
+              const delType = del[0].split('-');
+              const types = del[0].split('-');
+              let baseTypeList = JSON.parse(JSON.stringify(this.baseTypeList));
+              const subobj = this.baseTypeList.find(it => it.type == types[2]);
+              const screenArr = subobj.subMenuList.filter(item => {
+                return !types[3].includes(item.code);
+              });
+              this.$set(item, 'baseTermTypeList', screenArr);
+            }
           } else {
             this.$set(item, 'disabled', true);
           }
         }
+        const dragDel =
+          localStorage
+            .getItem('zskDragDict')
+            .match(new RegExp(this.ruleTermCodeStrs, 'g')) || [];
+        //药品开单合理判断
+        if (dragDel.length > 0) {
+          const obj = this.baseTypeList.find(it => it.type === 1);
+          if (arr[i - 1] && arr[i - 1].groupId == item.groupId) {
+            if (i == 2) {
+              //获取互斥项code
+              const list = obj.subMenuList.filter(it => {
+                return (
+                  it.code == arr[i - 1].subLenCode &&
+                  it.remark.split('|')[0] == 3
+                );
+              });
+              const dragArr = list[0].remark.split('|')[1].split(',');
+              this.dragArr = dragArr;
+              this.dragVal = item.subLenCode;
+              //取出互斥项
+              const screenArr = obj.subMenuList.filter(item =>
+                dragArr.some(
+                  ele => ele === item.code && item.remark.split('|')[0] == 3
+                )
+              );
+              this.$set(item, 'baseTermTypeList', screenArr);
+            } else {
+              const screenArr = obj.subMenuList.filter(item => {
+                if (item.remark == '') {
+                  return item;
+                } else {
+                  return item.remark.split('|')[0] == i + 1;
+                }
+              });
+              this.$set(item, 'baseTermTypeList', screenArr);
+            }
+          }
+        }
       });
     },
     // 提交
@@ -421,11 +477,45 @@ export default {
               .getItem('zskDicts')
               .match(new RegExp(this.firstPlace.checkedType + '-\\d+', 'g')) ||
             [];
+          const del =
+            localStorage
+              .getItem('zskDelDict')
+              .match(
+                new RegExp(this.firstPlace.checkedType + '-\\d+' + '-\\d+', 'g')
+              ) || [];
           const types = dict[0].split('-');
           let obj = this.form.klRuleByIdSub;
           obj.forEach((item, i, arr) => {
             if (arr[i - 1] && arr[i - 1].groupId == item.groupId) {
               this.$set(item, 'disabled', false);
+              if (del.length > 0) {
+                const delType = del[0].split('-');
+                if (
+                  item.subType == delType[2] ||
+                  item.subLenCode == delType[3]
+                ) {
+                  this.$set(this.form.klRuleByIdSub, i, {
+                    groupId: item.groupId,
+                    groupChildId: 'child' + new Date().valueOf(),
+                    baseTypes: this.baseTypeList,
+                    baseTermTypeList: [],
+                    conceptList: [],
+                    subDescription: '',
+                    parRuleType: '',
+                    subConceptId: '',
+                    subType: '',
+                    subMaxOperator: '',
+                    subMaxUnit: '',
+                    subMaxValue: '',
+                    subMinOperator: '',
+                    subMinUnit: '',
+                    subMinValue: '',
+                    subEqValue: '',
+                    subLenCode: '',
+                    dataType: ''
+                  });
+                }
+              }
             } else {
               this.$set(item, 'disabled', true);
               this.$set(item, 'subType', parseInt(types[2]));
@@ -493,12 +583,73 @@ export default {
     // 基础规则类型切换
     subTypeChange(val, index) {
       // index
+      const dragDel =
+        localStorage
+          .getItem('zskDragDict')
+          .match(new RegExp(this.ruleTermCodeStrs, 'g')) || [];
       const obj = this.baseTypeList.find(it => it.type === val);
+      let dragType = false;
+      let isDel = false;
+      let screenArr;
+      //药品开单合理判断
+      if (dragDel.length > 0) {
+        dragType = true;
+        const types = dragDel[0].split('-');
+        if (this.dragArr && index > 0) {
+          //获取互斥项code
+          const list = obj.subMenuList.filter(it => {
+            return it.code == this.dragVal && it.remark.split('|')[0] == 3;
+          });
+          const dragArr = list[0].remark.split('|')[1].split(',');
+          this.dragArr = dragArr;
+          //取出互斥项
+          screenArr = obj.subMenuList.filter(item =>
+            dragArr.some(
+              ele => ele === item.code && item.remark.split('|')[0] == 3
+            )
+          );
+        } else {
+          screenArr = obj.subMenuList.filter(item => {
+            if (item.remark == '') {
+              return item;
+            } else {
+              return item.remark.split('|')[0] == index + 1;
+            }
+          });
+        }
+        let klRuleByIdSub = this.form.klRuleByIdSub;
+        klRuleByIdSub.forEach((item, i, arr) => {
+          if (arr[0].subType == 1) {
+            const arr = this.baseTypeList.filter(it => {
+              return it.type == 1;
+            });
+            this.$set(item, 'baseTypes', arr);
+          }
+        });
+      }
+      //危急值实验室子项目已选医学标准术语判断
+      if (this.form.parHasSub && this.firstPlace) {
+        const del =
+          localStorage
+            .getItem('zskDelDict')
+            .match(
+              new RegExp(this.firstPlace.checkedType + '-\\d+' + '-\\d+', 'g')
+            ) || [];
+        if (del.length > 0) {
+          isDel = true;
+          const types = del[0].split('-');
+          let baseTypeList = JSON.parse(JSON.stringify(this.baseTypeList));
+          const subobj = this.baseTypeList.find(it => it.type == types[2]);
+          screenArr = subobj.subMenuList.filter(item => {
+            return !types[3].includes(item.code);
+          });
+        }
+      }
 
       this.$set(
         this.form.klRuleByIdSub[index],
         'baseTermTypeList',
-        obj.subMenuList
+        (isDel && val == 2) || dragType ? screenArr : obj.subMenuList
       );
       this.$set(this.form.klRuleByIdSub[index], 'subLenCode', '');
       this.$set(this.form.klRuleByIdSub[index], 'dataType', '');
@@ -532,6 +683,7 @@ export default {
        *    arg:{index:添加规则用索引,groupId:添加分组用确切id}
        */
       !date && (date = new Date().valueOf());
+
       const obj = {
         groupId: date,
         groupChildId: 'child' + new Date().valueOf(),
@@ -555,6 +707,21 @@ export default {
       if (typeof arg.index == 'number') {
         // 添加规则 直接在当前位置之后添加
         this.form.klRuleByIdSub.splice(arg.index + 1, 0, obj);
+        const dragDel =
+          localStorage
+            .getItem('zskDragDict')
+            .match(new RegExp(this.ruleTermCodeStrs, 'g')) || [];
+        if (dragDel.length > 0) {
+          let obj = this.form.klRuleByIdSub;
+          obj.forEach((item, i, arr) => {
+            if (arr[0].subType == 1) {
+              const arr = this.baseTypeList.filter(it => {
+                return it.type == 1;
+              });
+              this.$set(item, 'baseTypes', arr);
+            }
+          });
+        }
       } else {
         // 添加分组 在列表中相同groupId之后添加
 
@@ -597,10 +764,52 @@ export default {
       this.form.klRuleByIdSub = list;
     },
     // 删除规则
-    delGroupChild(groupChildId) {
-      const newGroupList = this.form.klRuleByIdSub.filter(
-        item => item.groupChildId != groupChildId
-      );
+    delGroupChild(groupChildId, index) {
+      let newGroupList;
+      const dragDel =
+        localStorage
+          .getItem('zskDragDict')
+          .match(new RegExp(this.ruleTermCodeStrs, 'g')) || [];
+      let list;
+      if (dragDel.length > 0) {
+        if (index == 0) {
+          const date = new Date().valueOf();
+          newGroupList = [
+            {
+              groupId: date,
+              groupChildId: 'child' + new Date().valueOf(),
+              baseTypes: this.baseTypeList,
+              baseTermTypeList: [],
+              conceptList: [],
+              subDescription: '',
+              parRuleType: '',
+              subConceptId: '',
+              subType: '',
+              subMaxOperator: '',
+              subMaxUnit: '',
+              subMaxValue: '',
+              subMinOperator: '',
+              subMinUnit: '',
+              subMinValue: '',
+              subEqValue: '',
+              subLenCode: '',
+              dataType: ''
+            }
+          ];
+        } else if (index == 0 || index == 1) {
+          newGroupList = this.form.klRuleByIdSub.filter((item, i) => {
+            return i == 0;
+          });
+        } else {
+          newGroupList = this.form.klRuleByIdSub.filter(
+            item => item.groupChildId != groupChildId
+          );
+        }
+      } else {
+        newGroupList = this.form.klRuleByIdSub.filter(
+          item => item.groupChildId != groupChildId
+        );
+      }
       this.form.klRuleByIdSub = newGroupList;
     },
     setDict() {
@@ -622,7 +831,7 @@ export default {
       const param = {
         excludedConceptIds: [this.form.parRuleType],
         libType: this.form.parLenCode,
-        name: val,
+        name: val
       };
       api
         .searchConcept(param)
@@ -667,7 +876,6 @@ export default {
     },
     childClearNumText(index) {
       let obj = JSON.parse(JSON.stringify(this.form.klRuleByIdSub));
-
       obj[index].subMaxOperator = '';
       obj[index].subMaxValue = '';
       obj[index].subMaxUnit = '';
@@ -698,6 +906,75 @@ export default {
       });
     },
     childSubCodeChange(val, index, numTypes) {
+      const dragDel =
+        localStorage
+          .getItem('zskDragDict')
+          .match(new RegExp(this.ruleTermCodeStrs, 'g')) || [];
+      const inx = index == 1 ? index + 1 : index == 2 ? index - 1 : index;
+      const subobj = this.baseTypeList.find(it => it.type == 1);
+      let obj = this.form.klRuleByIdSub;
+      const mutex = obj.some((item, i, arr) => {
+        return item.subLenCode == '';
+      });
+      //判断药品合理性总条数是否大于1条,是否存在第二条或第三条类型为1,存在触发互斥
+      if (
+        //判断3条规则是否都已选中
+        dragDel.length > 0 &&
+        index > 0 &&
+        this.form.klRuleByIdSub.length > 1 &&
+        this.form.klRuleByIdSub[0].subType == 1
+      ) {
+        if (this.form.klRuleByIdSub.length == 3 && !mutex) {
+          //判断是否存在符合互斥条件的两条出具,若存在,置空另一条出具
+          if (this.dragArr.indexOf(this.dragVal) > -1) {
+            //剂型给药途径互斥判断
+            const arr = this.baseTypeList.filter(it => {
+              return it.type == 1;
+            });
+            this.$set(this.form.klRuleByIdSub, inx, {
+              groupId: this.form.klRuleByIdSub[inx].groupId,
+              groupChildId: 'child' + new Date().valueOf(),
+              baseTypes: arr,
+              baseTermTypeList: [],
+              conceptList: [],
+              subDescription: '',
+              parRuleType: '',
+              subConceptId: '',
+              subType: '',
+              subMaxOperator: '',
+              subMaxUnit: '',
+              subMaxValue: '',
+              subMinOperator: '',
+              subMinUnit: '',
+              subMinValue: '',
+              subEqValue: '',
+              subLenCode: '',
+              dataType: ''
+            });
+          }
+        } else {
+          const list = subobj.subMenuList.filter(it => {
+            return it.code == val && it.remark.split('|')[0] == 3;
+          });
+          //获取互斥项code
+          const dragArr = list[0].remark.split('|')[1].split(',');
+          this.dragArr = dragArr;
+          //获取互斥项
+          const screenArr = subobj.subMenuList.filter(item =>
+            dragArr.some(
+              ele => ele === item.code && item.remark.split('|')[0] == 3
+            )
+          );
+          if (this.form.klRuleByIdSub[inx]) {
+            this.$set(
+              this.form.klRuleByIdSub[inx],
+              'baseTermTypeList',
+              screenArr
+            );
+          }
+        }
+        this.dragVal = val;
+      }
       if ((numTypes + ',').indexOf(val + ',') > -1) {
         this.$set(this.form.klRuleByIdSub[index], 'dataType', '1');
       } else {
@@ -705,6 +982,13 @@ export default {
       }
       this.childClearConcept(index);
       this.childClearNumText(index);
+    },
+    // 去重
+    unique(arr, obj) {
+      return arr.reduce((cur, next) => {
+        obj[next] ? '' : (obj[next] = true && cur.push(next));
+        return cur;
+      }, []);
     }
   },
   watch: {

+ 1 - 0
src/components/knowledgeExtra/RuleManager.vue

@@ -214,6 +214,7 @@ export default {
             );
             localStorage.setItem('zskNumDict', data['22'][0].val);
             localStorage.setItem('zskSubDict', (data['23'].map(it => it.val) || []).join(','));
+            localStorage.setItem('zskDelDict', data['26'][0].val);
           }
         })
         .catch(error => {