Преглед изворни кода

[重构] 开方疾病选择 和 推导

cc12458 пре 5 месеци
родитељ
комит
421d26ddae
5 измењених фајлова са 297 додато и 132 уклоњено
  1. 12 3
      src/api/knowledge.js
  2. 92 94
      src/components/TCMDiagnosis.vue
  3. 147 0
      src/request/api.illness.js
  4. 1 0
      src/request/api.js
  5. 45 35
      src/views/diagnosis/Prescribing.vue

+ 12 - 3
src/api/knowledge.js

@@ -1,7 +1,10 @@
 import request from '@/utils/request1.js'
 import request1 from '@/utils/request.js'
 
-// 获取中医 病名
+/**
+ * 获取中医 病名
+ * @deprecated
+ */
 export function getCDiseaseName(data) {
     return request({
         url: '/basis/knowlib/diseaseQuery',
@@ -20,7 +23,10 @@ export function getXDiseaseName(data) {
 };
 
 
-// 获取中医证型
+/**
+ * 获取中医证型
+ * @deprecated
+ */
 export function getCCardType(data) {
     return request({
         url: '/basis/knowlib/symptomQuery',
@@ -29,7 +35,10 @@ export function getCCardType(data) {
     })
 };
 
-// 获取中医治法
+/**
+ * 获取中医治法
+ * @deprecated
+ */
 export function getCTherapy(data) {
     return request({
         url: '/basis/knowlib/getTherapyAll',

+ 92 - 94
src/components/TCMDiagnosis.vue

@@ -9,13 +9,13 @@
       <div class="value">
         <el-popover placement="bottom" width="180" trigger="focus" :close-delay="100">
           <el-input
-            :class="{invalid: name && (!zy_dise_id || invalid_dis)}"
+            :class="{invalid: name && (!diseaseCode || invalid_disease)}"
             :size="size"
             slot="reference"
             :placeholder="key1?key1:'中医病名'"
             v-model="key1"
             ref="zybm"
-            @input="getNamemedData(key1)"
+            @input="getDiseaseList(key1)"
             @keydown.enter.native="handleEnter('bm')"
           >
             <div slot="suffix" class="suffix">
@@ -25,13 +25,13 @@
           </el-input>
           <ul class="option-list">
             <li
-              v-for="(item,index) in cDiseaseNameL"
-              :key="index"
+              v-for="item in diseaseList"
+              :key="item.$uid"
               :class="{
-                active: zy_dise_id === item.disid
+                active: diseaseCode === item.$code
               }"
               @click="handleBm(item)"
-            >{{ item.disname }}</li>
+            >{{ item.$name }}</li>
           </ul>
         </el-popover>
       </div>
@@ -50,7 +50,7 @@
             :placeholder="key2?key2:'中医证型'"
             v-model="key2"
             ref="zhengxing"
-            @input="getCardType(key2)"
+            @input="getSymptomList(key2)"
             @keydown.enter.native="handleEnter('zx')"
           >
             <div slot="suffix" class="suffix">
@@ -60,14 +60,14 @@
           </el-input>
           <ul class="option-list">
             <li
-              v-for="(item,index) in cCardTypeL"
-              :key="index"
+              v-for="item in symptomList"
+              :key="item.$uid"
               :class="{
-                active: zhengxingid === item.symid,
+                active: zhengxingid === item.$code,
                 matched: item.isMatched
               }"
               @click="handleZx(item)"
-            >{{ item.symname }}</li>
+            >{{ item.$name }}</li>
           </ul>
         </el-popover>
       </div>
@@ -82,11 +82,11 @@
         <el-popover placement="bottom" width="180" trigger="focus" :close-delay="100" v-model="popoverZF">
           <el-input
               :size="size" :class="{invalid: therapy && invalid_therapy}"
-              slot="reference"
+              slot="reference" :readonly="therapySearchDisabled"
               :placeholder="key3?key3:'中医治法'"
               v-model="key3"
               ref="zhifa"
-              @input="getTherapy(key3)"
+              @input="getTherapyList(key3)"
               @keydown.enter.native="handleEnter('zf')"
           >
             <div slot="suffix" class="suffix">
@@ -96,14 +96,13 @@
           </el-input>
           <ul class="option-list">
             <li
-              v-for="(item,index) in therapyList"
-              :key="index"
+              v-for="item in therapyList"
+              :key="item.$uid"
               :class="{
-                active: therapy === item.therapy
+                active: therapy === item.$name
               }"
               @click="handleZf(item)"
-            >{{ item.therapy }}
-            </li>
+            >{{ item.$name }}</li>
           </ul>
         </el-popover>
       </div>
@@ -111,22 +110,11 @@
   </div>
 </template>
 <script>
-import {
-  getCDiseaseName,
-  getXDiseaseName,
-  getCCardType,
-  getCTherapy,
-} from "@/api/knowledge.js";
+import {getDiseaseListMethod, getSymptomListMethod, getTherapyListMethod} from '@/request/api';
 import {addDiagnosisData2} from '@/api/diagnosis.js';
 import { addRecipeFrom } from "@/api/dataAnalysis.js";
 import { mapGetters } from "vuex";
-
-/**
- * 搜索类型,1为拼音码,2为五笔码,搜索中文时可传空
- * @param value
- * @return {'1'|''}
- */
-const isPY = (value) => value && /^[A-Za-z]+$/g.test(value) ? '1' : '';
+import {findArray} from '@/tool';
 
 export default {
   props: {
@@ -151,7 +139,8 @@ export default {
   },
   data() {
     return {
-      invalid_dis: false,
+      therapySearchDisabled: false,
+      invalid_disease: false,
       invalid_symptom: false,
       invalid_therapy: false,
 
@@ -159,6 +148,7 @@ export default {
 
       name: "", // 病名
       zy_dise_id: "", // 病名id
+      diseaseCode: '', // 病名code
 
       syndrome: "", // 证型
       zhengxingid: "", // 证型id
@@ -166,8 +156,8 @@ export default {
       therapy: "", // 治法
       therapyCode: '', // 治法
 
-      cDiseaseNameL: [], // 病名列表
-      cCardTypeL: [], // 证型列表
+      diseaseList: [], // 病名列表
+      symptomList: [], // 证型列表
       therapyList: [], //治法列表
 
       isInit: false, // 是否根据传入的数据初始化过
@@ -180,16 +170,17 @@ export default {
     };
   },
   mounted() {
-    this.getNamemedData();
-    this.getCardType();
-    this.getTherapy();
+    this.getDiseaseList();
+    this.getSymptomList();
+    this.getTherapyList();
   },
   watch: {
     key1: {
       handler: function() {
         if (this.key1 == "") {
-          this.invalid_dis = false;
+          this.invalid_disease = false;
           this.zy_dise_id = "";
+          this.diseaseCode = '';
           this.name = "";
         }
       }
@@ -200,7 +191,7 @@ export default {
           this.invalid_symptom = false;
           this.syndrome = "";
           this.zhengxingid = "";
-        }
+        } else if (this.therapySearchDisabled) this.getTherapiesBySymptom();
       }
     },
     key3: {
@@ -222,6 +213,7 @@ export default {
         // 中医诊断
         this.name = this.patiensMsg.maindiagnosis.namemedicine || "";
         this.zy_dise_id = this.patiensMsg.maindiagnosis.disid || "";
+        this.diseaseCode = this.patiensMsg.maindiagnosis.disCode || '';
         // 证形
         this.syndrome = this.patiensMsg.maindiagnosis.syndrometypes || "";
         this.zhengxingid = this.patiensMsg.maindiagnosis.symptomid || "";
@@ -231,9 +223,9 @@ export default {
         this.key1 = this.name || "";
         this.key2 = this.syndrome || "";
         this.key3 = this.therapy || '';
-        if (this.key1) this.getNamemedData(this.key1);
-        if (this.key2) this.getCardType(this.key2);
-        if (this.key3) this.getTherapy(this.key3);
+        if (this.key1) this.getDiseaseList(this.key1);
+        if (this.key2) this.getSymptomList(this.key2);
+        if (this.key3) this.getTherapyList(this.key3);
         this.isInit = true;
       }
     }
@@ -247,17 +239,19 @@ export default {
      * @param {'bm'|'zx'|'zf'} type
      */
     handleEnter(type) {
-      if (type === 'bm' && this.cDiseaseNameL.length) this.handleBm(this.cDiseaseNameL[0]);
-      else if (type === 'zx' && this.cCardTypeL.length) this.handleZx(this.cCardTypeL[0]);
+      if (type === 'bm' && this.diseaseList.length) this.handleBm(this.diseaseList[0]);
+      else if (type === 'zx' && this.symptomList.length) this.handleZx(this.symptomList[0]);
       else if (type === 'zf' && this.therapyList.length) this.handleZf(this.therapyList[0]);
     },
     // 获取中医诊断信息
     getDiamsg() {
       this.saveDiagnosisData();
       return {
+        disCode: this.diseaseCode,
+        symptomCode: this.zhengxingid,
+        therapyCode: this.therapyCode,
         disid: this.zy_dise_id,
         symptomid: this.zhengxingid,
-        therapyCode: this.therapyCode,
         treatment: this.therapy
       };
     },
@@ -272,7 +266,9 @@ export default {
         // 病名及id
         namemedicine: this.name,
         disid: this.zy_dise_id,
+        disCode: this.diseaseCode,
         //   证型及id
+        symptomCode: this.zhengxingid,
         symptomid: this.zhengxingid,
         syndrometypes: this.syndrome,
         //   治法
@@ -291,54 +287,52 @@ export default {
       this.key1 = this.name || "";
       this.key2 = this.syndrome || "";
       this.key3 = this.therapy || '';
-      if (this.key1) this.getNamemedData(this.key1);
-      if (this.key2) this.getCardType(this.key2);
-      if (this.key3) this.getTherapy(this.key3);
+      if (this.key1) this.getDiseaseList(this.key1);
+      if (this.key2) this.getSymptomList(this.key2);
+      if (this.key3) this.getTherapyList(this.key3);
 
       this.$forceUpdate();
     },
     // 病名选中
-    handleBm(item) {
-      this.invalid_dis = false
+    async handleBm(item) {
+      this.invalid_disease = false;
       this.zy_dise_id = item.disid;
-      this.name = item.disname;
-      this.key1 = item.disname;
+      this.diseaseCode = item.$code;
+      this.name = item.$name;
+      this.key1 = item.$name;
       this.$refs.zybm.blur();
 
       this.clearZx();
 
       if (this.name === "") return;
-      // this.getCCardType(this.zy_dise_id);
-      this.getCardType();
-      setTimeout(() => {
-        this.$refs.zhengxing.focus();
-      }, 0);
+      this.$refs.zhengxing.focus();
+      await this.getSymptomList();
     },
     // 清空病名
     clearBm() {
       this.name = "";
       this.zy_dise_id = "";
+      this.diseaseCode = '';
       this.key1 = "";
       this.clearZx();
     },
     // 证型选中\
-    handleZx(item) {
-      this.invalid_dis = false
-      this.syndrome = item.symname;
-      this.key2 = item.symname;
-      this.zhengxingid = item.symid;
+    async handleZx(item) {
+      this.invalid_disease = false;
+      this.syndrome = item.$name;
+      this.key2 = item.$name;
+      this.zhengxingid = item.$code;
       this.$refs.zhengxing.blur();
 
       this.clearZf();
-      this.getTherapy();
-      setTimeout(() => {
-        this.$refs.zhifa.focus();
-      }, 0);
+      this.$refs.zhifa.focus();
+      await this.getTherapiesBySymptom();
+      await this.getTherapyList();
     },
     handleZf(item) {
       this.invalid_therapy = false;
-      this.therapy = item.therapy;
-      this.therapyCode = item.therapyCode;
+      this.therapy = item.$name;
+      this.therapyCode = item.$code;
       this.key3 = this.therapy;
       this.$nextTick(() => {
         this.$refs.zhifa.blur();
@@ -359,40 +353,42 @@ export default {
       this.key3 = '';
     },
     //获取病名数据
-    async getNamemedData(keyword = '') {
-      const res = await getCDiseaseName({
-        pageid: 1,
-        pagesize: 9999,
-        keyword,
-        serchtype: isPY(keyword),
-      }).catch(() => ({code: -1}));
-      this.cDiseaseNameL = res.code === 0 ? res.data.diseases : [];
+    async getDiseaseList(keyword = '') {
+      const {total, list} = await getDiseaseListMethod(1, 9999, {keyword});
+      this.diseaseList = list;
     },
     // 获取证型数据
-    async getCardType(keyword = '') {
-      const res = await getCCardType({
-        pageid: 1,
-        pagesize: 9999,
+    async getSymptomList(keyword = '') {
+      const {total, list} = await getSymptomListMethod(1, 9999, {
         keyword,
-        serchtype: isPY(keyword),
-        disid: this.zy_dise_id
-      }).catch(() => ({code: -1}));
-      this.cCardTypeL = res.code === 0 ? res.data.sysptoms : [];
+        disid: this.zy_dise_id,
+        disCode: this.diseaseCode,
+      })
+      this.symptomList = list;
+      await this.getTherapiesBySymptom();
     },
     /**
      * 获取治法
      * @param keyword
      * @return {Promise<void>}
      */
-    async getTherapy(keyword) {
-      const res = await getCTherapy({
-        pageid: 1,
-        pagesize: 9999,
-        serchtype: isPY(keyword),
-        name: keyword,
+    async getTherapyList(keyword) {
+      if (this.therapySearchDisabled) return;
+      const {total, list} = await getTherapyListMethod(1, 9999, {
+        keyword,
         symid: this.zhengxingid,
-      }).catch(() => ({code: -1}));
-      this.therapyList = res.code === 0 ? res.data : [];
+      }).catch(error => {
+        if (error.isAxiosError && error.message === `Request failed with status code 404`) {
+          this.therapySearchDisabled = true;
+          this.getTherapiesBySymptom();
+        }
+        throw error;
+      });
+      this.therapyList = list;
+    },
+    async getTherapiesBySymptom() {
+      const option = findArray(this.symptomList, ['$code', this.zhengxingid]);
+      if (option) this.therapyList = option.therapies;
     },
     // 新增处方来源统计
     async addRecipeFrom() {
@@ -406,7 +402,9 @@ export default {
       let params = {
         mainDiagnosis: {
           disid: this.zy_dise_id,
+          disCode: this.diseaseCode,
           symptomid: this.zhengxingid,
+          symptomCode: this.zhengxingid,
           therapyCode: this.therapyCode,
           treatment: this.therapy,
           maindiagnosis: "0",
@@ -422,11 +420,11 @@ export default {
         if (!this.zy_dise_id) throw {message: `当前疾病编码与医保不匹配,请更换中医病名等诊断信息!`};
         let {mainDiagnosis} = await addDiagnosisData2(params);
 
-        this.invalid_dis = !mainDiagnosis.disid;
+        this.invalid_disease = !mainDiagnosis.disCode;
         this.invalid_symptom = !mainDiagnosis.symptomid;
         this.invalid_therapy = !mainDiagnosis.therapyCode;
         const tips = [
-          this.invalid_dis ? `${this.title}病名` : '',
+          this.invalid_disease ? `${this.title}病名` : '',
           this.invalid_symptom ? `证型` : '',
           this.invalid_therapy ? `治法` : '',
         ].filter(Boolean).join(',');

+ 147 - 0
src/request/api.illness.js

@@ -0,0 +1,147 @@
+import http from './http';
+import {getArray, randomUUID} from '@/tool';
+
+export function getDiseaseListMethod(page = 1, size = 10, query = {}) {
+  const keyword = query.keyword;
+  return http.post(`/basis/knowlib/diseaseQuery`, {
+    serchtype: /* 1: 拼音码 2: 五笔码;搜索中文时可传空*/ /\w+/.test(keyword) ? '1' : '',
+    pageid: page,
+    pagesize: size,
+    ...query, keyword,
+  }, {meta: {share: true}}).then(res => {
+    return {
+      total: res.data.disnum,
+      list: getArray(res.data.diseases, item => Object.assign(item, {
+        $uid: randomUUID(),
+        $code: item.disCode,
+        $name: item.disname,
+      })),
+    };
+  });
+}
+
+export function getSymptomListMethod(page = 1, size = 10, query = {}) {
+  const keyword = query.keyword;
+  return http.post(`/basis/knowlib/symptomQuery`, {
+    serchtype: /* 1: 拼音码 2: 五笔码;搜索中文时可传空*/ /\w+/.test(keyword) ? '1' : '',
+    pageid: page,
+    pagesize: size,
+    ...query, keyword,
+  }, {meta: {share: true}}).then(res => {
+    return {
+      total: res.data.sysnum,
+      list: getArray(res.data.sysptoms, item => Object.assign(item, {
+        $uid: randomUUID(),
+        $code: item.symid,
+        $name: item.symname,
+        therapies: getArray(item.therapys, item => Object.assign(item, {
+          $uid: randomUUID(),
+          $code: item.therapyCode,
+          $name: item.therapyName,
+        })),
+      })),
+    };
+  });
+}
+
+export function getTherapyListMethod(page = 1, size = 10, query = {}) {
+  const keyword = query.keyword;
+  return http.post(`/basis/knowlib/getTherapyAll`, {
+    serchtype: /* 1: 拼音码 2: 五笔码;搜索中文时可传空*/ /\w+/.test(keyword) ? '1' : '',
+    pageid: page,
+    pagesize: size,
+    ...query, name: keyword,
+  }, {meta: {share: true, ignoreError: true}}).then(res => {
+    const list = getArray(res.data['diseases'], item => Object.assign(item, {
+      $uid: randomUUID(),
+      $code: item.therapyCode,
+      $name: item.therapy,
+    }));
+    return {total: list.length, list};
+  });
+}
+
+/**
+ *
+ * 根据疾病信息推导业务处方
+ * @param {string} business 业务类型,多个用逗号分隔
+ *   - '1' 中药处方
+ *   - '2' 中药制剂
+ *   - '3' 适宜技术
+ * @param {object} illness 疾病信息对象
+ * @param {string} illness.disease.id 疾病ID
+ * @param {string} illness.disease.code 疾病代码
+ * @param {string} illness.disease.name 疾病名称
+ * @param {string} illness.symptom.code 证型代码
+ * @param {string} illness.symptom.name 证型名称
+ * @param {string} illness.therapy.code 治法代码
+ * @param {string} illness.therapy.name 治法名称
+ * @return {Promise<*>}
+ */
+export function deduceIllnessPrescriptionMethod(business = '1,2,3', illness) {
+  const [_, prefix = '', special, suffix = ''] = business.match(/^([^1]+)?(?:(1)(?:,|$))?([^1]*)?$/) || ['', business];
+
+  const request = (business) => {
+    if (!business) return {expList: [], schemes: []};
+    return http.post(`/basis/knowlib/treatmentScheme`, {
+      businesstype: business.endsWith(',') ? business.slice(0, -1) : business,
+      disid: illness.disease.id,
+      symid: illness.symptom.code,
+      therapy: illness.therapy.name,
+      therapyCode: illness.therapy.code,
+      disCode: illness.disease.code,
+    }).then(res => {
+      const {expList, schemes} = res.data;
+      return {schemes, expList: business === '1' ? {pres: expList, businesstype: business} : []};
+    });
+  };
+
+  return Promise.all([
+    request(special),
+    request(`${prefix}${suffix}`),
+  ]).then(([s, b]) => {
+    return {
+      expList: [s.expList, b.expList].flat(),
+      schemes: [s.schemes, b.schemes].flat(),
+    };
+  }).then(({schemes, expList}) => {
+    const categories = business.split(',');
+    const results = {
+      * [Symbol.iterator]() { for (const type of categories) yield this[type]; },
+    };
+    for (const category of categories) {
+      const e = expList.find(item => item.businesstype === category) || {pres: []};
+      const s = schemes.find(item => item.businesstype === category) || {pres: []};
+      results[category] = [
+        e.pres.map(item => Object.assign(item, {$category: category, $type: '3'})),
+        s.pres.map(item => Object.assign(item, {$category: category, $type: '1'})),
+      ].flat(1);
+      if (results.index == null && results[category].length) results.index = categories.findIndex(t => t === category);
+    }
+    return results;
+  });
+}
+
+
+/**
+ * [legacy] 推导处方
+ * {@link deduceIllnessPrescriptionMethod}
+ */
+export function legacyDeduceIllnessPrescriptionMethod(business, params = {}) {
+  return deduceIllnessPrescriptionMethod(business, {
+    disease: {code: params.disCode, id: params.disid},
+    symptom: {code: params.symptomCode},
+    therapy: {code: params.therapyCode, name: params.treatment},
+  }).then(data => {
+    const categories = business.split(',');
+    for (const category of categories) {
+      const expList = [], schemes = [];
+      for (const prescription of data[category]) {
+        if (prescription.$type === '3') expList.push(prescription);
+        else if (prescription.$type === '1') schemes.push(prescription);
+      }
+      data[category] = {code: 0, data: {expList, schemes: [{businesstype: category, presnum: schemes.length, pres: schemes}]}};
+    }
+    return data;
+  });
+}

+ 1 - 0
src/request/api.js

@@ -0,0 +1 @@
+export * from './api.illness';

+ 45 - 35
src/views/diagnosis/Prescribing.vue

@@ -1180,6 +1180,7 @@ import {
   getAcupointD,
   getMedDetail
 } from "@/api/knowledge.js";
+import {legacyDeduceIllnessPrescriptionMethod} from '@/request/api';
 
 import { mapState, mapGetters, mapActions, mapMutations } from "vuex";
 import { getExperinceDetail } from "@/api/business.js";
@@ -1480,7 +1481,7 @@ export default {
     },
 
     // 中医诊断推导点击
-    tcmClick(isauto = true) {
+    async tcmClick(isauto = true) {
      this.isTuiDaoZy = false;
      this.isTuiDaoZj = false;
      this.isTuiDaoSuit = false;
@@ -1494,39 +1495,47 @@ export default {
       let newDiaMsg = this.$refs.TCM.getDiamsg();
 
       this.agree_key1 = params.namemedicine;
+      this.patiensMsg.maindiagnosis.disCode = newDiaMsg.disCode;
+      this.patiensMsg.maindiagnosis.symptomCode = newDiaMsg.symptomid;
+      this.patiensMsg.maindiagnosis.therapyCode = newDiaMsg.therapyCode;
       this.patiensMsg.maindiagnosis.disid = newDiaMsg.disid;
       this.patiensMsg.maindiagnosis.symptomid = newDiaMsg.symptomid;
       this.patiensMsg.maindiagnosis.treatment = newDiaMsg.treatment;
 
+      const current = this.contentTabs[this.container_i];
+      if (current) {
+        const loading = this.$loading({
+          lock: true,
+          text: `正在获取推荐处方数据`,
+          spinner: 'el-icon-loading',
+          background: 'rgba(0, 0, 0, 0.7)',
+        });
+        try {
+          const business = this.contentTabs.filter(tab => !tab.hide).map(tab => tab.businesstype).join(',');
+          const results = await legacyDeduceIllnessPrescriptionMethod(business, this.patiensMsg.maindiagnosis);
+          if (isauto && current.id !== '1') await this.inferRecipe(2, current.businesstype, results[current.businesstype]);
+          for (const tab of this.contentTabs) {
+            if (tab.hide) continue;
+            const type = tab.id === '1' && tab.id === current.id ? 3 : 4;
+            this.inferRecipe(type, tab.businesstype, results[tab.businesstype]).then(() => {
+              if (tab.id === current.id) {
+                if (current.id === '0') this.isTuiDaoZy = true;
+                else if (current.id === '1') this.isTuiDaoZj = true;
+                else if (current.id === '2') this.isTuiDaoSuit = true;
+              }
+            });
+          }
+          if (this.getPatiensInfo.pid) await this.getPatiensBasisM();
+        } catch (_) {}
+        loading.close();
+      }
+
       // 获取最新病名的参考医案
       this.rDoctorCase.page = 1;
       this.rDoctorCase.list = [];
       this.rDoctorCase.loadMore = true;
-      this.getDoctorCaseL();
+      await this.getDoctorCaseL();
       // --end
-      const current = this.contentTabs[this.container_i];
-      if (!current) return;
-
-      if (isauto && current.id !== '1') {
-        this.inferRecipe(2, current.businesstype);
-      }
-
-      setTimeout(() => {
-        for (const tab of this.contentTabs) {
-          if (tab.hide) continue;
-          const type = tab.id === '1' && tab.id === current.id ? 3 : 4;
-          this.inferRecipe(type, tab.businesstype).then(() => {
-            if (tab.id === current.id ) {
-              if (current.id === '0') this.isTuiDaoZy = true
-              else if (current.id === '1') this.isTuiDaoZj = true
-              else if (current.id === '2') this.isTuiDaoSuit = true
-            }
-          })
-        }
-        if (this.getPatiensInfo.pid) {
-          this.getPatiensBasisM();
-        }
-      }, 1000);
     },
     // 系统数据存入缓存
     _setDataToStorage(next) {
@@ -3832,7 +3841,7 @@ export default {
       }
     },
     // 推导处方
-    async inferRecipe(type = 1, businesstype) {
+    async inferRecipe(type = 1, businesstype, res) {
       if (!this.patiensMsg.maindiagnosis.disid) {
         return;
       }
@@ -3858,15 +3867,16 @@ export default {
         symid: this.patiensMsg.maindiagnosis.symptomid,
         therapy: this.patiensMsg.maindiagnosis.treatment
       };
-      const loading = this.$loading({
-        lock: true,
-        text: `正在获取推荐${ +businesstype === 2 ? '制剂' : '方剂' }数据`,
-        spinner: "el-icon-loading",
-        background: "rgba(0, 0, 0, 0.7)"
-      });
-      let res = await inferRecipe(params).catch(err => {
-        loading.close();
-      });
+      let loading = { close() {} };
+      if (!res) {
+        loading = this.$loading({
+          lock: true,
+          text: `正在获取推荐${ +businesstype === 2 ? '制剂' : '方剂' }数据`,
+          spinner: "el-icon-loading",
+          background: "rgba(0, 0, 0, 0.7)"
+        });
+        res = await inferRecipe(params).catch(err => { loading.close(); });
+      }
       if (res.code == 0) {
         loading.close();