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

bug-769:协定方列表和医派协定方列表的记录可点击查看详情以及bug-750:协定方和医派协定方以及推导方案转方时带入病名、证型、治法、建议诊断

张田田 1 неделя назад
Родитель
Сommit
35d7399ace

+ 73 - 28
src/views/diagnosis/Prescribing.vue

@@ -1068,7 +1068,7 @@
       distanceTop="5vh"
     >
       <div slot="body">
-        <PrescriptionUnifySuit @turn="onSuitTechTurn"></PrescriptionUnifySuit>
+        <PrescriptionUnifySuit @turn="onSuitTechTurn" @open-detail="openSuitDetail"></PrescriptionUnifySuit>
       </div>
     </Popup>
 
@@ -1082,10 +1082,18 @@
       distanceTop="5vh"
     >
       <div slot="body">
-        <PrescriptionSuit @turn="onSuitTechTurn"></PrescriptionSuit>
+        <PrescriptionSuit @turn="onSuitTechTurn" @open-detail="openSuitDetail"></PrescriptionSuit>
       </div>
     </Popup>
 
+    <!-- 协定方详情弹窗(查询弹窗点行查看;置于顶层,避免被查询弹窗 mask 遮挡) -->
+    <SuitTechAgreementDetail
+      :show.sync="suitDetailShow"
+      :detail="suitDetailData"
+      :loading="suitDetailLoading"
+      @turn="onSuitDetailTurn"
+    />
+
     <!-- 查询舌象分析 页面768 -->
     <Popup
         :showDialog="showTongueAnalysis"
@@ -1160,6 +1168,7 @@ import medAdress from "./components/medAddress.vue";
 import medAdressNew from "./components/medAddressNew.vue";
 import SuitTechAgreement from "./components/SuitTechAgreement.vue";
 import SuitTechSidePanel from "./components/SuitTechSidePanel.vue";
+import SuitTechAgreementDetail from "./components/SuitTechAgreementDetail.vue";
 import {
   getPatiensBasisM,
   refreshElectronicInfo,
@@ -1206,6 +1215,7 @@ import {
 
 import { mapState, mapGetters, mapActions, mapMutations } from "vuex";
 import { getExperinceDetail } from "@/api/business.js";
+import { getSuitableTechInfo } from "@/api/technology.js";
 import { setTimeout } from "timers";
 import prescribing from "../../utils/minix/prescribing";
 
@@ -1237,7 +1247,8 @@ export default {
     medAdress,
     medAdressNew,
     SuitTechAgreement,
-    SuitTechSidePanel
+    SuitTechSidePanel,
+    SuitTechAgreementDetail
   },
   data() {
     return {
@@ -1265,6 +1276,11 @@ export default {
       tjRecipeId: "", // 当前选中推荐 方剂的 id(中药处方/制剂用)
       suitTjRecipeId: "", // 适宜技术专用高亮 id(独立于 tjRecipeId,避免跨 tab 串扰)
       suitActiveSafety: [], // 适宜技术右侧「安全合理检测」项目(传给 SuitTechSidePanel :safetyItems)
+      // 顶层协定方详情弹窗(查询弹窗点行查看;提升到顶层避免被查询弹窗 mask 遮挡)
+      suitDetailShow: false,
+      suitDetailData: {},
+      suitDetailLoading: false,
+      suitDetailPid: "",
 
       isMyMade: true, // 是否是自拟处方
 
@@ -4174,6 +4190,55 @@ console.log(this.rRecomendR, "this.rRecomendR");
         }, 500);
       }
     },
+    // 打开顶层协定方详情弹窗(查询弹窗点行触发;提到顶层,避免详情弹窗嵌套在查询弹窗里被 mask 遮挡)
+    async openSuitDetail(pid) {
+      if (!pid) return;
+      this.suitDetailPid = pid;
+      this.suitDetailLoading = true;
+      this.suitDetailShow = true;
+      try {
+        const res = await getSuitableTechInfo(pid);
+        if (res.ResultCode === 0) {
+          this.suitDetailData = res.Data || {};
+        }
+      } catch (e) {
+        console.error("获取协定方详情失败", e);
+      } finally {
+        this.suitDetailLoading = false;
+      }
+    },
+    // 顶层详情弹窗点转方:走协定方转方回填(onSuitTechTurn 内部会关闭查询弹窗)
+    onSuitDetailTurn() {
+      if (!this.suitDetailPid) return;
+      this.suitDetailShow = false;
+      this.onSuitTechTurn(this.suitDetailPid, this.suitDetailData);
+    },
+    // 适宜技术·回填诊断信息:病名/证型/治法 → TCM.setParams;西医诊断 → 建议诊断(suggestDiag)
+    // 协定方转方 / 推荐方案载入 共用;detail 来自 getSuitableTechInfo / getLocalSuitableTechInfo
+    fillSuitTechDiagnosis(detail) {
+      if (!detail) return;
+      if (this.$refs.TCM && (detail.disName || detail.synName || detail.theName)) {
+        this.$refs.TCM.setParams({
+          namemedicine: detail.disName || '',
+          disid: detail.disId || '',
+          disCode: detail.disCode || '',
+          symptomid: detail.synId || detail.synCode || '',
+          syndrometypes: detail.synName || '',
+          treatment: detail.theName || '',
+          therapyCode: detail.theCode || ''
+        });
+      }
+      if (detail.westernCode) {
+        const wdCodes = String(detail.westernCode).split(',').map(s => s.trim()).filter(Boolean);
+        const wdNames = detail.westernDiag ? String(detail.westernDiag).split(',').map(s => s.trim()) : [];
+        wdCodes.forEach((code, i) => {
+          if (code && wdNames[i]) this.westernDiseaseNameMap[code] = wdNames[i];
+        });
+        // 已选 + 候选都用本次数据替换,避免与之前推导/转方的西医诊断累加
+        this.suggestDiag = wdCodes;
+        this.suggestDiagAll = wdCodes.map((code, i) => ({ westcode: code, westname: wdNames[i] || this.westernDiseaseNameMap[code] || code }));
+      }
+    },
     // 适宜技术 · 协定方转方(详情弹窗「转方」触发)
     async onSuitTechTurn(pid, detail) {
       console.log('onSuitTechTurn 参数:', { pid, detail });
@@ -4201,30 +4266,8 @@ console.log(this.rRecomendR, "this.rRecomendR");
           }
           res.Data = checkResult.filteredData.length === 1 ? checkResult.filteredData[0] : checkResult.filteredData;
 
-          // 协定方转方:如果详情接口返回了病名、证型、治法,覆盖页面上方的诊断信息
-          console.log('回填诊断信息:', { detail, hasTCM: !!this.$refs.TCM });
-          if (detail && this.$refs.TCM) {
-            if (detail.disName || detail.synName || detail.theName) {
-              console.log('调用 setParams:', {
-                namemedicine: detail.disName || '',
-                disid: detail.disId || '',
-                disCode: detail.disCode || '',
-                symptomid: detail.synId || detail.synCode || '',
-                syndrometypes: detail.synName || '',
-                treatment: detail.theName || '',
-                therapyCode: detail.theCode || ''
-              });
-              this.$refs.TCM.setParams({
-                namemedicine: detail.disName || '',
-                disid: detail.disId || '',
-                disCode: detail.disCode || '',
-                symptomid: detail.synId || detail.synCode || '',
-                syndrometypes: detail.synName || '',
-                treatment: detail.theName || '',
-                therapyCode: detail.theCode || ''
-              });
-            }
-          }
+          // 协定方转方:回填病名/证型/治法 + 建议诊断(公共方法,推荐方案也复用)
+          this.fillSuitTechDiagnosis(detail);
           // 转方是主动换方案:清掉切tab产生的缓存,避免 assignRecipe3 开头 restoreCachedData 用旧数据拦截
           if (this.$refs.suitScience) {
             this.$refs.suitScience._cachedPrescriptions = null;
@@ -4247,7 +4290,7 @@ console.log(this.rRecomendR, "this.rRecomendR");
       this.addRecipeFrom("2");
     },
     // 适宜技术  推荐方案
-    async onSuitRecommendSelect(item) {
+    async onSuitRecommendSelect(item, detail) {
       const sourcePid = item.pid || item.preid || item.acupreid;
       if (!sourcePid) return;
       // if (this.$refs.suitScience && (this.$refs.suitScience.isPay || this.$refs.suitScience.paystate == 1)) {
@@ -4286,6 +4329,8 @@ console.log(this.rRecomendR, "this.rRecomendR");
           // 转方数据追加到当前处方后面(不覆盖)
           this.assignRecipe3(recipeRes.Data, loading, true);
           this.suitTjRecipeId = sourcePid;
+          // 回填病名/证型/治法 + 建议诊断(detail 由推荐详情弹窗 getLocalSuitableTechInfo 带出)
+          this.fillSuitTechDiagnosis(detail);
         } else {
           loading.close();
         }

+ 5 - 7
src/views/diagnosis/components/SuitTechSidePanel.vue

@@ -87,12 +87,11 @@ export default {
   props: {
     recommendations: { type: Array, default: () => [] },
     activeId: { type: [String, Number], default: "" },
-    // 适宜技术每个项目的「安全合理检测」字段(父组件从 basisStitutionsnondrug 提取后传入)
+    // 适宜技术每个项目的「安全合理检测」字段
     safetyItems: { type: Array, default: () => [] },
   },
   data() {
     return {
-      // 四个字段:有值才渲染,无值连标题一起隐藏
       safetyFields: [
         { key: "connotation", label: "内涵" },
         { key: "excludedContent", label: "除外内容" },
@@ -107,19 +106,18 @@ export default {
     };
   },
   computed: {
-    // 只保留至少有一个字段有值的项目;全部为空时内容不展示(标题仍常驻显示)
     visibleSafetyItems() {
       return (this.safetyItems || []).filter((item) =>
         this.safetyFields.some((f) => item && item[f.key])
       );
     },
-    // 适宜技术推荐:只取 schemes(businesstype=7) 的 pres(showType=0),不含 expList
+    // 适宜技术推荐
     displayRecommendations() {
       return (this.recommendations || []).filter((item) => item.showType == 0);
     },
   },
   methods: {
-    // 点击推荐 name:先弹详情窗(调本地专家适宜技术详情),不再直接载入
+    // 点击推荐
     async openRecommendDetail(item) {
       const pid = item.pid || item.preid || item.acupreid;
       if (!pid) return;
@@ -137,10 +135,10 @@ export default {
         this.detailLoading = false;
       }
     },
-    // 详情窗「转方」:冒泡给父级执行载入处方(沿用原 onSuitRecommendSelect 逻辑)
+    // 详情窗「转方」
     onDetailTurn() {
       if (!this.currentItem) return;
-      this.$emit("select", this.currentItem);
+      this.$emit("select", this.currentItem, this.detail);
       this.showDetail = false;
     },
   },

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

@@ -80,7 +80,7 @@
     </div>
     <!-- 表格数据展示 -->
     <div class="table">
-      <el-table :data="tableData1" border style="width: 100%">
+      <el-table :data="tableData1" border style="width: 100%" @row-click="onRowClick">
         <el-table-column type="index" label="序号" width="60" align="center"></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>
@@ -121,7 +121,7 @@
   </div>
 </template>
 <script>
-import { getSuitableTechList } from "@/api/technology.js";
+import { getSuitableTechList, getSuitableTechInfo } from "@/api/technology.js";
 import { getDiseaseListMethod } from "@/request/api";
 import { getXDiseaseName } from "@/api/knowledge.js";
 
@@ -323,8 +323,34 @@ export default {
       this.form.westernCode = this.westernCodes.join(",");
     },
 
-    handleAgree(scope) {
-      this.$emit('turn', scope.row.pid);
+    async handleAgree(scope) {
+      const row = scope.row;
+      // 转方前取协定方详情,带出病名/证型/治法/西医诊断回填到开方页
+      let info = {};
+      try {
+        const res = await getSuitableTechInfo(row.pid);
+        if (res.ResultCode === 0) info = res.Data || {};
+      } catch (e) {
+        console.error('获取协定方详情失败', e);
+      }
+      const detail = {
+        disName: info.disName || '',
+        disId: info.disId || '',
+        disCode: info.disCode || '',
+        synName: info.synName || '',
+        synId: info.synCode || '',
+        synCode: info.synCode || '',
+        theName: info.theName || '',
+        theCode: info.theCode || '',
+        westernCode: info.westernCode || '',
+        westernDiag: info.westernDiag || '',
+      };
+      this.$emit('turn', row.pid, detail);
+    },
+    // 点击行:通知父级打开顶层协定方详情弹窗
+    onRowClick(row, column) {
+      if (column && column.label === "操作") return;
+      this.$emit("open-detail", row.pid);
     },
     //获取协定方列表(使用适宜技术列表接口,status=0, purposeType=1)
     async getAgreeRecipe() {

+ 31 - 19
src/views/diagnosis/components/prescription-unify-suit.vue

@@ -26,7 +26,7 @@
     <!-- 表格数据展示 -->
     <div class="table">
       <!-- 统建处方(医派协定方)表格 -->
-      <el-table :data="tableData1" border style="width: 100%">
+      <el-table :data="tableData1" border style="width: 100%" @row-click="onRowClick">
         <el-table-column prop="sectCategory" label="医派" align="center" width="120" show-overflow-tooltip></el-table-column>
         <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>
@@ -55,16 +55,15 @@
 </template>
 <script>
 import { getEffectQuery } from "@/api/knowledge.js";
-import { getSuitableTechList, getPreSectInfo } from "@/api/technology.js";
+import { getSuitableTechList, getPreSectInfo, getSuitableTechInfo } from "@/api/technology.js";
 
 export default {
   data() {
     return {
       // 医派信息 Map:key 为医派('' 表示全部派别科室),value 为派别科室列表
       sectInfoMap: {},
-      sectCategoryList: [], // 医派下拉项(Map 的非空 key)
-      sectDeptList: [],     // 科室下拉项(当前医派对应的派别科室,归一化为 {label, value})
-
+      sectCategoryList: [], // 医派下拉项
+      sectDeptList: [],     // 科室下拉项
       form: {
         name: "", // 方名
         sectCategory: '', // 医派
@@ -84,7 +83,7 @@ export default {
     onSectCategoryChange() {
       this.updateSectDeptList();
     },
-    // 派别科室列表项归一化(兼容字符串 / 对象两种后端返回)
+    // 派别科室列表项归一化
     normalizeDept(dept) {
       if (dept == null) return null;
       if (typeof dept === 'string') return { label: dept, value: dept };
@@ -104,12 +103,12 @@ export default {
         this.form.sectDept = '';
       }
     },
-    // 获取医派信息:Data 为 Map,key 为医派,value 为派别科室列表,'' 为全部派别科室
+    // 获取医派信息
     async fetchSectInfo() {
       try {
         const res = await getPreSectInfo();
         this.sectInfoMap = (res && res.Data) ? res.Data : {};
-        // 医派下拉 = Map 的非空 key('' 表示全部,由「不选」体现)
+        // 医派下拉
         this.sectCategoryList = Object.keys(this.sectInfoMap).filter(k => k !== '');
         this.updateSectDeptList();
       } catch (e) {
@@ -140,22 +139,35 @@ export default {
       this.currentPage = 1;
       this.getAgreeRecipe();
     },
-    handleAgree(scope) {
+    async handleAgree(scope) {
       const row = scope.row;
-      console.log('handleAgree row:', row);
+      // 转方前取协定方详情,带出病名/证型/治法/西医诊断回填到开方页
+      let info = {};
+      try {
+        const res = await getSuitableTechInfo(row.pid);
+        if (res.ResultCode === 0) info = res.Data || {};
+      } catch (e) {
+        console.error('获取协定方详情失败', e);
+      }
       const detail = {
-        disName: row.disName || '',
-        disId: row.disId || '',
-        disCode: row.disCode || '',
-        synName: row.synName || '',
-        synId: row.synId || row.synCode || '',
-        synCode: row.synCode || '',
-        theName: row.theName || '',
-        theCode: row.theCode || ''
+        disName: info.disName || '',
+        disId: info.disId || '',
+        disCode: info.disCode || '',
+        synName: info.synName || '',
+        synId: info.synCode || '',
+        synCode: info.synCode || '',
+        theName: info.theName || '',
+        theCode: info.theCode || '',
+        westernCode: info.westernCode || '',
+        westernDiag: info.westernDiag || '',
       };
-      console.log('handleAgree detail:', detail);
       this.$emit('turn', row.pid, detail);
     },
+    // 点击行
+    onRowClick(row, column) {
+      if (column && column.label === "操作") return;
+      this.$emit("open-detail", row.pid);
+    },
     // 获取方剂分类
     async getEffectQuery() {
       let res = await getEffectQuery({