Kaynağa Gözat

增加医派协定方和协定方以及去除HIS病名和证型;配穴表格默认选中经络

张田田 1 hafta önce
ebeveyn
işleme
48054ec7d7

+ 10 - 0
src/api/diagnosis.js

@@ -489,6 +489,16 @@ export function getRecipeByBasis(data) {
     })
 }
 
+
+//适宜技术病历转方
+export function getRecipeBySuitTech(data) { 
+    return request({
+        url: `/test/outpatient/changeStRecordPre`,
+        method: 'post',
+        data
+    })
+}
+
 // 获取中药制剂 包装单位 
 export function getBzdw(params) {
     return request({

+ 16 - 2
src/components/ui/outpatientRecords.vue

@@ -161,9 +161,8 @@
                     <div class="syjs" v-for="(item,index) in info.shiyijishuVos" :key="index">
                         <div class="recipe-title flex flex-col-center">
                             <span>适宜技术处方</span>
-                            <el-button type="primary" size="mini" v-if="syjszf">转方</el-button>
+                            <el-button type="primary" size="mini" v-if="syjszf && index === 0" @click="syjsTurn">转方</el-button>
                         </div>
-                        <!-- Rp 区:参考 suitMadePad 处方笺 -->
                         <div class="syjs-rp">
                             <div class="syjs-rp-detail">
                                 <!-- 类型 -->
@@ -305,6 +304,21 @@
                 if (!item || !item.treatmentList || !item.treatmentList.length) return false;
                 return item.treatmentList.some((t) => t.treatNum);
             },
+            // 适宜技术转方:跳转开方页面带 recordId(来源就诊记录id),由开方页面调 getRecipeBySuitTech 回显
+            syjsTurn() {
+                const pid = this.info.pid;
+                if (this.$route.path == '/index/prescribing') {
+                    console.log('当前页面是开方页面,跳转到适宜技术转方页面', pid)
+                    this.$router.replace({
+                        path: '/index/trunPage?suitRecordId=' + pid
+                    })
+                } else {
+                    this.$router.replace({
+                        path: '/index/prescribing?suitRecordId=' + pid
+                    })
+                }
+                this.$parent.$parent.$parent.showCase = false
+            },
             // 中药转方
             zyTurn(item) {
                 console.log(this.$route, '页面路由')

+ 3 - 0
src/utils/minix/prescribing.js

@@ -179,6 +179,9 @@ export default {
         setUpdateDp(){/* 将模态框的值同步到处方数据 bottom_form */},
         openAddress() {
             clearTimeout(hack_openAddress_true);
+            // 只在中药处方 tab 高亮时才弹出地址弹窗
+            if (this.container_i !== 0) return;
+
             if (!this.isShowPs) this.isPs = 1;
             if (!this.isShowDj) this.isDaiJian = 2;
 

+ 2 - 2
src/views/business/SuitableTech.vue

@@ -479,7 +479,7 @@
               <el-checkbox v-model="editData.isUnified" class="unified-checkbox">统建处方</el-checkbox>
             </div>
             <div class="form-item flex flex-col-center" v-if="editData.isUnified">
-              <div class="name"><span style="color: red">*</span> 医派:</div>
+              <div class="name">医派:</div>
               <div class="input">
                 <el-input
                   size="mini"
@@ -489,7 +489,7 @@
               </div>
             </div>
             <div class="form-item flex flex-col-center" v-if="editData.isUnified">
-              <div class="name"><span style="color: red">*</span> 科室:</div>
+              <div class="name">科室:</div>
               <div class="input">
                 <el-input
                   size="mini"

+ 15 - 15
src/views/business/components/AcupointTable.vue

@@ -389,7 +389,7 @@
                   placeholder="请输入"
                   v-model="pointMatchGuide"
                   type="textarea"
-                  auto-size="{ minRows: 1, maxRows: 4 }"
+                  :autosize="{ minRows: 1, maxRows: 3 }"
                   :disabled="isLocked"
                   @input="emitStatistics"
                 ></el-input>
@@ -406,7 +406,7 @@
                   placeholder="请输入"
                   v-model="operationGuide"
                   type="textarea"
-                  auto-size="{ minRows: 1, maxRows: 4 }"
+                  :autosize="{ minRows: 1, maxRows: 3 }"
                   :disabled="isLocked"
                   @input="emitStatistics"
                 ></el-input>
@@ -424,7 +424,7 @@
                   placeholder="请输入"
                   v-model="command"
                   type="textarea"
-                  auto-size="{ minRows: 1, maxRows: 2 }"
+                  :autosize="{ minRows: 1, maxRows: 3 }"
                   :disabled="isLocked"
                   @input="emitStatistics"
                 ></el-input>
@@ -701,7 +701,7 @@ export default {
     },
     detailTypes: {
       type: Array,
-      default: () => ["穴位"],
+      default: () => ["经络"],
     },
     statistics: {
       type: Object,
@@ -750,15 +750,15 @@ export default {
       meridianList: [],
       earAcupointList: [],
       detailTables: {
-        经络: [],
-        穴位: [createEmptyRow(1)],
+        经络: [createEmptyRow(1)],
+        穴位: [],
         耳穴: [],
         部位: [],
         其他详情: [],
         无详情: [],
       },
       innerIsEditable: this.isEditable,
-      innerDetailTypes: ["穴位"],
+      innerDetailTypes: ["经络"],
       detailRequired: false,
       // 统计相关
       currentUnitPrice: 0,
@@ -1153,8 +1153,8 @@ export default {
           if (this.prescriptions.length === 0) {
             this.activeIndex = 0;
             this.detailTables = {
-              经络: [],
-              穴位: [createEmptyRow(1)],
+              经络: [createEmptyRow(1)],
+              穴位: [],
               耳穴: [],
               部位: [],
               其他详情: [],
@@ -1171,8 +1171,8 @@ export default {
     clearAll() {
       if (!this.prescriptions.length) {
         this.detailTables = {
-          经络: [],
-          穴位: [createEmptyRow(1)],
+          经络: [createEmptyRow(1)],
+          穴位: [],
           耳穴: [],
           部位: [],
           其他详情: [],
@@ -1187,8 +1187,8 @@ export default {
         this.totalPrice = "0.00";
         this.currentUnitPrice = 0;
         this.innerIsEditable = "1";
-        this.innerDetailTypes = ["穴位"];
-        this._prevDetailTypes = ["穴位"];
+        this.innerDetailTypes = ["经络"];
+        this._prevDetailTypes = ["经络"];
         this.detailRequired = false;
         this.emitStatistics();
         return;
@@ -1650,7 +1650,7 @@ export default {
       this.prescriptionDataMap = {};
 
       treatmentList.forEach((item, index) => {
-        const unitPrice = Number(item.basisStitutionsnondrug.price) || 0;
+        const unitPrice = Number(item.basisStitutionsnondrug?.price) || 0;
         const pricingUnit = item.basisStitutionsnondrug?.pricingUnit || "";
         this.prescriptions.push({
           category: "",
@@ -1734,7 +1734,7 @@ export default {
         this.prescriptionDataMap[index] = {
           detailTables,
           innerIsEditable: item.isUpdate || "1",
-          innerDetailTypes: activeTypes.size > 0 ? [...activeTypes] : ["穴位"],
+          innerDetailTypes: activeTypes.size > 0 ? [...activeTypes] : ["经络"],
           detailRequired: item.basisStitutionsnondrug?.detailIsnull === "1",
           operationGuide: item.useExplain || "",
           command: item.command || "",

+ 204 - 51
src/views/diagnosis/Prescribing.vue

@@ -272,13 +272,13 @@
         </div>
         <!-- his信息 -->
         <div class="his-msg" v-if="innerWidth>768 " style="flex-wrap: wrap;">
-          <div class="his-item" v-if="Object.keys(patiensMsg).length>0">
+          <!-- <div class="his-item" v-if="Object.keys(patiensMsg).length>0">
             <div class="name">HIS病名:</div>
             <div class="value">
               <el-input size="mini" disabled :value="patiensMsg.maindiagnosis.namemedicinehis ||''"></el-input>
             </div>
-          </div>
-          <div class="his-item" v-if="Object.keys(patiensMsg).length>0">
+          </div> -->
+          <!-- <div class="his-item" v-if="Object.keys(patiensMsg).length>0">
             <div class="name">HIS证型:</div>
             <div class="value">
               <el-input
@@ -287,7 +287,7 @@
                 :value="patiensMsg.maindiagnosis.syndrometypeshis || ''"
               ></el-input>
             </div>
-          </div>
+          </div> -->
           <!-- 西医诊断 - 仅适宜技术处方 tab 显示 -->
           <div class="his-item" v-if="container_i == 2 && patiensMsg.maindiagnosis">
             <div class="name">西医主诊断:</div>
@@ -575,7 +575,7 @@
     <div class="pre-right" v-show="container_i==2 && !isShrink">
       <SuitTechSidePanel
         :recommendations="rRecomendR"
-        :activeId="tjRecipeId"
+        :activeId="suitTjRecipeId"
         :safetyItems="suitActiveSafety"
         @select="onSuitRecommendSelect"
       />
@@ -1068,7 +1068,7 @@
       distanceTop="5vh"
     >
       <div slot="body">
-        <PrescriptionUnifySuit></PrescriptionUnifySuit>
+        <PrescriptionUnifySuit @turn="onSuitTechTurn"></PrescriptionUnifySuit>
       </div>
     </Popup>
 
@@ -1082,7 +1082,7 @@
       distanceTop="5vh"
     >
       <div slot="body">
-        <PrescriptionSuit></PrescriptionSuit>
+        <PrescriptionSuit @turn="onSuitTechTurn"></PrescriptionSuit>
       </div>
     </Popup>
 
@@ -1178,7 +1178,8 @@ import {
   getPreNumber,
   getRecipePriview,
   getMaxMinDoaseNumber,
-  getRecipeByBasis
+  getRecipeByBasis,
+  getRecipeBySuitTech
 } from "@/api/diagnosis.js";
 import { numberToUpperCase } from "@/utils/format.js";
 import { addRecipeFrom } from "@/api/dataAnalysis.js";
@@ -1261,7 +1262,8 @@ export default {
       isTuiDaoZj: false, // 中药制剂是否推导过
       isTuiDaoZy: false, // 中药处方是否推导过
       raDoseShow: false,
-      tjRecipeId: "", // 当前选中推荐 方剂的 id
+      tjRecipeId: "", // 当前选中推荐 方剂的 id(中药处方/制剂用)
+      suitTjRecipeId: "", // 适宜技术专用高亮 id(独立于 tjRecipeId,避免跨 tab 串扰)
       suitActiveSafety: [], // 适宜技术右侧「安全合理检测」项目(传给 SuitTechSidePanel :safetyItems)
 
       isMyMade: true, // 是否是自拟处方
@@ -1493,14 +1495,17 @@ export default {
     async _processRouteQuery() {
       const query = this.$route.query || {};
       console.log('query======', sessionStorage.getItem("prescr" + this.getPatiensInfo.pid));
-      console.log('query.recipeID && query.kjType === "kj-fj"', query.recipeID, query.kjType === "kj-fj");
       // 暂存处方数据(不含药品)
       if (sessionStorage.getItem("prescr" + this.getPatiensInfo.pid)) await this._showDataFromStorage(true);
-
+      console.log(query,"query获取的数据")
       // 名医名方 —> 方剂查询
       if (query.recipeID && query.kjType === "kj-fj") await this.getPreDetal(query.recipeID);
       // 就诊记录转方
       else if (query.recipeID) await this.getRecipeDataByid(this.$route.query.recipeID);
+      // 适宜技术病历转方
+      else if (query.suitRecordId) await this.suitTechRecordTurn(query.suitRecordId);
+      // 处方管理 适宜技术转方
+      // else if (query.suitRecipeId) await this.suitRecipeIdTurn(query.suitRecipeId);
       // 名医名方 —> 名医医案
       else if (query.doctorCase) await this.changeAndJoin();
       // 中医诊疗 -> 智能辨证
@@ -1521,10 +1526,13 @@ export default {
       else if (sessionStorage.getItem("prescr" + this.getPatiensInfo.pid)) await this._showDataFromStorage();
       // 历史处方
       else {
+        console.log('获取回显数据',11)
         // 跟据就诊记录id获取处方号
         let res = await getPreNumber({pid: this.getPatiensInfo.pid}).catch(() => void 0);
+        console.log('获取回显数据结果', res);
         const has = res && res.ResultCode == 0 && res.Data.length > 0;
         if (has) await this.getRecipeShowData();
+
         else if (this.getEditPreNo()) await this.getRecipeDataByid(this.getEditPreNo());
       }
     },
@@ -1598,6 +1606,11 @@ export default {
                 }
               });
             }
+            // 不管当前在哪个 tab 点推导,适宜技术都自动填入第一个推荐方案内容
+            // (当前 tab 是适宜技术时已由上方 inferRecipe(2,'7') 内部 fillSuitTechOnInfer 处理,此处补非适宜技术 tab)
+            if (current.id !== '2' && results['7']) {
+              this.fillSuitTechOnInfer(results['7']);
+            }
             if (this.getPatiensInfo.pid) await this.getPatiensBasisM();
           }
         } catch (_) {}
@@ -1635,6 +1648,7 @@ export default {
         rRecomendR: this.rRecomendR,
         suggestDiag: this.suggestDiag,
         suggestDiagAll: this.suggestDiagAll,
+        suitTjRecipeId: this.suitTjRecipeId,
         child1: {
           recipe_tabs: child1.recipe_tabs,
           recipe_tabs_c: child1.recipe_tabs_c
@@ -1673,6 +1687,7 @@ export default {
       let storageData = JSON.parse(
         sessionStorage.getItem("prescr" + this.getPatiensInfo.pid)
       );
+      console.log(storageData, "storageData");
       let children = this.$children.filter(item => {
         return (
           item.name == "中药处方" ||
@@ -1714,6 +1729,7 @@ export default {
       this.rRecomendR = Array.isArray(storageData.rRecomendR) ? storageData.rRecomendR : [];
       this.suggestDiag = Array.isArray(storageData.suggestDiag) ? storageData.suggestDiag : [];
       this.suggestDiagAll = Array.isArray(storageData.suggestDiagAll) ? storageData.suggestDiagAll : [];
+      this.suitTjRecipeId = storageData.suitTjRecipeId || "";
       // child1.getSelectType("剂型", 0);
       // child1.getSelectType("处方用法");
       // child1.getSelectType("中药服药时间");
@@ -2560,6 +2576,7 @@ export default {
     },
     // 获取数据 赋值给 适宜技术处方
     assignRecipe3(data, loading) {
+      console.log('适宜技术数据', data); 
       setTimeout(() => {
         const acupointTable = this.$refs.suitScience;
         if (!acupointTable) {
@@ -2636,17 +2653,31 @@ export default {
 
         // 合并所有数据中的treatmentList
         const mergedTreatmentList = dataArray.reduce((acc, item) => {
-          if (item.treatmentList && Array.isArray(item.treatmentList)) {
-            acc.push(...item.treatmentList);
+          // if ((item.treatmentList || item.detail) && Array.isArray(item.treatmentList || item.detail)) {
+          //   acc.push(...(item.treatmentList || item.detail));
+          // }
+          const list = item.treatmentList?.length ? item.treatmentList : item.detail;
+          if (Array.isArray(list)) {
+            acc.push(...list);
           }
           return acc;
         }, []);
-
+        // [临时诊断] 看治疗项各字段值(嘱托/金额等),定位完删除                                                                               
+        console.log('[assignRecipe3诊断] 治疗项0 完整数据:', mergedTreatmentList[0]);  
         // 使用 loadFromServerData 加载合并后的治疗列表数据
         if (mergedTreatmentList.length > 0) {
           acupointTable.loadFromServerData(mergedTreatmentList);
         }
 
+        // 嘱托(command)在处方级(technologies[i].command),loadFromServerData 按治疗项取不到,补设到组件
+        const _prescriptionCommand = techData.command || "";
+        acupointTable.command = _prescriptionCommand;
+        if (acupointTable.prescriptionDataMap) {
+          Object.keys(acupointTable.prescriptionDataMap).forEach(idx => {
+            acupointTable.prescriptionDataMap[idx].command = _prescriptionCommand;
+          });
+        }
+
         loading.close();
       }, 500);
     },
@@ -3078,6 +3109,7 @@ export default {
         // [原逻辑·保留] AcupointTable 无 recipeId 字段,child.recipeId 为 undefined,
         // 覆盖会清空 inferRecipe 已设的适宜技术默认高亮(pres[0]),故不再覆盖
         // try { this.tjRecipeId = child.recipeId; } catch (e) { this.tjRecipeId = "" }
+        // 适宜技术高亮由独立变量 suitTjRecipeId 管理(fillSuitTechOnInfer/onSuitRecommendSelect 设置),切tab无需在此处理
       }
     },
     checked(item1) {
@@ -3544,6 +3576,7 @@ export default {
         spinner: "el-icon-loading",
         background: "rgba(0, 0, 0, 0.7)"
       });
+      console.log(zhongyao, zhongchengyao, technology, "处方预览数据");
       let params = {
         recordid: this.getPatiensInfo.pid,
         technologies: technology,
@@ -3583,6 +3616,7 @@ export default {
       let res = await getRecipeShowData(this.getPatiensInfo.pid).catch(err => {
         loading.close();
       });
+      console.log(res, "处方回显数据");
       if (res.ResultCode == 0) {
         if (!res.Data.flag) {
           loading.close();
@@ -3593,7 +3627,10 @@ export default {
         }
         this.contentTabs[0].check = res.Data.zhongyao.length > 0;
         this.contentTabs[1].check = res.Data.zhongchengyao.chengDetail !== null;
-        this.contentTabs[2].check = res.Data.technology.detail !== null;
+        // 适宜技术回显:后端字段由 technology(单数对象) 改为 technologies(复数/数组),兼容旧字段
+        // const _techRaw = res.Data.technologies != null ? res.Data.technologies : res.Data.technology;
+        // const techList = Array.isArray(_techRaw) ? _techRaw : (_techRaw ? [_techRaw] : []);
+        this.contentTabs[2].check = res.Data.technologies.length > 0;
 
         this.container_i = Math.max(this.contentTabs.findIndex(item => item.check), 0);
 
@@ -3612,8 +3649,11 @@ export default {
           this._recipeIsPay(res.Data.zhongchengyao.preId, 2);
         }
         if (this.contentTabs[2].check) {
-          this.assignRecipe3(res.Data.technology, loading);
-          this._recipeIsPay(res.Data.technology.preId, 2);
+          // 适宜技术支持多条处方,按数组回显(assignRecipe3 内部已兼容数组并合并 treatmentList)
+          this.assignRecipe3(res.Data.technologies, loading);
+          res.Data.technologies.forEach((item, index) => {
+            if (item && item.preId) this._recipeIsPay(item.preId, 2, index);
+          });
         }
         if (this.getPatiensInfo.pid) {
           this.getPatiensBasisM();
@@ -3635,7 +3675,7 @@ export default {
       let res = await getRecipeDataByid(params).catch(err => {
         loading.close();
       });
-
+console.log(res, "处方回显数据==处方管理",res.Data.type); 
       if (res.ResultCode == 0) {
         if (res.Data.type == 0) {
           res.Data.zhongdetail = res.Data.detail;
@@ -3659,11 +3699,80 @@ export default {
           this.contentTabs[1].check = false;
           this.contentTabs[2].check = true;
           this.assignRecipe3(res.Data, loading);
+          // 回显的是已保存处方(非推荐方案),清空推荐高亮
+          this.suitTjRecipeId = "";
         }
 
         await this._recipeIsPay(id, 1);
       }
     },
+    // 适宜技术病历转方回显(getRecipeBySuitTech,入参 recordId=来源就诊记录id)
+    async suitTechRecordTurn(recordId) {
+      const loading = this.$loading({
+        lock: true,
+        text: '正在处理转方数据',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)',
+      });
+      try {
+        const res = await getRecipeBySuitTech({ recordId });
+        console.log('适宜技术病历转方回显', res);
+        if (res.ResultCode === 0 && res.Data) {
+          console.log('获取数据', res.Data);
+          this.container_i = 2;
+          this.contentTabs[0].check = false;
+          this.contentTabs[1].check = false;
+          this.contentTabs[2].check = true;
+          // 转方是主动换方案:清掉切tab缓存,避免 assignRecipe3 开头 restoreCachedData 拦截
+          if (this.$refs.suitScience) {
+            this.$refs.suitScience._cachedPrescriptions = null;
+            this.$refs.suitScience._cachedPrescriptionDataMap = null;
+          }
+          this.assignRecipe3(res.Data, loading);
+          // 病历转方回显(非推荐方案),清空推荐高亮
+          this.suitTjRecipeId = "";
+        } else {
+          loading.close();
+        }
+      } catch (e) {
+        loading.close();
+        console.error('适宜技术病历转方失败', e);
+      }
+    },
+    // 处方管理 适宜技术转方
+    async suitTechRecipeTurn(preId) {
+      const loading = this.$loading({
+        lock: true,
+        text: '正在处理转方数据',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)',
+      });
+      console.log('适宜技术处方转方入参', preId); 
+      try {
+        const res = await getRecipeBySuitTech({ preId });
+        console.log('适宜技术处方转方回显', res);
+        if (res.ResultCode === 0 && res.Data) {
+          console.log('获取数据', res.Data);
+          this.container_i = 2;
+          this.contentTabs[0].check = false;
+          this.contentTabs[1].check = false;
+          this.contentTabs[2].check = true;
+          // 转方是主动换方案:清掉切tab缓存,避免 assignRecipe3 开头 restoreCachedData 拦截
+          if (this.$refs.suitScience) {
+            this.$refs.suitScience._cachedPrescriptions = null;
+            this.$refs.suitScience._cachedPrescriptionDataMap = null;
+          }
+          this.assignRecipe3(res.Data, loading);
+          // 病历转方回显(非推荐方案),清空推荐高亮
+          this.suitTjRecipeId = "";
+        } else {
+          loading.close();
+        }
+      } catch (e) {
+        loading.close();
+        console.error('适宜技术处方转方失败', e);
+      }
+    },
     //获取右侧协定方列表
     async getAgreeRecipe(load = true) {
       if (!load) return;
@@ -3824,7 +3933,7 @@ export default {
         loading.close();
 
         let arr = [];
-
+console.log(res.data, "获取的数据");
         res.data.expList.forEach(item => {
           item.showType = 1; // 专家经验
           item.book = item.book ? item.book : "(暂无)";
@@ -3836,7 +3945,7 @@ export default {
         });
         // this.inferRecipeId = res.data.schemes[0].preid
         let arr2 = res.data.expList.concat(res.data.schemes[0].pres);
-
+console.log(arr2, "arr2");
         if (type == 4) {
           try { this.contentTabs.find(tab => tab.businesstype === businesstype).color = arr2.length > 0 ? "red" : ""; } catch (e) {}
           return;
@@ -3862,13 +3971,13 @@ export default {
           }
         }
         this.rRecomendR = arr2;
-
-        // 适宜技术:SuitTechSidePanel 面板只显示 pres(showType==0),默认高亮其第一项
-        // (通用 arr2[0] 可能是专家经验 expList、面板不显示,故适宜技术覆盖为 pres[0])
-        if (this.container_i == 2) {
+console.log(this.rRecomendR, "this.rRecomendR");
+        // 适宜技术:用独立高亮变量 suitTjRecipeId(与中药处方/制剂的 tjRecipeId 解耦),
+        // 仅推导(type!=3)时默认设第一个;切tab不重置,保留 fillSuitTechOnInfer/onSuitRecommendSelect 已设的值
+        if (this.container_i == 2 && type !== 3) {
           const presList = (res.data.schemes && res.data.schemes[0] && res.data.schemes[0].pres) || [];
           if (presList.length > 0) {
-            this.tjRecipeId = presList[0].preid || presList[0].pid || presList[0].acupreid;
+            this.suitTjRecipeId = presList[0].preid || presList[0].pid || presList[0].acupreid;
           }
         }
 
@@ -3926,31 +4035,9 @@ export default {
               this.isTuiDaoZy = true;
             }
           } else if (this.container_i == 2) {
-            // 仅推导(type=1/2)时拉取推荐方案并填入;切 tab(type=3)不拉接口、不埋点,
-            // 保留用户上次编辑/缓存(AcupointTable 是 v-show 常驻,prescriptions 切 tab 本就不丢)
             if (type !== 3) {
-              if (arr2.length > 0) {
-                const loading3 = this.$loading({
-                  lock: true,
-                  text: '正在获取适宜技术处方数据',
-                  spinner: 'el-icon-loading',
-                  background: 'rgba(0, 0, 0, 0.7)',
-                });
-                try {
-                  const recipeRes = await getRecipeByBasis({
-                    sourcePid: arr2[0].pid,
-                    recordId: this.getPatiensInfo.pid || undefined,
-                    sourceType: 'localExpert',
-                  });
-                  if (recipeRes.ResultCode === 0 && recipeRes.Data) {
-                    this.assignRecipe3(recipeRes.Data, loading3);
-                  } else {
-                    loading3.close();
-                  }
-                } catch (e) {
-                  loading3.close();
-                }
-              }
+              // 适宜技术推导填入第一个方案(逻辑提取到 fillSuitTechOnInfer,tcmClick 非适宜技术tab也复用)
+              this.fillSuitTechOnInfer(res);
               this.addRecipeFrom("4", 2);
             }
             if (type == 3) {
@@ -3977,7 +4064,7 @@ export default {
       }
     },
     // 适宜技术 · 协定方转方(详情弹窗「转方」触发)
-    async onSuitTechTurn(pid) {
+    async onSuitTechTurn(pid, detail) {
       const loading = this.$loading({
         lock: true,
         text: '正在转方',
@@ -3991,7 +4078,29 @@ export default {
           sourceType: 'accord',
         });
         if (res.ResultCode === 0 && res.Data) {
+          // 协定方转方:如果详情接口返回了病名、证型、治法,覆盖页面上方的诊断信息
+          if (detail && this.$refs.TCM) {
+            if (detail.disName || detail.synName || detail.theName) {
+              this.$refs.TCM.setParams({
+                namemedicine: detail.disName || '',
+                disid: detail.disId || '',
+                symptomid: detail.synId || '',
+                syndrometypes: detail.synName || '',
+                treatment: detail.theName || ''
+              });
+            }
+          }
+          // 转方是主动换方案:清掉切tab产生的缓存,避免 assignRecipe3 开头 restoreCachedData 用旧数据拦截
+          if (this.$refs.suitScience) {
+            this.$refs.suitScience._cachedPrescriptions = null;
+            this.$refs.suitScience._cachedPrescriptionDataMap = null;
+          }
           this.assignRecipe3(res.Data, loading);
+          // 协定方转方:内容来自协定方(非推荐方案),清空推荐高亮,避免误高亮之前的推荐
+          this.suitTjRecipeId = "";
+          // 转方成功,关闭协定方/医派协定方查询弹窗
+          this.showSuitPresc = false;
+          this.showSuitUnifyPresc = false;
         } else {
           loading.close();
         }
@@ -4022,8 +4131,13 @@ export default {
           sourceType: 'localExpert',
         });
         if (recipeRes.ResultCode === 0 && recipeRes.Data) {
+          // 推荐方案换入是主动换方案:清掉切tab产生的缓存,避免 assignRecipe3 开头 restoreCachedData 用旧数据拦截
+          if (this.$refs.suitScience) {
+            this.$refs.suitScience._cachedPrescriptions = null;
+            this.$refs.suitScience._cachedPrescriptionDataMap = null;
+          }
           this.assignRecipe3(recipeRes.Data, loading);
-          this.tjRecipeId = sourcePid;
+          this.suitTjRecipeId = sourcePid;
         } else {
           loading.close();
         }
@@ -4033,6 +4147,45 @@ export default {
       }
       this.addRecipeFrom("4", 2);
     },
+    // 适宜技术 · 推导后自动填入第一个推荐方案内容(不管当前在哪个 tab)
+    // 当前 tab 是适宜技术时由 inferRecipe(2,'7') 调用;当前 tab 非适宜技术时由 tcmClick 调用
+    async fillSuitTechOnInfer(res) {
+      if (!res || res.code !== 0 || !res.data) return;
+      const presList = (res.data.schemes && res.data.schemes[0] && res.data.schemes[0].pres) || [];
+      if (presList.length === 0) return; // 没有推荐方案则不填入
+      // 默认高亮第一个推荐方案(适宜技术专用高亮变量,立即生效)
+      this.suitTjRecipeId = presList[0].pid;
+      const acupointTable = this.$refs.suitScience;
+      if (!acupointTable) return;
+      if (acupointTable.isPay || acupointTable.paystate == 1) {
+        this.$message.error('当前为已付费处方,暂不支持推导');
+        return;
+      }
+      const loading = this.$loading({
+        lock: true,
+        text: '正在获取适宜技术处方数据',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)',
+      });
+      try {
+        const recipeRes = await getRecipeByBasis({
+          sourcePid: presList[0].pid,
+          recordId: this.getPatiensInfo.pid || undefined,
+          sourceType: 'localExpert',
+        });
+        if (recipeRes.ResultCode === 0 && recipeRes.Data) {
+          // 推导是主动换方案:清掉切tab产生的缓存,避免 assignRecipe3 开头 restoreCachedData 用旧数据拦截
+          acupointTable._cachedPrescriptions = null;
+          acupointTable._cachedPrescriptionDataMap = null;
+          this.assignRecipe3(recipeRes.Data, loading);
+        } else {
+          loading.close();
+        }
+      } catch (e) {
+        loading.close();
+        console.error('适宜技术推导填入失败', e);
+      }
+    },
     onSuitActiveProjectChange(prescription) {
       if (!prescription) {
         this.suitActiveSafety = [];

+ 1 - 6
src/views/diagnosis/components/SuitTechAgreement.vue

@@ -50,7 +50,6 @@ export default {
   data() {
     return {
       activeNames: "personal",
-      // 每组各自持有状态:showType(共享方式 0 个人 / 1 科室 / 2 机构)、列表、是否还有更多
       groups: {
         personal: { showType: 0, list: [], loadMore: true },
         department: { showType: 1, list: [], loadMore: true },
@@ -85,7 +84,6 @@ export default {
       this.loading = true;
       if (reset) {
         this.pageNum = 1;
-        // 重置每组列表与「是否还有更多」,showType 保留
         Object.keys(this.groups).forEach((k) => {
           this.groups[k].list = [];
           this.groups[k].loadMore = true;
@@ -98,11 +96,9 @@ export default {
         });
         if (res.ResultCode === 0 && res.Data) {
           const d = res.Data;
-          // 追加每组列表(三组共用 pageNum,同步翻页)
           this.groups.personal.list = this.groups.personal.list.concat(d.personal || []);
           this.groups.department.list = this.groups.department.list.concat(d.department || []);
           this.groups.institution.list = this.groups.institution.list.concat(d.institution || []);
-          // 按本次点击的分组(currentShowType)判断:对应数组为空 = 该分组没有更多
           this.checkLoadMore(d);
         }
       } catch (e) {
@@ -111,7 +107,6 @@ export default {
         this.loading = false;
       }
     },
-    // 根据本次点击的 showType,判断对应分组返回数组是否为空:空则提示并标记该组无更多
     checkLoadMore(d) {
       const showTypeKey = { 0: "personal", 1: "department", 2: "institution" };
       const key = showTypeKey[this.currentShowType];
@@ -162,7 +157,7 @@ export default {
     },
     onDetailTurn() {
       if (!this.currentPid) return;
-      this.$emit("turn", this.currentPid);
+      this.$emit("turn", this.currentPid, this.detail);
       this.showDetail = false;
     },
   },

+ 30 - 49
src/views/diagnosis/components/prescription-suit.vue

@@ -1,5 +1,5 @@
 <template>
-  <!-- 查询协定方(适宜技术-协定方按钮) -->
+  <!-- 查询协定方 -->
   <div class="prescription">
     <!-- 搜索条件 -->
     <div class="top-filter">
@@ -68,7 +68,7 @@
         </el-form-item>
       </el-form>
       <el-button size="mini" type="primary" @click="searchDis">搜索</el-button>
-      <el-button size="mini" type="warning" @click="clearDis">重置</el-button>
+      <el-button size="mini" type="warning" @click="clearDis">清空</el-button>
     </div>
     <!-- 表格数据展示 -->
     <div class="table">
@@ -99,7 +99,6 @@
   </div>
 </template>
 <script>
-import { getAccordDetail } from "@/api/diagnosis.js";
 import { getSuitableTechList } from "@/api/technology.js";
 import { getDiseaseListMethod } from "@/request/api";
 import { getXDiseaseName } from "@/api/knowledge.js";
@@ -159,13 +158,10 @@ export default {
       this.currentPage = 1;
       this.getAgreeRecipe();
     },
-
-    // ==================== 中医病名(参考 SuitableTech.vue) ====================
     async getDiseaseList(keyword = '') {
       const { list } = await getDiseaseListMethod(1, 9999, { keyword }).catch(() => ({ total: 0, list: [] }));
       this.diseaseList = list;
     },
-    // focus 时若列表为空则加载全部(参考 SuitableTech.vue handleFocus('bm'))
     handleFocusDisease() {
       if (this.diseaseList.length === 0) this.getDiseaseList(this.diseaseKey);
     },
@@ -185,7 +181,6 @@ export default {
       }
     },
 
-    // ==================== 西医诊断(参考 SuitableTech.vue) ====================
     async queryWesternDisease(queryString, cb) {
       await this.searchWesternDisease(queryString);
       if (this.westernDiseaseOptions.length > 0) {
@@ -232,7 +227,7 @@ export default {
         this.westernDiseaseLoading = false;
       }
     },
-    // 滚动到底加载更多(参考 SuitableTech.vue loadMoreWesternDisease)
+    // 滚动到底加载更多
     async loadMoreWesternDisease() {
       if (this.westernDiseaseLoading || !this.westernDiseaseHasMore) return;
       this.westernDiseasePage++;
@@ -263,7 +258,7 @@ export default {
         this.westernDiseaseLoading = false;
       }
     },
-    // 下拉显隐:首次打开加载 + 绑定滚动加载更多(参考 SuitableTech.vue onWesternDiseaseVisible)
+    // 下拉显隐
     onWesternDiseaseVisible(show) {
       if (!show) {
         const wrap = document.querySelector(".western-disease-select .el-scrollbar__wrap");
@@ -304,10 +299,8 @@ export default {
       this.form.westernCode = this.westernCodes.join(",");
     },
 
-    // ==================== 列表与转方 ====================
-    // 协定方转方
     handleAgree(scope) {
-      this.getAccordDetail(scope.row.preId);
+      this.$emit('turn', scope.row.pid);
     },
     //获取协定方列表(使用适宜技术列表接口,status=0, purposeType=1)
     async getAgreeRecipe() {
@@ -325,29 +318,6 @@ export default {
         this.total = res.Data?.totalRecordCount || 0;
         this.tableData1 = res.Data?.Items || [];
       }
-    },
-    //   获取协定方详情(转方)
-    async getAccordDetail(id) {
-      let res = await getAccordDetail({
-        pid: id
-      });
-      if (res.ResultCode == 0) {
-        const recipe = { ...res.Data, medicine: res.Data.preStiDetails, __RecipeFrom__: '2' }
-        this.$parent.$parent.$parent.transposition(recipe);
-        if (res.Data.diseaseid) {
-          this.$parent.$parent.$parent.$refs.TCM.setParams({
-            namemedicine: res.Data.diseasename,
-            disid: res.Data.diseaseid,
-            symptomid: res.Data.symptomid,
-            syndrometypes: res.Data.symptomname,
-            treatment: res.Data.treatment
-          });
-
-          setTimeout(() => {
-            this.$parent.$parent.$parent.tcmClick(false);
-          }, 200);
-        }
-      }
     }
   }
 };
@@ -372,17 +342,16 @@ export default {
   }
 }
 
-// 西医诊断多选 wrapper(外观对齐中医病名 el-input:同宽 150px / 同高 28px / 同边框)
 .western-disease-input-wrapper {
-  display: flex;
+  display: inline-flex;
   flex-wrap: wrap;
   align-items: center;
-  width: 150px;
+  width: 220px;
   min-height: 28px;
   box-sizing: border-box;
   border: 1px solid #dcdfe6;
   border-radius: 4px;
-  padding: 0 8px;
+  padding: 0 15px;
   cursor: text;
 
   .el-tag {
@@ -392,18 +361,17 @@ export default {
     text-overflow: ellipsis;
   }
 
-  .el-autocomplete {
+  ::v-deep .el-autocomplete {
     flex: 1;
     min-width: 60px;
-
-    ::v-deep .el-input__inner {
-      border: none !important;
-      padding: 0;
-      height: 28px;
-      line-height: 28px;
-      width: 100%;
-      background: transparent;
-    }
+  }
+  ::v-deep .el-autocomplete .el-input__inner {
+    border: none !important;
+    padding: 0;
+    height: 26px !important;
+    line-height: 26px !important;
+    width: 100% !important;
+    background: transparent;
   }
 
   &:hover {
@@ -472,3 +440,16 @@ export default {
   justify-content: center;
 }
 </style>
+
+<style lang="scss">
+.western-disease-select.el-autocomplete-suggestion {
+  .el-autocomplete-suggestion__wrap {
+    max-height: 200px;
+  }
+  .el-autocomplete-suggestion__list li {
+    padding: 8px 12px;
+    font-size: 14px;
+    line-height: 20px;
+  }
+}
+</style>

+ 4 - 29
src/views/diagnosis/components/prescription-unify-suit.vue

@@ -1,5 +1,5 @@
 <template>
-  <!-- 查询医派协定方(适宜技术-医派协定方按钮) -->
+  <!-- 查询医派协定方 -->
   <div class="prescription">
     <!-- 搜索条件 -->
     <div class="top-filter">
@@ -21,7 +21,7 @@
         </el-form-item>
       </el-form>
       <el-button size="small" type="primary" @click="searchDis">搜索</el-button>
-      <el-button size="small" type="warning" @click="clearDis">重置</el-button>
+      <el-button size="small" type="warning" @click="clearDis">清空</el-button>
     </div>
     <!-- 表格数据展示 -->
     <div class="table">
@@ -31,7 +31,7 @@
         <el-table-column prop="sectDept" label="科室" align="center" width="120" show-overflow-tooltip></el-table-column>
         <el-table-column prop="name" label="方名" align="center" show-overflow-tooltip></el-table-column>
         <el-table-column prop="effect" label="功效与适用症" align="center" show-overflow-tooltip></el-table-column>
-        <el-table-column prop="drugInformation" label="涵盖项目" align="center" show-overflow-tooltip></el-table-column>
+        <el-table-column prop="coverageContent" label="涵盖项目" align="center" show-overflow-tooltip></el-table-column>
         <el-table-column prop="provenance" label="处方出处" align="center" width="150" show-overflow-tooltip></el-table-column>
         <el-table-column prop="address" label="操作" width="80" align="center">
           <template slot-scope="scope">
@@ -55,7 +55,6 @@
 </template>
 <script>
 import { getEffectQuery } from "@/api/knowledge.js";
-import { getAccordDetail } from "@/api/diagnosis.js";
 import { getSuitableTechList } from "@/api/technology.js";
 import { getHospitalCategory, getHospitalDepartment } from "@/api/city";
 
@@ -108,9 +107,8 @@ export default {
       this.currentPage = 1;
       this.getAgreeRecipe();
     },
-    // 协定方转方
     handleAgree(scope) {
-      this.getAccordDetail(scope.row.preId);
+      this.$emit('turn', scope.row.pid);
     },
     // 获取方剂分类
     async getEffectQuery() {
@@ -138,29 +136,6 @@ export default {
         this.total = res.Data?.totalRecordCount || 0;
         this.tableData1 = res.Data?.Items || [];
       }
-    },
-    //   获取协定方详情(转方)
-    async getAccordDetail(id) {
-      let res = await getAccordDetail({
-        pid: id
-      });
-      if (res.ResultCode == 0) {
-        const recipe = { ...res.Data, medicine: res.Data.preStiDetails, __RecipeFrom__: '2' }
-        this.$parent.$parent.$parent.transposition(recipe);
-        if (res.Data.diseaseid) {
-          this.$parent.$parent.$parent.$refs.TCM.setParams({
-            namemedicine: res.Data.diseasename,
-            disid: res.Data.diseaseid,
-            symptomid: res.Data.symptomid,
-            syndrometypes: res.Data.symptomname,
-            treatment: res.Data.treatment
-          });
-
-          setTimeout(() => {
-            this.$parent.$parent.$parent.tcmClick(false);
-          }, 200);
-        }
-      }
     }
   }
 };