|
|
@@ -1474,6 +1474,61 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ /**
|
|
|
+ * 校验转方数据中是否有已支付的项目
|
|
|
+ * @param {Array|Object} data - 转方数据(可以是数组或单个对象)
|
|
|
+ * @param {string} nameField - 项目名称字段名(默认 'treatItemName')
|
|
|
+ * @returns {Object} { valid: boolean, filteredData: Array, skippedPaid: Array }
|
|
|
+ */
|
|
|
+ checkPaidProjects(data, nameField = 'treatItemName') {
|
|
|
+ const acupointTable = this.$refs.suitScience;
|
|
|
+ const paidNames = new Set();
|
|
|
+
|
|
|
+ // 获取开方页面已支付的项目名称
|
|
|
+ if (acupointTable && acupointTable.prescriptions) {
|
|
|
+ acupointTable.prescriptions.forEach((p, i) => {
|
|
|
+ const presData = acupointTable.prescriptionDataMap[i];
|
|
|
+ if (p.itemName && presData && presData.paystate == 1) {
|
|
|
+ paidNames.add(p.itemName);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果没有已支付项目,直接返回
|
|
|
+ if (paidNames.size === 0) {
|
|
|
+ return { valid: true, filteredData: Array.isArray(data) ? data : [data], skippedPaid: [] };
|
|
|
+ }
|
|
|
+
|
|
|
+ const skippedPaid = [];
|
|
|
+ const dataList = Array.isArray(data) ? data : [data];
|
|
|
+
|
|
|
+ // 只过滤已支付的项目(已存在但未支付的项目会覆盖)
|
|
|
+ dataList.forEach((item) => {
|
|
|
+ const list = item.treatmentList?.length ? item.treatmentList : item.detail;
|
|
|
+ if (!Array.isArray(list)) return;
|
|
|
+ for (let i = list.length - 1; i >= 0; i--) {
|
|
|
+ const itemName = list[i][nameField];
|
|
|
+ // 检查是否已支付
|
|
|
+ if (paidNames.has(itemName)) {
|
|
|
+ skippedPaid.push(itemName);
|
|
|
+ list.splice(i, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 检查是否还有数据
|
|
|
+ const hasData = dataList.some((item) => {
|
|
|
+ const list = item.treatmentList?.length ? item.treatmentList : item.detail;
|
|
|
+ return Array.isArray(list) && list.length > 0;
|
|
|
+ });
|
|
|
+
|
|
|
+ return {
|
|
|
+ valid: hasData,
|
|
|
+ filteredData: dataList,
|
|
|
+ skippedPaid
|
|
|
+ };
|
|
|
+ },
|
|
|
+
|
|
|
async loadRecord(tips = true) {
|
|
|
this.recordLoading = true;
|
|
|
try {
|
|
|
@@ -1497,7 +1552,7 @@ export default {
|
|
|
console.log('query======', sessionStorage.getItem("prescr" + this.getPatiensInfo.pid));
|
|
|
// 暂存处方数据(不含药品)
|
|
|
if (sessionStorage.getItem("prescr" + this.getPatiensInfo.pid)) await this._showDataFromStorage(true);
|
|
|
- console.log(query,"query获取的数据")
|
|
|
+ console.log(query,"query获取的缓存的数据")
|
|
|
// 名医名方 —> 方剂查询
|
|
|
if (query.recipeID && query.kjType === "kj-fj") await this.getPreDetal(query.recipeID);
|
|
|
// 就诊记录转方
|
|
|
@@ -1526,11 +1581,11 @@ 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);
|
|
|
+ console.log('获取处方id的数据', res);
|
|
|
const has = res && res.ResultCode == 0 && res.Data.length > 0;
|
|
|
+ console.log('是否有处方', has);
|
|
|
if (has) await this.getRecipeShowData();
|
|
|
|
|
|
else if (this.getEditPreNo()) await this.getRecipeDataByid(this.getEditPreNo());
|
|
|
@@ -2578,8 +2633,8 @@ export default {
|
|
|
}, 1000);
|
|
|
},
|
|
|
// 获取数据 赋值给 适宜技术处方
|
|
|
- assignRecipe3(data, loading) {
|
|
|
- console.log('适宜技术数据', data);
|
|
|
+ assignRecipe3(data, loading, append = false) {
|
|
|
+ console.log('适宜技术数据', data);
|
|
|
setTimeout(() => {
|
|
|
const acupointTable = this.$refs.suitScience;
|
|
|
if (!acupointTable) {
|
|
|
@@ -2587,8 +2642,8 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- // 优先恢复缓存数据
|
|
|
- if (acupointTable.restoreCachedData()) {
|
|
|
+ // 优先恢复缓存数据(追加模式不恢复缓存)
|
|
|
+ if (!append && acupointTable.restoreCachedData()) {
|
|
|
loading.close();
|
|
|
return;
|
|
|
}
|
|
|
@@ -2603,89 +2658,94 @@ export default {
|
|
|
// 使用第一个数据作为基础处方信息
|
|
|
const techData = dataArray[0];
|
|
|
|
|
|
- // 存储处方级字段,提交时需要用到
|
|
|
- console.log('适宜技术处方赋值数据', techData);
|
|
|
- acupointTable._prescriptionMeta = {
|
|
|
- preId: techData.preId || "",
|
|
|
- technologyType: techData.technologyType || "",
|
|
|
- num: techData.num || 0,
|
|
|
- allprice: techData.allprice || 0,
|
|
|
- thisRecipePrice: techData.thisRecipePrice || 0,
|
|
|
- totalAmount: techData.totalAmount || 0,
|
|
|
- prescribed: techData.prescribed || 0,
|
|
|
- paystate: techData.paystate || 0,
|
|
|
- revierwstate: techData.revierwstate || 0,
|
|
|
- command: techData.command || "",
|
|
|
- useexplain: techData.useexplain || "",
|
|
|
- sourceType: techData.sourceType || "",
|
|
|
- westernDiag: techData.westernDiag || "",
|
|
|
- };
|
|
|
+ // 追加模式下不覆盖处方元数据和支付状态,只追加治疗项
|
|
|
+ if (!append) {
|
|
|
+ // 存储处方级字段,提交时需要用到
|
|
|
+ console.log('适宜技术处方赋值数据', techData);
|
|
|
+ acupointTable._prescriptionMeta = {
|
|
|
+ preId: techData.preId || "",
|
|
|
+ technologyType: techData.technologyType || "",
|
|
|
+ num: techData.num || 0,
|
|
|
+ allprice: techData.allprice || 0,
|
|
|
+ thisRecipePrice: techData.thisRecipePrice || 0,
|
|
|
+ totalAmount: techData.totalAmount || 0,
|
|
|
+ prescribed: techData.prescribed || 0,
|
|
|
+ paystate: techData.paystate || 0,
|
|
|
+ revierwstate: techData.revierwstate || 0,
|
|
|
+ command: techData.command || "",
|
|
|
+ useexplain: techData.useexplain || "",
|
|
|
+ sourceType: techData.sourceType || "",
|
|
|
+ westernDiag: techData.westernDiag || "",
|
|
|
+ };
|
|
|
|
|
|
- // 西医主诊断(只读,接口返回)和建议诊断(用户输入)
|
|
|
- this.westernDiag = techData.westernDiag || '';
|
|
|
- // 建议诊断候选(后端返回的全部)→ 规范化成对象数组,并预填充 name 映射
|
|
|
- const rawSuggest = techData.suggestDiag;
|
|
|
- const rawArr = typeof rawSuggest === 'string'
|
|
|
- ? rawSuggest.split(',').filter(Boolean)
|
|
|
- : Array.isArray(rawSuggest) ? rawSuggest : [];
|
|
|
- this.suggestDiagAll = rawArr.map(it => {
|
|
|
- if (it && typeof it === 'object') {
|
|
|
- const code = it.westcode || it.code;
|
|
|
- return { westcode: code, westname: it.westname || it.name || code };
|
|
|
- }
|
|
|
- return { westcode: it, westname: this.westernDiseaseNameMap[it] || it };
|
|
|
- });
|
|
|
- this.suggestDiagAll.forEach(it => {
|
|
|
- if (it.westcode) this.westernDiseaseNameMap[it.westcode] = it.westname;
|
|
|
- });
|
|
|
- this.suggestDiag = this.suggestDiagAll.length ? [this.suggestDiagAll[0].westcode] : [];
|
|
|
+ // 西医主诊断(只读,接口返回)和建议诊断(用户输入)
|
|
|
+ this.westernDiag = techData.westernDiag || '';
|
|
|
+ // 建议诊断候选(后端返回的全部)→ 规范化成对象数组,并预填充 name 映射
|
|
|
+ const rawSuggest = techData.suggestDiag;
|
|
|
+ const rawArr = typeof rawSuggest === 'string'
|
|
|
+ ? rawSuggest.split(',').filter(Boolean)
|
|
|
+ : Array.isArray(rawSuggest) ? rawSuggest : [];
|
|
|
+ this.suggestDiagAll = rawArr.map(it => {
|
|
|
+ if (it && typeof it === 'object') {
|
|
|
+ const code = it.westcode || it.code;
|
|
|
+ return { westcode: code, westname: it.westname || it.name || code };
|
|
|
+ }
|
|
|
+ return { westcode: it, westname: this.westernDiseaseNameMap[it] || it };
|
|
|
+ });
|
|
|
+ this.suggestDiagAll.forEach(it => {
|
|
|
+ if (it.westcode) this.westernDiseaseNameMap[it.westcode] = it.westname;
|
|
|
+ });
|
|
|
+ this.suggestDiag = this.suggestDiagAll.length ? [this.suggestDiagAll[0].westcode] : [];
|
|
|
+ }
|
|
|
|
|
|
// 合并所有数据中的treatmentList
|
|
|
const mergedTreatmentList = dataArray.reduce((acc, item) => {
|
|
|
- // 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(mergedTreatmentList,'[assignRecipe3诊断] 治疗项0 完整数据:', mergedTreatmentList[0]);
|
|
|
- // 使用 loadFromServerData 加载合并后的治疗列表数据
|
|
|
+
|
|
|
+ // 根据模式选择加载方式
|
|
|
if (mergedTreatmentList.length > 0) {
|
|
|
- acupointTable.loadFromServerData(mergedTreatmentList);
|
|
|
+ if (append) {
|
|
|
+ acupointTable.appendFromServerData(mergedTreatmentList);
|
|
|
+ } else {
|
|
|
+ acupointTable.loadFromServerData(mergedTreatmentList);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- // 处方状态(必须在 loadFromServerData 之后设置,因为 loadFromServerData 会调用 loadTabData 覆盖 paystate)
|
|
|
- if (this.getEditPreNo()) {
|
|
|
- if (techData.revierwstate == 1) {
|
|
|
- acupointTable.prescribed = 0;
|
|
|
- acupointTable.paystate = 0;
|
|
|
+ // 追加模式下不覆盖处方状态和支付状态
|
|
|
+ if (!append) {
|
|
|
+ // 处方状态(必须在 loadFromServerData 之后设置,因为 loadFromServerData 会调用 loadTabData 覆盖 paystate)
|
|
|
+ if (this.getEditPreNo()) {
|
|
|
+ if (techData.revierwstate == 1) {
|
|
|
+ acupointTable.prescribed = 0;
|
|
|
+ acupointTable.paystate = 0;
|
|
|
+ } else {
|
|
|
+ acupointTable.prescribed = techData.prescribed || 0;
|
|
|
+ acupointTable.paystate = techData.paystate || 0;
|
|
|
+ }
|
|
|
} else {
|
|
|
acupointTable.prescribed = techData.prescribed || 0;
|
|
|
acupointTable.paystate = techData.paystate || 0;
|
|
|
}
|
|
|
- } else {
|
|
|
- acupointTable.prescribed = techData.prescribed || 0;
|
|
|
- acupointTable.paystate = techData.paystate || 0;
|
|
|
- }
|
|
|
|
|
|
- // 嘱托(command)和支付状态(paystate)在处方级(technologies[i]),loadFromServerData 按治疗项取不到,补设到组件
|
|
|
- const _prescriptionCommand = techData.command || "";
|
|
|
- acupointTable.command = _prescriptionCommand;
|
|
|
- if (acupointTable.prescriptionDataMap) {
|
|
|
- Object.keys(acupointTable.prescriptionDataMap).forEach(idx => {
|
|
|
- acupointTable.prescriptionDataMap[idx].command = _prescriptionCommand;
|
|
|
- // 为每个处方设置支付状态
|
|
|
- const numIdx = Number(idx);
|
|
|
- console.log('设置支付状态', { idx, numIdx, dataArrayItem: dataArray[numIdx], paystate: dataArray[numIdx]?.paystate });
|
|
|
- if (dataArray[numIdx]) {
|
|
|
- acupointTable.prescriptionDataMap[idx].paystate = dataArray[numIdx].paystate || 0;
|
|
|
- acupointTable.prescriptionDataMap[idx].isPay = dataArray[numIdx].isPay || false;
|
|
|
- }
|
|
|
- });
|
|
|
+ // 嘱托(command)和支付状态(paystate)在处方级(technologies[i]),loadFromServerData 按治疗项取不到,补设到组件
|
|
|
+ const _prescriptionCommand = techData.command || "";
|
|
|
+ acupointTable.command = _prescriptionCommand;
|
|
|
+ if (acupointTable.prescriptionDataMap) {
|
|
|
+ Object.keys(acupointTable.prescriptionDataMap).forEach(idx => {
|
|
|
+ acupointTable.prescriptionDataMap[idx].command = _prescriptionCommand;
|
|
|
+ // 为每个处方设置支付状态
|
|
|
+ const numIdx = Number(idx);
|
|
|
+ if (dataArray[numIdx]) {
|
|
|
+ acupointTable.prescriptionDataMap[idx].paystate = dataArray[numIdx].paystate || 0;
|
|
|
+ acupointTable.prescriptionDataMap[idx].isPay = dataArray[numIdx].isPay || false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
loading.close();
|
|
|
@@ -3633,7 +3693,7 @@ export default {
|
|
|
let res = await getRecipeShowData(this.getPatiensInfo.pid).catch(err => {
|
|
|
loading.close();
|
|
|
});
|
|
|
- console.log(res, "处方回显数据");
|
|
|
+ console.log(res, "有处方并且获取处方回显数据");
|
|
|
if (res.ResultCode == 0) {
|
|
|
if (!res.Data.flag) {
|
|
|
loading.close();
|
|
|
@@ -3709,11 +3769,23 @@ console.log(res, "处方回显数据==处方管理",res.Data.type);
|
|
|
this.contentTabs[2].check = false;
|
|
|
this.assignRecipe2(res.Data, loading);
|
|
|
} else if (res.Data.type == 2) {
|
|
|
+ // 适宜技术转方前校验:跳过开方页面已支付的相同项目
|
|
|
+ const checkResult = this.checkPaidProjects(res.Data, 'treatItemName');
|
|
|
+ if (checkResult.skippedPaid.length > 0) {
|
|
|
+ this.$message.warning(`${checkResult.skippedPaid.join('、')}项目已支付,不可转方`);
|
|
|
+ }
|
|
|
+ if (!checkResult.valid) {
|
|
|
+ loading.close();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ res.Data = checkResult.filteredData.length === 1 ? checkResult.filteredData[0] : checkResult.filteredData;
|
|
|
+
|
|
|
this.container_i = 2;
|
|
|
this.contentTabs[0].check = false;
|
|
|
this.contentTabs[1].check = false;
|
|
|
this.contentTabs[2].check = true;
|
|
|
- this.assignRecipe3(res.Data, loading);
|
|
|
+ // 转方数据追加到当前处方后面(不覆盖)
|
|
|
+ this.assignRecipe3(res.Data, loading, true);
|
|
|
// 回显的是已保存处方(非推荐方案),清空推荐高亮
|
|
|
this.suitTjRecipeId = "";
|
|
|
}
|
|
|
@@ -3734,7 +3806,17 @@ console.log(res, "处方回显数据==处方管理",res.Data.type);
|
|
|
const res = await getRecipeBySuitTech({ recordId ,visitId});
|
|
|
console.log('适宜技术病历转方回显', res);
|
|
|
if (res.ResultCode === 0 && res.Data) {
|
|
|
- console.log('获取数据', res.Data);
|
|
|
+ // 转方前校验:跳过开方页面已支付的相同项目
|
|
|
+ const checkResult = this.checkPaidProjects(res.Data, 'treatItemName');
|
|
|
+ if (checkResult.skippedPaid.length > 0) {
|
|
|
+ this.$message.warning(`${checkResult.skippedPaid.join('、')}项目已支付,不可转方`);
|
|
|
+ }
|
|
|
+ if (!checkResult.valid) {
|
|
|
+ loading.close();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ res.Data = checkResult.filteredData.length === 1 ? checkResult.filteredData[0] : checkResult.filteredData;
|
|
|
+
|
|
|
this.container_i = 2;
|
|
|
this.contentTabs[0].check = false;
|
|
|
this.contentTabs[1].check = false;
|
|
|
@@ -3744,7 +3826,8 @@ console.log(res, "处方回显数据==处方管理",res.Data.type);
|
|
|
this.$refs.suitScience._cachedPrescriptions = null;
|
|
|
this.$refs.suitScience._cachedPrescriptionDataMap = null;
|
|
|
}
|
|
|
- this.assignRecipe3(res.Data, loading);
|
|
|
+ // 转方数据追加到当前处方后面(不覆盖)
|
|
|
+ this.assignRecipe3(res.Data, loading, true);
|
|
|
// 病历转方回显(非推荐方案),清空推荐高亮
|
|
|
this.suitTjRecipeId = "";
|
|
|
} else {
|
|
|
@@ -3769,6 +3852,17 @@ console.log(res, "处方回显数据==处方管理",res.Data.type);
|
|
|
console.log('适宜技术处方转方回显', res);
|
|
|
if (res.ResultCode === 0 && res.Data) {
|
|
|
console.log('获取数据', res.Data);
|
|
|
+ // 转方前校验:跳过开方页面已支付的相同项目
|
|
|
+ const checkResult = this.checkPaidProjects(res.Data, 'treatItemName');
|
|
|
+ if (checkResult.skippedPaid.length > 0) {
|
|
|
+ this.$message.warning(`${checkResult.skippedPaid.join('、')}项目已支付,不可转方`);
|
|
|
+ }
|
|
|
+ if (!checkResult.valid) {
|
|
|
+ loading.close();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ res.Data = checkResult.filteredData.length === 1 ? checkResult.filteredData[0] : checkResult.filteredData;
|
|
|
+
|
|
|
this.container_i = 2;
|
|
|
this.contentTabs[0].check = false;
|
|
|
this.contentTabs[1].check = false;
|
|
|
@@ -3778,7 +3872,8 @@ console.log(res, "处方回显数据==处方管理",res.Data.type);
|
|
|
this.$refs.suitScience._cachedPrescriptions = null;
|
|
|
this.$refs.suitScience._cachedPrescriptionDataMap = null;
|
|
|
}
|
|
|
- this.assignRecipe3(res.Data, loading);
|
|
|
+ // 转方数据追加到当前处方后面(不覆盖)
|
|
|
+ this.assignRecipe3(res.Data, loading, true);
|
|
|
// 病历转方回显(非推荐方案),清空推荐高亮
|
|
|
this.suitTjRecipeId = "";
|
|
|
} else {
|
|
|
@@ -4081,6 +4176,7 @@ console.log(this.rRecomendR, "this.rRecomendR");
|
|
|
},
|
|
|
// 适宜技术 · 协定方转方(详情弹窗「转方」触发)
|
|
|
async onSuitTechTurn(pid, detail) {
|
|
|
+ console.log('onSuitTechTurn 参数:', { pid, detail });
|
|
|
const loading = this.$loading({
|
|
|
lock: true,
|
|
|
text: '正在转方',
|
|
|
@@ -4094,15 +4190,38 @@ console.log(this.rRecomendR, "this.rRecomendR");
|
|
|
sourceType: 'accord',
|
|
|
});
|
|
|
if (res.ResultCode === 0 && res.Data) {
|
|
|
+ // 转方前校验:跳过开方页面已支付的相同项目
|
|
|
+ const checkResult = this.checkPaidProjects(res.Data, 'treatItemName');
|
|
|
+ if (checkResult.skippedPaid.length > 0) {
|
|
|
+ this.$message.warning(`${checkResult.skippedPaid.join('、')}项目已支付,不可转方`);
|
|
|
+ }
|
|
|
+ if (!checkResult.valid) {
|
|
|
+ loading.close();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ 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 || '',
|
|
|
- symptomid: detail.synId || '',
|
|
|
+ disCode: detail.disCode || '',
|
|
|
+ symptomid: detail.synId || detail.synCode || '',
|
|
|
syndrometypes: detail.synName || '',
|
|
|
- treatment: detail.theName || ''
|
|
|
+ treatment: detail.theName || '',
|
|
|
+ therapyCode: detail.theCode || ''
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
@@ -4111,7 +4230,8 @@ console.log(this.rRecomendR, "this.rRecomendR");
|
|
|
this.$refs.suitScience._cachedPrescriptions = null;
|
|
|
this.$refs.suitScience._cachedPrescriptionDataMap = null;
|
|
|
}
|
|
|
- this.assignRecipe3(res.Data, loading);
|
|
|
+ // 转方数据追加到当前处方后面(不覆盖)
|
|
|
+ this.assignRecipe3(res.Data, loading, true);
|
|
|
// 协定方转方:内容来自协定方(非推荐方案),清空推荐高亮,避免误高亮之前的推荐
|
|
|
this.suitTjRecipeId = "";
|
|
|
// 转方成功,关闭协定方/医派协定方查询弹窗
|
|
|
@@ -4130,10 +4250,10 @@ console.log(this.rRecomendR, "this.rRecomendR");
|
|
|
async onSuitRecommendSelect(item) {
|
|
|
const sourcePid = item.pid || item.preid || item.acupreid;
|
|
|
if (!sourcePid) return;
|
|
|
- if (this.$refs.suitScience && (this.$refs.suitScience.isPay || this.$refs.suitScience.paystate == 1)) {
|
|
|
- this.$message.error('当前为已付费处方,暂不支持推导');
|
|
|
- return;
|
|
|
- }
|
|
|
+ // if (this.$refs.suitScience && (this.$refs.suitScience.isPay || this.$refs.suitScience.paystate == 1)) {
|
|
|
+ // this.$message.error('当前为已付费处方,暂不支持推导');
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
const loading = this.$loading({
|
|
|
lock: true,
|
|
|
text: '正在获取适宜技术处方数据',
|
|
|
@@ -4147,12 +4267,24 @@ console.log(this.rRecomendR, "this.rRecomendR");
|
|
|
sourceType: 'localExpert',
|
|
|
});
|
|
|
if (recipeRes.ResultCode === 0 && recipeRes.Data) {
|
|
|
+ // 转方前校验:跳过开方页面已支付的相同项目
|
|
|
+ const checkResult = this.checkPaidProjects(recipeRes.Data, 'treatItemName');
|
|
|
+ if (checkResult.skippedPaid.length > 0) {
|
|
|
+ this.$message.warning(`${checkResult.skippedPaid.join('、')}项目已支付,不可转方`);
|
|
|
+ }
|
|
|
+ if (!checkResult.valid) {
|
|
|
+ loading.close();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ recipeRes.Data = checkResult.filteredData.length === 1 ? checkResult.filteredData[0] : checkResult.filteredData;
|
|
|
+
|
|
|
// 推荐方案换入是主动换方案:清掉切tab产生的缓存,避免 assignRecipe3 开头 restoreCachedData 用旧数据拦截
|
|
|
if (this.$refs.suitScience) {
|
|
|
this.$refs.suitScience._cachedPrescriptions = null;
|
|
|
this.$refs.suitScience._cachedPrescriptionDataMap = null;
|
|
|
}
|
|
|
- this.assignRecipe3(recipeRes.Data, loading);
|
|
|
+ // 转方数据追加到当前处方后面(不覆盖)
|
|
|
+ this.assignRecipe3(recipeRes.Data, loading, true);
|
|
|
this.suitTjRecipeId = sourcePid;
|
|
|
} else {
|
|
|
loading.close();
|
|
|
@@ -4190,10 +4322,42 @@ console.log(this.rRecomendR, "this.rRecomendR");
|
|
|
sourceType: 'localExpert',
|
|
|
});
|
|
|
if (recipeRes.ResultCode === 0 && recipeRes.Data) {
|
|
|
+ // 推导前校验:跳过开方页面已支付的相同项目
|
|
|
+ const checkResult = this.checkPaidProjects(recipeRes.Data, 'treatItemName');
|
|
|
+ if (checkResult.skippedPaid.length > 0) {
|
|
|
+ this.$message.warning(`${checkResult.skippedPaid.join('、')}项目已支付,不可转方`);
|
|
|
+ }
|
|
|
+ if (!checkResult.valid) {
|
|
|
+ loading.close();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ recipeRes.Data = checkResult.filteredData.length === 1 ? checkResult.filteredData[0] : checkResult.filteredData;
|
|
|
+
|
|
|
+ // 推导时设置建议诊断
|
|
|
+ const techData = Array.isArray(recipeRes.Data) ? recipeRes.Data[0] : recipeRes.Data;
|
|
|
+ if (techData) {
|
|
|
+ const rawSuggest = techData.suggestDiag;
|
|
|
+ const rawArr = typeof rawSuggest === 'string'
|
|
|
+ ? rawSuggest.split(',').filter(Boolean)
|
|
|
+ : Array.isArray(rawSuggest) ? rawSuggest : [];
|
|
|
+ this.suggestDiagAll = rawArr.map(it => {
|
|
|
+ if (it && typeof it === 'object') {
|
|
|
+ const code = it.westcode || it.code;
|
|
|
+ return { westcode: code, westname: it.westname || it.name || code };
|
|
|
+ }
|
|
|
+ return { westcode: it, westname: this.westernDiseaseNameMap[it] || it };
|
|
|
+ });
|
|
|
+ this.suggestDiagAll.forEach(it => {
|
|
|
+ if (it.westcode) this.westernDiseaseNameMap[it.westcode] = it.westname;
|
|
|
+ });
|
|
|
+ this.suggestDiag = this.suggestDiagAll.length ? [this.suggestDiagAll[0].westcode] : [];
|
|
|
+ }
|
|
|
+
|
|
|
// 推导是主动换方案:清掉切tab产生的缓存,避免 assignRecipe3 开头 restoreCachedData 用旧数据拦截
|
|
|
acupointTable._cachedPrescriptions = null;
|
|
|
acupointTable._cachedPrescriptionDataMap = null;
|
|
|
- this.assignRecipe3(recipeRes.Data, loading);
|
|
|
+ // 推导数据追加到当前处方后面(不覆盖)
|
|
|
+ this.assignRecipe3(recipeRes.Data, loading, true);
|
|
|
} else {
|
|
|
loading.close();
|
|
|
}
|
|
|
@@ -4258,10 +4422,12 @@ console.log(this.rRecomendR, "this.rRecomendR");
|
|
|
},
|
|
|
// 协定方转方 判断
|
|
|
async changeBasisPre(id) {
|
|
|
+ console.log('[协定方转方] agreeInfo:', this.agreeInfo);
|
|
|
let params = {
|
|
|
basisPreId: id
|
|
|
};
|
|
|
let res = await changeBasisPre(params);
|
|
|
+ console.log('[协定方转方] changeBasisPre 接口返回:', res);
|
|
|
if (res.ResultCode == 0) {
|
|
|
this.agreeAssignToTCM(this.agreeInfo);
|
|
|
}
|
|
|
@@ -4702,12 +4868,15 @@ console.log(this.rRecomendR, "this.rRecomendR");
|
|
|
},
|
|
|
// 获取协定方详细信息
|
|
|
async getAccordDetail(id) {
|
|
|
+ console.log('[协定方详情] id:', id);
|
|
|
addRecipeFrom({ type: 2 }).catch();
|
|
|
let res = await getAccordDetail({
|
|
|
pid: id
|
|
|
});
|
|
|
+ console.log('[协定方详情] 接口返回:', res);
|
|
|
if (res.ResultCode == 0) {
|
|
|
this.agreeInfo = res.Data;
|
|
|
+ console.log('[协定方详情] agreeInfo:', this.agreeInfo);
|
|
|
this.showAgree = true;
|
|
|
}
|
|
|
},
|