Просмотр исходного кода

中药制剂添加换方方法

cc12458 8 месяцев назад
Родитель
Сommit
f5498b99df
2 измененных файлов с 71 добавлено и 9 удалено
  1. 3 3
      src/components/MedicineAndChina.vue
  2. 68 6
      src/views/diagnosis/Prescribing.vue

+ 3 - 3
src/components/MedicineAndChina.vue

@@ -848,10 +848,10 @@ export default {
         id: scope.row.id,
         name: item.ypmc,
         spec: item.gg, // 规格
-        timesQuan: item.timesQuan || "", // 次用量
-        timesUnit: item.timesUnit || "", // 次用量单位
+        timesQuan: item.timesQuan || item.ycjl || "", // 次用量
+        timesUnit: item.timesUnit || item.ycjldw || "", // 次用量单位
         dose: scope.row.color === "red" || oneself ? null : "", // 剂量 数量
-        doseUnit: item.doseUnit || '', // 数量单位
+        doseUnit: item.doseUnit || item.jldw || '', // 数量单位
         unit: item.dw, // 单位
         // unit: item.bzdw, // 单位
         // usage: item.usagestr, // 用法

+ 68 - 6
src/views/diagnosis/Prescribing.vue

@@ -3937,12 +3937,7 @@ export default {
                 }
               }));
               this.setRecipeId('');
-
-              const child = this.$children.find(item => item.name === "中药制剂");
-              child.tableData3 = this.getDrugInfo.map(item => ({...item}));
-              child.changePharmacy();
-
-              console.log(child.tableData3, 'log:切换');
+              this.changeAndJoinZJ();
 
               if (type == 3)  this.isTuiDaoZj = true;
             }
@@ -4294,6 +4289,73 @@ export default {
         // 适宜技术处方
       }
     },
+    async changeAndJoinZJ(type = 1) {
+      const child = this.$children.find(item => item.name === '中药制剂');
+      const drugs = this.getDrugInfo;
+      const recipeId = +type === 1 ? this.getRecipeId : '';
+      this.setRecipeId('');
+      this.tjRecipeId = recipeId;
+      const [pharmacyID, val] = child.recipe.radio.split('@');
+      const drugIds = drugs.filter(item => item.name).map(item => `${item.medid}&${item.doce || ''}&${item.usage || ''}`);
+      const loading = this.$loading({
+        lock: true,
+        text: '正在处理药品数据,请稍等',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)',
+      });
+      try {
+        const data = await changeAndJoin({ pharmacyid: pharmacyID, type: val, drugIds }).then(res => {
+          if (+res.ResultCode === 0) return res.Data
+          else throw res
+        });
+        const medicines = data.map(item => {
+          if (typeof item === 'string') {
+            const item1 = drugs.find(item1 => item1.medid === item);
+            return item1 ? { ...item1, color: 'red' } : void 0;
+          } else if (item && typeof item === 'object') {
+            const obj = {
+              color: item.kc == 0 ? "red" : "#000",
+              name: item.ypmc,
+              spec: item.gg, // 规格
+              timesQuan: item.timesQuan || item.ycjl || "", // 次用量
+              timesUnit: item.timesUnit || item.ycjldw || "", // 次用量单位
+              dose: item.dose, // 剂量 数量
+              doseUnit: item.doseUnit || item.jldw || '', // 数量单位
+              unit: item.dw, // 单位
+              // unit: item.bzdw, // 单位
+              // usage: item.usagestr, // 用法
+              usage: item.usage || "",
+              // price: item.lsjg,
+              price: item.price,
+              total: 0,
+              inventory: item.kc, // 库存
+              key: "",
+              search_i: 0,
+              medid: item.pid, // 药品id
+              showSearch: false,
+              originname: item.cdmc // 产地名称
+            };
+            return obj;
+          }
+        }).filter(Boolean);
+        if (type === 1) {
+          medicines.push({
+            search_i: 0,
+            key: "",
+            page: 1,
+            drugList: [],
+            usageList: [],
+            numList: [],
+            timeList: [],
+            loadMore: true
+          });
+          child.tableData3 = medicines;
+        }
+      } catch (e) {
+        console.log(e);
+      }
+      loading.close();
+    },
     // 跟据就诊记录id 获取就诊记录详细信息
     async getSeeDByID(id) {
       let params = {