Przeglądaj źródła

解决转方导致超剂量药品未判断导致无法正常显示

cc12458 1 rok temu
rodzic
commit
8fb98fe9ed
1 zmienionych plików z 16 dodań i 34 usunięć
  1. 16 34
      src/views/diagnosis/Prescribing.vue

+ 16 - 34
src/views/diagnosis/Prescribing.vue

@@ -3558,7 +3558,6 @@ export default {
       }, {title: `中药处方${index + 1}`});
     },
     async getRationalMed(id) {
-      let ids = [];
       // this.rationalMed = []
       let children = this.$children.filter(item => {
         return (
@@ -3568,21 +3567,9 @@ export default {
         );
       });
       let child = children[0];
-
-      child.recipe_tabs[child.recipe_tabs_c].totalTableD.forEach(item => {
-        if (item.name) {
-          ids.push(item.medid);
-        }
-      });
-
-      let idsIndex = 0;
-      ids.forEach((item, index) => {
-        if (item == id) {
-          idsIndex = index;
-        }
-      });
-
-      ids.splice(idsIndex, 1);
+      const medicines = child.recipe_tabs[child.recipe_tabs_c].totalTableD || [];
+      const medicine = medicines.find(medicine => medicine.medid === id);
+      const ids = medicines.filter(medicine => medicine.name && medicine.medid !== id).map(medicine => medicine.medid);
       // this.rationalMed = []
       let res = await getRationalMed({
         matID: id,
@@ -3592,7 +3579,7 @@ export default {
       if (res.code == 0 && res.message) {
         res.data.reqID = id;
 
-        this.rationalMed.push(res.data);
+        this.rationalMed.push(Object.assign(res.data, {__medicine__: medicine}));
         // 去重
         const removeRepeat = (arr, key) => {
           let obj = {};
@@ -3678,6 +3665,10 @@ export default {
         }
 
         if (item.matmaxdosage && item.matmindosage) {
+          try {
+            const dose = +item.__medicine__.dose;
+            if (dose && (dose < item.matmindosage || dose > item.matmaxdosage)) item.showDose = true;
+          } catch (e) {}
           this.rationalMed10.push(item);
         }
       });
@@ -3695,7 +3686,6 @@ export default {
     },
     // 获取合理用药信息 平台
     async getRationalMedForPlat(id) {
-      let ids = [];
       this.rationalMed = [];
       let children = this.$children.filter(item => {
         return (
@@ -3705,21 +3695,9 @@ export default {
         );
       });
       let child = children[0];
-
-      child.recipe_tabs[child.recipe_tabs_c].totalTableD.forEach(item => {
-        if (item.name) {
-          ids.push(item.medid);
-        }
-      });
-
-      let idsIndex = 0;
-      ids.forEach((item, index) => {
-        if (item == id) {
-          idsIndex = index;
-        }
-      });
-
-      ids.splice(idsIndex, 1);
+      const medicines = child.recipe_tabs[child.recipe_tabs_c].totalTableD || [];
+      const medicine = medicines.find(medicine => medicine.medid === id);
+      const ids = medicines.filter(medicine => medicine.name && medicine.medid !== id).map(medicine => medicine.medid);
 
       let res = await getRationalMedForPlat({
         matID: id,
@@ -3729,7 +3707,7 @@ export default {
       if (res.code == 0 && res.message) {
         res.data.reqID = id;
 
-        this.rationalMed.push(res.data);
+        this.rationalMed.push(Object.assign(res.data, {__medicine__: medicine}));
 
         // 去重
         const removeRepeat = (arr, key) => {
@@ -3791,6 +3769,10 @@ export default {
           }
 
           if (item.matmaxdosage && item.matmindosage) {
+            try {
+              const dose = +item.__medicine__.dose;
+              if (dose < item.matmindosage || dose > item.matmaxdosage) item.showDose = true;
+            } catch (e) {}
             this.rationalMed10.push(item);
           }
         });