Explorar el Código

[重构] 开方合理安全用药检测 移除原接口调用
/basis/knowlib/getMatInfo1
/basis/knowlib/getMatInfoByPlat1

cc12458 hace 5 meses
padre
commit
6bc9583d65
Se han modificado 2 ficheros con 4 adiciones y 462 borrados
  1. 0 75
      src/components/ChineseMedicine.vue
  2. 4 387
      src/views/diagnosis/Prescribing.vue

+ 0 - 75
src/components/ChineseMedicine.vue

@@ -973,7 +973,6 @@ import {getReasonableSafeMedicineDosageRange} from '@/request/api';
 import { addAccordData, getAccordShareList } from "@/api/business.js";
 import { getDataByKey } from "@/api/system.js";
 import accordEdit from "@/views/business/AccordEdit.vue";
-import { getRationalMed, getRationalMedForPlat } from "@/api/knowledge";
 import {
   getProver,
   getArea,
@@ -2224,80 +2223,6 @@ export default {
       this.recipe_tabs[this.recipe_tabs_c].bottom_form.area = "";
       this.getArea(e, 2);
     },
-    //  获取 合理用药数据
-    async _getRationalMed(id) {
-      let ids = [];
-      let child = this;
-      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);
-
-      let res = await getRationalMed({
-        matID: id,
-        orgId: this.getuserinfo.organizationid,
-        matIds: ids
-      });
-      if (res.code == 0 && res.message) {
-        this.maxDose = +res.data.matmaxdosage;
-        this.minDose = +res.data.matmindosage;
-        this.doseId = id;
-        // 兼容方案
-        if (this.defaultUsageMap[id] != null) {
-          try {
-            const option = this.usageList.find(item => item.value === res.data.specialUsage || item.key === res.data.specialUsage) || this.usageList[0];
-            const usage = option ? option.key : 0;
-
-            const t1 = this.recipe_tabs[this.recipe_tabs_c].tableData;
-            const t2 = this.recipe_tabs[this.recipe_tabs_c].tableData1;
-
-            const m = t1.find(t => t.medid === id) || t2.find(t => t.medid === id);
-            if (m) m.usage = usage;
-
-            this.defaultUsageMap[id].usage = usage;
-            delete this.defaultUsageMap[id];
-          } catch (e) {}
-        }
-      }
-    },
-    // 获取平台合理用药数据
-    async _getRationalMedForPlat(id) {
-      let ids = [];
-      let child = this;
-      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);
-
-      let res = await getRationalMedForPlat({
-        matID: id,
-        orgId: this.getuserinfo.organizationid,
-        matIds: ids
-      });
-      if (res.code == 0 && res.message) {
-        this.maxDose = +res.data.matmaxdosage;
-        this.minDose = +res.data.matmindosage;
-        this.doseId = id;
-      }
-    },
     //添加协定方数据
     async addAccordData(data) {
       const loading = this.$loading({

+ 4 - 387
src/views/diagnosis/Prescribing.vue

@@ -2205,7 +2205,7 @@ export default {
               id: item1.seqn,
               name: item1.drugName,
               // pid:
-              matid: item1.platformdrugid, // 知识库
+              matid: item1.platformdrugid || item1.matid, // 知识库
               matname: item1.platformdrugname, // 知识库
               spec: item1.specification, // 规格
               dose: item1.dose, // 剂量
@@ -2235,9 +2235,6 @@ export default {
           });
 
           obj.totalTableD.filter((item3, index3) => {
-            this.rationalMed = [];
-            this.resetRationalMed();
-            this.getRationalMed(item3.medid);
             return (item3.id = index3 + 1);
           });
 
@@ -2887,7 +2884,10 @@ export default {
           loadMore: true,
           usageList: [],
           id: item.seqn,
+          // pid:
           name: item.ypmc || item.drugname,
+          matid: item.platformdrugid || item.matid,
+          matname: item.platformdrugname,
           spec: item.gg || item.specification, // 规格
           dose: item.dose, // 剂量
           unit: item.dw || item.unit, // 单位
@@ -2922,9 +2922,6 @@ export default {
 
       data1.recipe_tabs[data1.recipe_tabs_c].totalTableD.filter(
         (item3, index3) => {
-          this.rationalMed = [];
-          this.resetRationalMed();
-          this.getRationalMed(item3.medid);
           return (item3.id = index3 + 1);
         }
       );
@@ -3426,359 +3423,6 @@ export default {
         }
       }
     },
-    // 获取右侧合理用药信息展示
-    async getRationalMed2(index, cb) {
-      if (typeof cb !== 'function') cb = () => void 0;
-      const child = this.$children.find(item => item.name === "中药处方");
-      if (index == null) index = child.recipe_tabs_c;
-      const gather = child.recipe_tabs[index].totalTableD.filter(item => item.name && item.medid).map(item => item.medid);
-
-      const request = (id, i, ids) => getRationalMed({
-        matID: id,
-        matIds: [...ids.slice(0, i), ...ids.slice(i + 1)],
-        orgId: this.getuserinfo.organizationid,
-      }).then(res => res.code === 0 ? Object.assign({medid: id}, res.data) : null).catch(err => null);
-      const get = (medid) => child.recipe_tabs[index].totalTableD.find(item => item.medid === medid);
-
-      const rationalMed = await Promise.all(gather.map(request)).then(data => data.filter(Boolean));
-      return rationalMed.reduce((data, item) => {
-        const color = 'blue';
-
-        if (item.matdosage && item.showDose) {
-          const ref = {}, i = 1;
-          const child = data[i] || (data[i] = {title: '', collection: []});
-          child.collection.push(`<div>
-            <span class="met-name" style="color: ${color};">${item.matname}</span>
-            <span class="met-value">${ref[item.matdosage]}</span>
-          </div>`);
-          cb(item.medid, i);
-        }
-        if (item.matsjj) {
-          const ref = {1: '慎用', 2: '忌用', 3: '禁用'}, i = 2;
-          const child = data[i] || (data[i] = {title: '慎忌禁用药', collection: []});
-          child.collection.push(`<div>
-            <span class="met-name" style="color: ${color};">${item.matname}</span>
-            <span class="met-value">${ref[item.matsjj] || item.matsjj}</span>
-          </div>`);
-          cb(item.medid, i);
-        }
-        if (item.matyfsjj) {
-          const color = item.matyfsjj === '3' ? 'red' : 'blue';
-          const ref = {1: '孕妇慎用', 2: '孕妇忌用', 3: '孕妇禁用'}, i = 3;
-          const child = data[i] || (data[i] = {title: '孕妇慎忌禁', collection: []});
-          child.collection.push(`<div>
-            <span class="met-name" style="color: ${color};">${item.matname}</span>
-            <span class="met-value">${ref[item.matyfsjj]}</span>
-          </div>`);
-          cb(item.medid, i);
-        }
-        if (item.matysjj) {
-          const ref = {}, i = 4;
-          const child = data[i] || (data[i] = {title: '服药饮食禁忌', collection: []});
-          child.collection.push(`<div>
-            <span class="met-name" style="color: ${color};">${item.matname}</span>
-            <span class="met-value">${item.matysjj || '无'}</span>
-          </div>`);
-          cb(item.medid, i);
-        }
-        if (item.matdxsm) {
-          const color = 'red';
-          const ref = {}, i = 5;
-          const child = data[i] || (data[i] = {title: '药物毒性说明', collection: []});
-          child.collection.push(`<div>
-            <span class="met-name" style="color: ${color};">${item.matname}</span>
-            <span class="met-value">${item.matdxsm || '无'}</span>
-          </div>`);
-          cb(item.medid, i);
-        }
-        if (item.matbzjj) {
-          const ref = {}, i = 6;
-          const child = data[i] || (data[i] = {title: '病证用药禁忌', collection: []});
-          child.collection.push(`<div>
-            <span class="met-name" style="color: ${color};">${item.matname}</span>
-            <span class="met-value">${item.matbzjj || '无'}</span>
-          </div>`);
-          cb(item.medid, i);
-        }
-        if (item.matsbf) {
-          const color = 'red';
-          const ref = {}, i = 7;
-          const child = data[i] || (data[i] = {title: '十八反', collection: []});
-          child.collection.push(`<div>
-            <span class="met-name" style="color: ${color};">${item.matname}</span>
-            <span class="met-value">反${item.matsbf}</span>
-          </div>`);
-          cb(item.medid, i);
-        }
-        if (item.matsjw) {
-          const color = 'red';
-          const ref = {}, i = 8;
-          const child = data[i] || (data[i] = {title: '十九畏', collection: []});
-          child.collection.push(`<div>
-            <span class="met-name" style="color: ${color};">${item.matname}</span>
-            <span class="met-value">畏${item.matsjw}</span>
-          </div>`);
-          cb(item.medid, i);
-        }
-        if (item.matby) {
-          const ref = {}, i = 9;
-          const child = data[i] || (data[i] = {title: '用药不宜', collection: []});
-          child.collection.push(`<div>
-            <span class="met-name" style="color: ${color};">${item.matname}</span>
-            <span class="met-value">不宜与${item.matby}同用</span>
-          </div>`);
-          cb(item.medid, i);
-        }
-        if (item.matmindosage && item.matmaxdosage) {
-          try {
-            const dose = CC_Dosage2Basis(get(item.medid));
-            if (dose < item.matmindosage || dose > item.matmaxdosage) {
-              const ref = {}, i = 10;
-              const child = data[i] || (data[i] = {title: '超剂量药品', collection: []});
-              child.collection.push(`<div>
-                <span class="met-name" style="color: ${color};">${item.matname}</span>
-                <span class="met-value" style="color: red;">(${item.matmindosage}-${item.matmaxdosage})</span>
-              </div>`);
-              cb(item.medid, i);
-            }
-          } catch (e) {}
-        }
-        return data;
-      }, {title: `中药处方${index + 1}`});
-    },
-    async getRationalMed(id) {
-      // this.rationalMed = []
-      let children = this.$children.filter(item => {
-        return (
-          item.name == "中药处方" ||
-          item.name == "中药制剂" ||
-          item.name == "适宜技术处方"
-        );
-      });
-      let child = children[0];
-      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,
-        orgId: this.getuserinfo.organizationid,
-        matIds: ids
-      });
-      if (res.code == 0 && res.message) {
-        res.data.reqID = id;
-
-        this.rationalMed.push(Object.assign(res.data, {__medicine__: medicine}));
-        // 去重
-        const removeRepeat = (arr, key) => {
-          let obj = {};
-          arr = arr.reduce((pre, next) => {
-            obj[next[key]] ? "" : (obj[next[key]] = true && pre.push(next));
-            return pre;
-          }, []);
-          return arr;
-        };
-
-        this.resetRationalMed();
-        this.rationalMed = removeRepeat(this.rationalMed, "reqID");
-      }
-    },
-
-    resetRationalMed() {
-      const removeRepeat = (arr, key) => {
-        let obj = {};
-        arr = arr.reduce((pre, next) => {
-          obj[next[key]] ? "" : (obj[next[key]] = true && pre.push(next));
-          return pre;
-        }, []);
-        return arr;
-      };
-      this.rationalMed1 = [];
-      this.rationalMed2 = [];
-      this.rationalMed3 = [];
-      this.rationalMed4 = [];
-      this.rationalMed5 = [];
-      this.rationalMed6 = [];
-      this.rationalMed7 = [];
-      this.rationalMed8 = [];
-      this.rationalMed9 = [];
-      this.rationalMed10 = [];
-
-      this.rationalMed = removeRepeat(this.rationalMed, "reqID");
-      this.rationalMed.forEach(item => {
-        item.showDose = item.showDose ? true : false;
-        if (item.matdosage) {
-          // 超剂量药品:
-
-          this.rationalMed1.push(item);
-        }
-
-        if (item.matsjj) {
-          // 慎忌禁用药:
-          this.rationalMed2.push(item);
-        }
-
-        if (item.matyfsjj) {
-          // 孕妇慎忌禁:
-          this.rationalMed3.push(item);
-        }
-
-        if (item.matysjj) {
-          // 服药饮食禁忌:
-          this.rationalMed4.push(item);
-        }
-
-        if (item.matdxsm) {
-          /// 药物毒性说明:
-          this.rationalMed5.push(item);
-        }
-
-        if (item.matbzjj) {
-          // 病证用药禁忌:
-          this.rationalMed6.push(item);
-        }
-
-        if (item.matsbf) {
-          // 18反
-          this.rationalMed7.push(item);
-        }
-
-        if (item.matsjw) {
-          // 十九畏:
-          this.rationalMed8.push(item);
-        }
-
-        if (item.matby) {
-          // 用药不宜:
-          this.rationalMed9.push(item);
-        }
-
-        if (item.matmaxdosage && item.matmindosage) {
-          try {
-            const dose = CC_Dosage2Basis(item.__medicine__);
-            if (dose && (dose < item.matmindosage || dose > item.matmaxdosage)) item.showDose = true;
-          } catch (e) {}
-          this.rationalMed10.push(item);
-        }
-      });
-
-      this.rationalMed1 = removeRepeat(this.rationalMed1, "matid");
-      this.rationalMed2 = removeRepeat(this.rationalMed2, "matid");
-      this.rationalMed3 = removeRepeat(this.rationalMed3, "matid");
-      this.rationalMed4 = removeRepeat(this.rationalMed4, "matid");
-      this.rationalMed5 = removeRepeat(this.rationalMed5, "matid");
-      this.rationalMed6 = removeRepeat(this.rationalMed6, "matid");
-      this.rationalMed7 = removeRepeat(this.rationalMed7, "matid");
-      this.rationalMed8 = removeRepeat(this.rationalMed8, "matid");
-      this.rationalMed9 = removeRepeat(this.rationalMed9, "matid");
-      this.rationalMed10 = removeRepeat(this.rationalMed10, "matid");
-    },
-    // 获取合理用药信息 平台
-    async getRationalMedForPlat(id) {
-      this.rationalMed = [];
-      let children = this.$children.filter(item => {
-        return (
-          item.name == "中药处方" ||
-          item.name == "中药制剂" ||
-          item.name == "适宜技术处方"
-        );
-      });
-      let child = children[0];
-      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,
-        // orgId: this.getuserinfo.organizationid
-        matIds: ids
-      });
-      if (res.code == 0 && res.message) {
-        res.data.reqID = id;
-
-        this.rationalMed.push(Object.assign(res.data, {__medicine__: medicine}));
-
-        // 去重
-        const removeRepeat = (arr, key) => {
-          let obj = {};
-          arr = arr.reduce((pre, next) => {
-            obj[next[key]] ? "" : (obj[next[key]] = true && pre.push(next));
-            return pre;
-          }, []);
-          return arr;
-        };
-        this.rationalMed = removeRepeat(this.rationalMed, "reqID");
-
-        this.rationalMed.forEach(item => {
-          item.showDose = item.showDose ? true : false;
-          if (item.matdosage) {
-            // 超剂量药品:
-
-            this.rationalMed1.push(item);
-          }
-
-          if (item.matsjj) {
-            // 慎忌禁用药:
-            this.rationalMed2.push(item);
-          }
-
-          if (item.matyfsjj) {
-            // 孕妇慎忌禁:
-            this.rationalMed3.push(item);
-          }
-
-          if (item.matysjj) {
-            // 服药饮食禁忌:
-            this.rationalMed4.push(item);
-          }
-
-          if (item.matdxsm) {
-            /// 药物毒性说明:
-            this.rationalMed5.push(item);
-          }
-
-          if (item.matbzjj) {
-            // 病证用药禁忌:
-            this.rationalMed6.push(item);
-          }
-
-          if (item.matsbf) {
-            // 18反
-            this.rationalMed7.push(item);
-          }
-
-          if (item.matsjw) {
-            // 十九畏:
-            this.rationalMed8.push(item);
-          }
-
-          if (item.matby) {
-            // 用药不宜:
-            this.rationalMed9.push(item);
-          }
-
-          if (item.matmaxdosage && item.matmindosage) {
-            try {
-              const dose = CC_Dosage2Basis(item.__medicine__);
-              if (dose < item.matmindosage || dose > item.matmaxdosage) item.showDose = true;
-            } catch (e) {}
-            this.rationalMed10.push(item);
-          }
-        });
-
-        // 去重
-        this.rationalMed1 = removeRepeat(this.rationalMed1, "matid");
-        this.rationalMed2 = removeRepeat(this.rationalMed2, "matid");
-        this.rationalMed3 = removeRepeat(this.rationalMed3, "matid");
-        this.rationalMed4 = removeRepeat(this.rationalMed4, "matid");
-        this.rationalMed5 = removeRepeat(this.rationalMed5, "matid");
-        this.rationalMed6 = removeRepeat(this.rationalMed6, "matid");
-        this.rationalMed7 = removeRepeat(this.rationalMed7, "matid");
-        this.rationalMed8 = removeRepeat(this.rationalMed8, "matid");
-        this.rationalMed9 = removeRepeat(this.rationalMed9, "matid");
-        this.rationalMed10 = removeRepeat(this.rationalMed10, "matid");
-      }
-    },
     /**
      * 检测合理安全用药
      * 可供 子组件 调用 {@link ChineseMedicine }
@@ -4475,33 +4119,6 @@ export default {
         this.showExpr = true;
       }
     },
-    fmatby(val, mat) {
-      return mat + "不宜与" + val + "同用" + ",";
-      let list = val.split(",");
-      let str = "";
-      list.forEach(item => {
-        str += mat + "不宜与" + item + "同用" + ",";
-      });
-      return str;
-    },
-    fsjw(val, mat) {
-      return mat + "畏" + val + ",";
-      let list = val.split(",");
-      let str = "";
-      list.forEach(item => {
-        str += mat + "畏" + item + ",";
-      });
-      return str;
-    },
-    fsbf(val, mat) {
-      return '<span style="color:red;">' + mat + "</span>" + "反" + val + ",";
-      let list = val.split(",");
-      let str = "";
-      list.forEach(item => {
-        str += mat + "反" + item + ",";
-      });
-      return str;
-    },
     // 去重
     removeRepeat(arr, key) {
       let obj = {};