This commit is contained in:
2025-07-29 15:18:31 +08:00
parent bd8dd6db3c
commit 544af2a4d2
5 changed files with 585 additions and 166 deletions

View File

@@ -1,8 +1,8 @@
<script type="text/javascript"> <script type="text/javascript">
// const baseUrl = "http://192.168.110.100:9200/pb"; //张川川后端 const baseUrl = "http://192.168.110.100:9200/pb"; //张川川后端
// const baseUrl = 'http://59.110.212.44:9100/pb' // const baseUrl = 'http://59.110.212.44:9100/pb'
// const baseUrl = "https://testapi.nuttyreading.com"; // const baseUrl = "https://testapi.nuttyreading.com";
const baseUrl = 'https://api.nuttyreading.com' // const baseUrl = 'https://api.nuttyreading.com'
// function commonFun() { // function commonFun() {
// console.log("公共方法") // console.log("公共方法")
// } // }

View File

@@ -0,0 +1,90 @@
import Vue from 'vue';
import mammoth from "mammoth";
export default {
handleUpload(event, callback) {
const file = event.target.files[0]
if (!file) return
const reader = new FileReader()
reader.onload = (e) => {
const arrayBuffer = e.target.result
mammoth.extractRawText({ arrayBuffer })
.then((result) => {
const rawText = result.value.trim();
// 1. 按“[医案]”分割,生成数组
const caseList = rawText
.split(/[医案]/)
.filter(Boolean);
// 2. 每个医案内判断是否有“相关课程”,有则去掉后面部分
const cleanedCases = caseList.map(item => {
let content = item.trim();
if (content.includes('相关课程')) {
content = content.split('相关课程')[0].trim();
}
return content; // 补回前缀
});
// 如果你只是要显示全部文字,也可以合并
// this.content = fullCases.join('\n\n');
callback(cleanedCases)
})
.catch((err) => {
console.error('提取失败:', err);
});
// mammoth.extractRawText({ arrayBuffer })
// .then((result) => {
// this.content = result.value // 设置到 textarea 中
// console.log('提取内容:', result.value)
// })
// .catch((err) => {
// console.error('提取失败:', err)
// })
}
reader.readAsArrayBuffer(file)
}想把里面的图片也识别出来
// handleUpload(event, callback) {
// const file = event.target.files[0]
// if (!file) return
// const reader = new FileReader()
// reader.onload = (e) => {
// const arrayBuffer = e.target.result
// mammoth.convertToHtml({
// arrayBuffer: arrayBuffer
// }, {
// convertImage: mammoth.images.inline(function (element) {
// return element.read("base64").then(function (imageBuffer) {
// return {
// src: "data:" + element.contentType + ";base64," + imageBuffer
// };
// });
// })
// }).then(function (result) {
// callback(result.value);
// })
// // mammoth.extractRawText({ arrayBuffer })
// // .then((result) => {
// // this.content = result.value // 设置到 textarea 中
// // console.log('提取内容:', result.value)
// // })
// // .catch((err) => {
// // console.error('提取失败:', err)
// // })
// }
// reader.readAsArrayBuffer(file)
// }
}

View File

@@ -3,53 +3,79 @@ import Vue from 'vue';
import mammoth from "mammoth"; import mammoth from "mammoth";
export default { export default {
handleUpload(event, callback) { handleUpload(event, callback) {
const file = event.target.files[0] const file = event.target.files[0];
if (!file) return if (!file) return;
const reader = new FileReader() const reader = new FileReader();
reader.onload = (e) => { reader.onload = async (e) => {
const arrayBuffer = e.target.result const arrayBuffer = e.target.result;
mammoth.extractRawText({ arrayBuffer })
.then((result) => {
const rawText = result.value.trim();
// 1. 按“[医案]”分割,生成数组 try {
const caseList = rawText // ✨ 第一步:提取纯文字,保留换行格式(用于显示)
.split(/[医案]/) const textResult = await mammoth.extractRawText({ arrayBuffer });
.filter(Boolean); const rawText = textResult.value.trim();
// 2. 每个医案内判断是否有“相关课程”,有则去掉后面部分
const cleanedCases = caseList.map(item => {
let content = item.trim();
const caseTexts = rawText.split(/[医案]/).filter(Boolean).map(raw => {
let content = raw.trim();
if (content.includes('相关课程')) { if (content.includes('相关课程')) {
content = content.split('相关课程')[0].trim(); content = content.split('相关课程')[0].trim();
} }
return '[医案]' + content;
return content; // 补回前缀
});
// 如果你只是要显示全部文字,也可以合并
// this.content = fullCases.join('\n\n');
callback(cleanedCases)
})
.catch((err) => {
console.error('提取失败:', err);
}); });
// mammoth.extractRawText({ arrayBuffer })
// .then((result) => { // ✨ 第二步:提取 HTML解析图片不管文字
// this.content = result.value // 设置到 textarea 中 const htmlResult = await mammoth.convertToHtml({ arrayBuffer }, {
// console.log('提取内容:', result.value) convertImage: mammoth.images.inline(image =>
// }) image.read("base64").then(buffer => ({
// .catch((err) => { src: "data:" + image.contentType + ";base64," + buffer
// console.error('提取失败:', err) }))
// }) )
});
const html = htmlResult.value.trim();
const caseHtmlList = html.split(/[医案]/).filter(Boolean);
const caseImages = caseHtmlList.map(raw => {
const content = raw.includes('相关课程') ? raw.split('相关课程')[0] : raw;
const images = [];
const imgRegex = /<img[^>]+src="([^">]+)"/g;
let match;
while ((match = imgRegex.exec(content)) !== null) {
images.push(match[1]);
}
return images;
});
// ✨ 第三步:合并为结构化数组
const finalCases = caseTexts.map((text, index) => ({
text,
images: caseImages[index] || []
}));
callback(finalCases);
} catch (err) {
console.error('提取失败:', err);
}
};
reader.readAsArrayBuffer(file);
},
base64ToBlob(base64) {
const arr = base64.split(',');
const mime = arr[0].match(/:(.*?);/)[1];
const bstr = atob(arr[1]);
let n = bstr.length;
const u8arr = new Uint8Array(n);
while (n--) u8arr[n] = bstr.charCodeAt(n);
return new Blob([u8arr], { type: mime });
} }
reader.readAsArrayBuffer(file)
}
// handleUpload(event, callback) { // handleUpload(event, callback) {
// const file = event.target.files[0] // const file = event.target.files[0]
// if (!file) return // if (!file) return

View File

@@ -14,7 +14,8 @@
" "
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
:close-on-click-modal="false" :close-on-click-modal="false"
:wrapperClosable="false" :wrapperClosable="true"
:before-close="handleClose"
custom-class="yianDrawer" custom-class="yianDrawer"
size="1200px" size="1200px"
> >
@@ -60,23 +61,34 @@
<div <div
v-for="(v, i) in messageList" v-for="(v, i) in messageList"
class="wordItem" class="wordItem"
@click="insertMessage(v)" @click="insertMessage(v.text, v.images ? v.images : [])"
style="width: 32%;margin-right: 15px;margin-bottom: 10px;cursor: pointer;" style="width: 32%;margin-right: 15px;margin-bottom: 10px;cursor: pointer;"
> >
<div <div
style="border: 1px solid #bbb;border-radius: 8px;height: 88px;overflow: hidden;" style="border: 1px solid #bbb;border-radius: 8px;height: 110px;overflow: hidden;"
> >
<p <p
style="font-weight: bold;margin-bottom:2px;margin-top: -1px;background-color: #f0f0f0;color: #333;padding: 2px 10px 2px 2px;" style="font-weight: bold;margin-bottom:2px;margin-top: -1px;background-color: #f0f0f0;color: #333;padding: 2px 10px 2px 2px;"
> >
医案 {{ numberToChineseLower(i + 1) }} 医案 {{ numberToChineseLower(i + 1) }}
<el-button <el-button
@click.stop="
analyzingMessage(v.text, v.images ? v.images : [])
"
size="mini"
type=""
plain
style="margin-left: 10px; padding: 2px;float: right;color: rgb(23, 129, 255);"
>解析医案</el-button
>
<el-button
@click.stop="insertMessage(v.text, v.images ? v.images : [])"
size="mini" size="mini"
type="" type=""
plain plain
icon="el-icon-plus" icon="el-icon-plus"
style="margin-left: 10px; padding: 2px;float: right;" style="margin-left: 10px; padding: 2px;float: right;"
>快速填入</el-button >选择</el-button
> >
</p> </p>
<div <div
@@ -89,7 +101,16 @@
text-overflow: ellipsis; text-overflow: ellipsis;
word-break: break-word; /* 可选:精确限制高度,兼容性更好 */" word-break: break-word; /* 可选:精确限制高度,兼容性更好 */"
> >
{{ v }} {{ v.text }}
</div>
<div v-if="v.images" style="padding:0px 10px 0;">
<img
v-for="(img, i) in v.images"
:key="i"
:src="img"
style="width:30px;height: 30px; margin: 4px;"
/>
</div> </div>
</div> </div>
</div> </div>
@@ -157,7 +178,7 @@
v-if="tishi" v-if="tishi"
:title=" :title="
loading loading
? '解析预计耗时约50秒,请耐心等待' ? '解析预计耗时约50秒,请耐心等待,也可在草稿箱中查看内容'
: '好的结合您的医案下面是解析后的结果。5秒后自动关闭' : '好的结合您的医案下面是解析后的结果。5秒后自动关闭'
" "
:type="loading ? 'warning' : 'success'" :type="loading ? 'warning' : 'success'"
@@ -243,7 +264,10 @@
> >
</div> </div>
<template <template
v-if="type == 'detail' && currentNode.data.id == 'wait'" v-if="
(type == 'detail' && currentNode.data.id == 'wait') ||
currentNode.data.id == 'caogao'
"
style="display:flex;align-items:center;justify-content:space-between" style="display:flex;align-items:center;justify-content:space-between"
> >
<!-- <el-form-item <!-- <el-form-item
@@ -273,7 +297,6 @@
<div> <div>
<el-cascader <el-cascader
size="mini" size="mini"
:disabled="isEdit"
style="width: 100%;" style="width: 100%;"
:show-all-levels="false" :show-all-levels="false"
v-model="addCertificateForm.labelId" v-model="addCertificateForm.labelId"
@@ -281,7 +304,9 @@
value: 'id', value: 'id',
label: 'title' label: 'title'
}" }"
filterable
:options="cateOptions" :options="cateOptions"
@change="selectLabelId"
placeholder="医案分类" placeholder="医案分类"
></el-cascader></div ></el-cascader></div
></el-form-item> ></el-form-item>
@@ -330,7 +355,6 @@
<el-form-item <el-form-item
label="医案详情:" label="医案详情:"
label-width="110px" label-width="110px"
class="form_item" class="form_item"
> >
<div style="padding-top: 15px;"> <div style="padding-top: 15px;">
@@ -377,7 +401,6 @@
<el-form-item <el-form-item
label="上传图片:" label="上传图片:"
label-width="110px" label-width="110px"
class="form_item custom-upload-box" class="form_item custom-upload-box"
v-if="dialogVisible" v-if="dialogVisible"
@@ -438,13 +461,11 @@
</div> </div>
</div> </div>
</el-upload> </el-upload>
<template v-if="addCertificateForm.img !== ''&&type == 'detail'"> <template
v-if="addCertificateForm.img !== '' && type == 'detail'"
>
<el-image <el-image
v-if=" v-if="fileList.length > 0"
fileList.length > 0
"
:key="index" :key="index"
class="el-upload-list__item-thumbnail" class="el-upload-list__item-thumbnail"
v-for="(item, index) in addCertificateForm.img.split(',')" v-for="(item, index) in addCertificateForm.img.split(',')"
@@ -455,7 +476,6 @@
</el-image> </el-image>
</template> </template>
<!-- <div class="flexBox" style="width:100%;justify-content: space-between;"> <!-- <div class="flexBox" style="width:100%;justify-content: space-between;">
<div class="" style="display:flex"> <div class="" style="display:flex">
@@ -613,10 +633,13 @@ export default {
data() { data() {
return { return {
isShowWord: false, isShowWord: false,
imagePreviews: false,
record: {}, record: {},
loading: false, loading: false,
tishi: false, tishi: false,
message: "", message: "",
currentMedicalWordImageList: [],
currentMedicalWordImageStr: "",
messageList: [], messageList: [],
showMessages: false, showMessages: false,
editableMap: {}, // 存储每个字段的内部可编辑内容 editableMap: {}, // 存储每个字段的内部可编辑内容
@@ -684,6 +707,7 @@ export default {
addForm: {}, addForm: {},
audioFileList: [], audioFileList: [],
isFresh: false, isFresh: false,
pollInterval: null,
type: "", type: "",
detailContent: "", detailContent: "",
medicalId: "", medicalId: "",
@@ -698,6 +722,7 @@ export default {
commonShopTable, commonShopTable,
quillEditor quillEditor
}, },
watch: { watch: {
filterText(val) { filterText(val) {
this.$refs.tree.filter(val); this.$refs.tree.filter(val);
@@ -712,6 +737,30 @@ export default {
// this.getDataList(); // this.getDataList();
}, },
methods: { methods: {
selectLabelId(value) {
// value 是选中的 id 数组
const getTitle = (options, valuePath) => {
let currentOptions = options;
let labels = [];
for (let val of valuePath) {
const selected = currentOptions.find(item => item.id === val);
if (selected) {
labels.push(selected.title);
currentOptions = selected.children || [];
} else {
break;
}
}
return labels;
};
// 获取选中的 title 路径
const titles = getTitle(this.cateOptions, value);
console.log("当前选中的 title 是:", titles[titles.length - 1]); // 如果只要最后一级
this.addCertificateForm.labelTitle = titles[titles.length - 1];
},
numberToChineseLower(n) { numberToChineseLower(n) {
const cnNums = [ const cnNums = [
"零", "零",
@@ -743,10 +792,20 @@ export default {
result = result.replace(/^一十/, "十"); // 10-19 处理为 十一、十二... result = result.replace(/^一十/, "十"); // 10-19 处理为 十一、十二...
return result; return result;
}, },
insertMessage(data) { insertMessage(data, images) {
this.message = "";
this.currentMedicalWordImageList = [];
this.currentMedicalWordImageStr = "";
this.message = data; this.message = data;
if (images.length > 0) {
this.currentMedicalWordImageList = [...images];
}
console.log("this.message at line 650:", this.message); console.log("this.message at line 650:", this.message);
}, },
async analyzingMessage(data, images) {
await this.insertMessage(data, images);
await this.submit()
},
// 点击按钮触发上传 // 点击按钮触发上传
triggerUpload() { triggerUpload() {
this.messageList = []; this.messageList = [];
@@ -756,19 +815,22 @@ export default {
// 处理上传文件 // 处理上传文件
handleUpload(event) { handleUpload(event) {
const loading = this.$loading({
lock: true,
text: 'word文件识别中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
this.$commonJS.handleUpload(event, arr => { this.$commonJS.handleUpload(event, arr => {
console.log("content at line 618:", arr); console.log("content at line 618:", arr);
// const text = html
// .replace(/<[^>]+>/g, '') // 清除所有 HTML 标签
// .replace(/&nbsp;/g, ' ') // 替换空格实体
// .replace(/&lt;/g, '<') // 还原小于号
// .replace(/&gt;/g, '>') // 还原大于号
// .replace(/&amp;/g, '&') // 还原 &
// .replace(/\r?\n\s*\r?\n/g, '\n') // 去掉多余空行
this.messageList = arr; this.messageList = arr;
// document.getElementById("result").innerHTML = content loading.close();
}).catch(()=>{
loading.close();
}); });
}, },
beforeClose() { beforeClose() {
@@ -887,6 +949,8 @@ export default {
init(type, data) { init(type, data) {
this.showMessages = false; this.showMessages = false;
this.messageList = []; this.messageList = [];
this.currentMedicalWordImageList = [];
this.currentMedicalWordImageStr = "";
this.message = ""; this.message = "";
this.tishi = false; this.tishi = false;
this.loading = false; this.loading = false;
@@ -900,10 +964,11 @@ export default {
chiefComplaint: "<h1>主诉</h1>", chiefComplaint: "<h1>主诉</h1>",
historyOfPresentIllness: "<h1>现病史</h1>", historyOfPresentIllness: "<h1>现病史</h1>",
pastHistory: "<h1>既往史</h1>", pastHistory: "<h1>既往史</h1>",
personalAndFamilyHistory: "<h1>家族史</h1>", personalAndFamilyHistory: "<h1>个人史与家族史</h1>",
physicaExamination: "<h1>体格检查</h1>", physicaExamination: "<h1>体格检查</h1>",
diagnosis: "<h1>诊断</h1>", diagnosis: "<h1>诊断</h1>",
treatmentPlan: "<h1>治疗和后续治疗</h1>" treatmentPlan: "<h1>治疗和后续治疗</h1>",
treatmentPlan: "<h1>其他</h1>"
}; };
this.isEdit = type == "edit" || type == "add" ? true : false; this.isEdit = type == "edit" || type == "add" ? true : false;
if (type == "add") { if (type == "add") {
@@ -1047,34 +1112,95 @@ export default {
this.reviewType = type; this.reviewType = type;
this.dialogMarkVisible = true; this.dialogMarkVisible = true;
}, },
async uploadImage(base64Images) {
const uploadTasks = base64Images.map((base64, index) => {
const formData = new FormData();
const blob = this.$commonJS.base64ToBlob(base64);
formData.append("file", blob, `image-${index + 1}.png`);
submit() { return fetch(this.baseUrl + "/oss/fileoss", {
method: "POST",
body: formData
})
.then(res => res.json())
.then(data => {
console.log(`✅ 第 ${index + 1} 张上传完成`, data);
if (data.code === 0 && data.url) {
return data.url;
} else {
console.warn(`❌ 第 ${index + 1} 张上传失败`);
return null;
}
})
.catch(err => {
console.error(`❌ 第 ${index + 1} 张上传失败`, err);
return null;
});
});
// 🚀 等待所有任务并发完成
const results = await Promise.all(uploadTasks);
const urlList = results.filter(Boolean); // 去掉失败的 null
const urlString = urlList.join(",");
console.log("✅ 所有上传完成URL 字符串:", urlString);
return urlString;
},
async submit() {
//没有次数的时候要求购买vip //没有次数的时候要求购买vip
if (!this.message) { if (!this.message) {
this.$message.error("请输入医案详情"); this.$message.error("请输入医案详情");
return; return;
} }
this.createChat() if (this.currentMedicalWordImageList.length > 0) {
const loading = this.$loading({
lock: true,
text: 'loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
this.currentMedicalWordImageStr = await this.uploadImage(
this.currentMedicalWordImageList
);
console.log(
"this.currentMedicalWordImageStr at line 1139:",
this.currentMedicalWordImageStr
);
loading.close();
}
await this.createChat();
//创建对话 获取sessionId //创建对话 获取sessionId
}, },
//创建新对话 //创建新对话
createChat() { createChat() {
this.loading = true;
this.$http({ this.$http({
url: this.$http.adornUrl("/common/medicalRecords/medicalRecordsSplit"), url: this.$http.adornUrl("/common/medicalRecords/medicalRecordsSplit"),
method: "post", method: "post",
data: this.$http.adornData({ data: this.$http.adornData({
userId: "1", userId: "12301",
message: this.message message: this.message,
img: this.currentMedicalWordImageStr
}) })
}).then(res => { })
.then(res => {
console.log("res at line 872:", res); console.log("res at line 872:", res);
if (res.data.code == 0) { if (res.data.code == 0) {
this.medicalId = res.data.data; this.medicalId = res.data.data;
this.sendQuestion(); this.sendQuestion();
} else {
this.loading = false;
this.$message.error("请重新解析");
} }
})
.catch(() => {
this.loading = false;
this.$message.error("请重新解析");
}); });
}, },
@@ -1085,7 +1211,6 @@ export default {
this.showMessages = true; this.showMessages = true;
this.loading = true;
var that = this; var that = this;
//展示提示语 //展示提示语
this.tishi = true; this.tishi = true;
@@ -1094,14 +1219,15 @@ export default {
const poll = () => { const poll = () => {
this.getMedicalDetail(() => { this.getMedicalDetail(() => {
// 停止轮询 // 停止轮询
clearInterval(pollInterval); clearInterval(this.pollInterval);
this.pollInterval = null;
setTimeout(() => { setTimeout(() => {
this.tishi = false; this.tishi = false;
}, 5000); }, 5000);
}); });
}; };
// 每5秒发送一次请求直到收到正确的响应 // 每5秒发送一次请求直到收到正确的响应
const pollInterval = setInterval(poll, 5000); this.pollInterval = setInterval(poll, 5000);
//调用后端 SSE 接口,发送问题并接收实时回答 //调用后端 SSE 接口,发送问题并接收实时回答
// this.startSSE(params); // this.startSSE(params);
@@ -1119,6 +1245,18 @@ export default {
}) })
.then(res => { .then(res => {
if (
res.data.code == 0 &&
res.data.medicalRecords != null &&
res.data.medicalRecords.delFlag == -1
) {
this.$message.error("此医案解析失败,请重新解析");
this.showMessages = true;
if (fn) {
fn();
}
return false;
}
if ( if (
res.data.code == 0 && res.data.code == 0 &&
res.data.medicalRecords != null && res.data.medicalRecords != null &&
@@ -1163,6 +1301,22 @@ export default {
// this.$refs.commonMedicalDetail.initRecordData(this.medicalRecords); // this.$refs.commonMedicalDetail.initRecordData(this.medicalRecords);
// that.initRecordData(); // that.initRecordData();
console.log("at line 558:", this.record); console.log("at line 558:", this.record);
this.addCertificateForm.id = data.id;
this.addCertificateForm.img = data.img;
if (this.addCertificateForm.img) {
this.fileList = this.addCertificateForm.img
.split(",")
.map((image, i) => ({
uid: i, // 假设 id 是唯一标识符
name: i, // 文件名
status: "done", // 状态
url: image // 文件 URL
}));
console.log("this.fileList at line 308:", this.fileList);
this.addCertificateForm.imageList = this.addCertificateForm.img.split(
","
);
}
this.$forceUpdate(); this.$forceUpdate();
// 滚动到最底部锚点 // 滚动到最底部锚点
@@ -1192,6 +1346,7 @@ export default {
this.$message.error("请选择用户"); this.$message.error("请选择用户");
return false; return false;
} }
if (this.editableMap.chiefComplaint == "") { if (this.editableMap.chiefComplaint == "") {
const titleHtml = this.getTitleHtml( const titleHtml = this.getTitleHtml(
this.record["chiefComplaint"] this.record["chiefComplaint"]
@@ -1220,6 +1375,49 @@ export default {
this.$message.error("请输入 " + titleHtml); this.$message.error("请输入 " + titleHtml);
return false; return false;
} }
if (
["妇科", "儿科"].includes(this.currentNode.data.title) ||
["妇科", "儿科"].includes(this.addCertificateForm.labelTitle)
) {
if (
this.currentNode.data.title == "妇科" ||
this.addCertificateForm.labelTitle == "妇科"
) {
const value = this.editableMap["personalAndFamilyHistory"] || "";
const hasKeywords =
value.includes("月经") && value.includes("婚育");
if (!hasKeywords) {
// 包含“月经”或“婚育”
console.log("包含月经或婚育相关内容");
const titleHtml = this.getTitleHtml(
this.record["personalAndFamilyHistory"]
).replace(/<[^>]*>/g, "");
this.$message.error(
"请在 " + titleHtml + " 中输入月经或婚育相关内容"
);
return false;
}
}
if (
this.currentNode.data.title == "儿科" ||
this.addCertificateForm.labelTitle == "儿科"
) {
const value = this.editableMap["pastHistory"] || "";
const hasKeywords = value.includes("疫苗");
if (!hasKeywords) {
// 包含“月经”或“婚育”
console.log("疫苗");
const titleHtml = this.getTitleHtml(
this.record["pastHistory"]
).replace(/<[^>]*>/g, "");
this.$message.error(
"请在 " + titleHtml + " 中输入疫苗接种相关内容"
);
return false;
}
}
}
var recordData = { ...this.record }; var recordData = { ...this.record };
for (const key in recordData) { for (const key in recordData) {
const titleHtml = this.getTitleHtml(recordData[key]); const titleHtml = this.getTitleHtml(recordData[key]);
@@ -1234,29 +1432,52 @@ export default {
userId: this.addCertificateForm.userId, userId: this.addCertificateForm.userId,
...recordData ...recordData
}; };
if (this.currentNode.data.id == "caogao") {
// if(this.record.) const label = this.addCertificateForm.labelId;
this.$http({ console.log(
url: this.$http.adornUrl( "this.addCertificateForm at line 1286:",
this.type == "edit" this.addCertificateForm
? "/master/medicalRecords/editMedicalRecords" );
: "/master/medicalRecords/addMedicalRecords" const value = Array.isArray(label)
), ? label[label.length - 1]
method: "post", : label;
data: this.$http.adornData( console.log("value at line 1289:", value);
this.type == "edit" if (!value) {
? { this.$message.error("请选择医案分类");
return false;
}
data = {
...this.addCertificateForm,
...data,
labelId: value,
state: 3
};
console.log("data at line 1288:", data);
} else {
if (this.type == "edit") {
data = {
...data, ...data,
data: this.addCertificateForm.data data: this.addCertificateForm.data
? this.addCertificateForm.data ? this.addCertificateForm.data
: "", : "",
id: this.addCertificateForm.id id: this.addCertificateForm.id
} };
: { } else {
data = {
...data, ...data,
labelId: this.labelId labelId: this.labelId
};
} }
) }
// if(this.record.)
this.$http({
url: this.$http.adornUrl(
this.type == "edit" || this.currentNode.data.id == "caogao"
? "/master/medicalRecords/editMedicalRecords"
: "/master/medicalRecords/addMedicalRecords"
),
method: "post",
data: this.$http.adornData({ ...data })
}).then(({ data }) => { }).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.$message({ this.$message({
@@ -1315,7 +1536,14 @@ export default {
}, },
handlePictureCardPreview(file) { handlePictureCardPreview(file) {
// 图片预览逻辑 // 图片预览逻辑
},
handleClose(done) {
done();
this.$emit("refresh");
} }
},
beforeDestroy() {
clearInterval(this.pollInterval);
} }
}; };
</script> </script>

View File

@@ -18,7 +18,9 @@
> >
<div <div
class="border_box info_box" class="border_box info_box"
v-if="!['wait', 'false', 'success'].includes(currentNode.data.id)" v-if="
!['wait', 'false', 'success', 'caogao'].includes(currentNode.data.id)
"
> >
<div class="title_box"> <div class="title_box">
<div class="title"><span class="line"></span>基本标签信息</div> <div class="title"><span class="line"></span>基本标签信息</div>
@@ -86,7 +88,14 @@
> >
( {{ currentNode.data ? currentNode.data.title : "" }} ) ( {{ currentNode.data ? currentNode.data.title : "" }} )
</span> </span>
<el-button v-if="currentNode&&currentNode.data.id=='caogao'"
plain
type="primary"
style="margin-left: 20px"
@click="openTable('addForm')"
size="mini"
>新增</el-button
>
<!-- <div style="" class="button_box"> --> <!-- <div style="" class="button_box"> -->
<!-- <el-button plain type="danger" @click="handleCheckAllChange(true)" size="mini">清空</el-button> --> <!-- <el-button plain type="danger" @click="handleCheckAllChange(true)" size="mini">清空</el-button> -->
@@ -115,7 +124,7 @@
:isNoPaging="true" :isNoPaging="true"
:isShowPagination="true" :isShowPagination="true"
:isShowNewOperation=" :isShowNewOperation="
addForm.id == 'wait' || addForm.id == 'false' ? true : false addForm.id == 'wait' || addForm.id == 'false' || addForm.id == 'caogao'? true : false
" "
getAssociatedGoodsListValue="result" getAssociatedGoodsListValue="result"
:tableColumnList="tableColumnList" :tableColumnList="tableColumnList"
@@ -134,7 +143,9 @@
:style="{ :style="{
height: height:
currentNode.data && currentNode.data &&
['wait', 'false', 'success'].includes(currentNode.data.id) ['wait', 'false', 'success', 'caogao'].includes(
currentNode.data.id
)
? 'calc(100vh - 200px) !important' ? 'calc(100vh - 200px) !important'
: 'calc(100vh - 340px)' : 'calc(100vh - 340px)'
}" }"
@@ -199,6 +210,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
v-if="currentNode && currentNode.data.id != 'caogao'"
width="180" width="180"
prop="toSociologySort" prop="toSociologySort"
header-align="center" header-align="center"
@@ -225,6 +237,7 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
v-if="currentNode && currentNode.data.id != 'caogao'"
prop="labelTitle" prop="labelTitle"
header-align="center" header-align="center"
align="center" align="center"
@@ -233,6 +246,7 @@
> >
</el-table-column> </el-table-column>
<el-table-column <el-table-column
v-if="currentNode && currentNode.data.id != 'caogao'"
prop="title" prop="title"
header-align="center" header-align="center"
align="center" align="center"
@@ -240,6 +254,49 @@
> >
</el-table-column> </el-table-column>
<el-table-column <el-table-column
v-if="currentNode && currentNode.data.id == 'caogao'"
prop="title"
header-align="center"
align="center"
label="医案内容"
>
<template slot-scope="scope">
<div
style="overflow: hidden;
font-size: 13px;
padding: 10px 10px 0px;
box-sizing: border-box;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-height: 1.5;
max-height: calc(4.5em);
text-overflow: ellipsis;
word-break: break-word;"
>
{{ scope.row.originalData }}
</div>
</template>
</el-table-column>
<el-table-column width="90"
v-if="currentNode && currentNode.data.id == 'caogao'"
prop="title"
header-align="center"
align="center"
label="解析状态"
>
<template slot-scope="scope">
<div
>
<span style="color:rgb(23, 179, 163);" v-if="scope.row.data">已完成</span>
<span style="color:rgb(187, 187, 187);" v-else>正在解析</span>
</div>
</template>
</el-table-column>
<el-table-column
v-if="currentNode && currentNode.data.id != 'caogao'"
prop="title" prop="title"
header-align="center" header-align="center"
align="center" align="center"
@@ -250,7 +307,7 @@
<el-switch <el-switch
:active-value="1" :active-value="1"
:inactive-value="0" :inactive-value="0"
@change="e=>changeTrainValue(e,scope.row)" @change="e => changeTrainValue(e, scope.row)"
:value="scope.row.train" :value="scope.row.train"
active-color="#17B3A3" active-color="#17B3A3"
inactive-color="#aaaaaa96" inactive-color="#aaaaaa96"
@@ -270,12 +327,23 @@
<template <template
slot="operation" slot="operation"
slot-scope="slotProps" slot-scope="slotProps"
v-if="addForm.id == 'wait' || addForm.id == 'false'" v-if="addForm.id == 'wait' || addForm.id == 'false' || addForm.id == 'caogao'"
> >
<el-button type="text" @click="detailCourse(slotProps.row)" <el-button type="text" @click="detailCourse(slotProps.row)" v-if="addForm.id == 'wait' || addForm.id == 'false'"
>详情</el-button >详情</el-button
> >
<div v-else-if="currentNode.data.id == 'caogao'">
<el-button type="text" @click="handleDataFormEdit({...slotProps.row,userId:slotProps.row.userId==12301?'':slotProps.row.userId})" v-if="slotProps.row.data!=''"
>编辑</el-button
>
<el-button type="text"
style="color: red;" @click="dataFormDelete([slotProps.row])"
>删除</el-button
>
</div>
</template> </template>
</commonShop> </commonShop>
<!-- <div <!-- <div
@@ -438,7 +506,7 @@
<el-switch <el-switch
:active-value="1" :active-value="1"
:inactive-value="0" :inactive-value="0"
@change="e=>changeTrainValue(e,scope.row)" @change="e => changeTrainValue(e, scope.row)"
:value="scope.row.train" :value="scope.row.train"
active-color="#17B3A3" active-color="#17B3A3"
inactive-color="#aaaaaa96" inactive-color="#aaaaaa96"
@@ -800,8 +868,7 @@ export default {
this.getDataList(); this.getDataList();
}, },
methods: { methods: {
changeTrainValue(status,data){ changeTrainValue(status, data) {
this.$http({ this.$http({
url: this.$http.adornUrl("/master/medicalRecords/editMedicalRecords"), url: this.$http.adornUrl("/master/medicalRecords/editMedicalRecords"),
method: "post", method: "post",
@@ -812,13 +879,11 @@ export default {
}) })
}).then(({ data }) => { }).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.refresh() this.refresh();
} else { } else {
this.$message.error(data.msg); this.$message.error(data.msg);
} }
}); });
}, },
refresh() { refresh() {
this.$nextTick(() => { this.$nextTick(() => {
@@ -1048,7 +1113,7 @@ export default {
// name: "audio--" // name: "audio--"
// }); // });
// } // }
if (!["wait", "false"].includes(form.id)) { if (!["wait", "false", "caogao"].includes(form.id)) {
await this.getDataList(); await this.getDataList();
this.$nextTick(() => { this.$nextTick(() => {
// this.$refs.commonShop.clear(); // this.$refs.commonShop.clear();
@@ -1548,6 +1613,16 @@ export default {
console.log("🚀 ~ getDataList ~ data:", data); console.log("🚀 ~ getDataList ~ data:", data);
if (data && data.code === 0) { if (data && data.code === 0) {
this.treeDataList = [ this.treeDataList = [
{
title: "草稿箱",
id: "caogao",
disabled: true,
isDisableAddChild: true,
color: "#bbb",
bgcolor: "#f0f0f0",
children: [],
state: 0
},
{ {
title: "待审核", title: "待审核",
id: "wait", id: "wait",