提交
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<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 = "https://testapi.nuttyreading.com";
|
||||
const baseUrl = 'https://api.nuttyreading.com'
|
||||
// const baseUrl = 'https://api.nuttyreading.com'
|
||||
// function commonFun() {
|
||||
// console.log("公共方法")
|
||||
// }
|
||||
|
||||
90
src/views/common/js/commonJS copy.js
Normal file
90
src/views/common/js/commonJS copy.js
Normal 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)
|
||||
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -3,53 +3,79 @@ import Vue from 'vue';
|
||||
import mammoth from "mammoth";
|
||||
export default {
|
||||
handleUpload(event, callback) {
|
||||
const file = event.target.files[0]
|
||||
if (!file) return
|
||||
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();
|
||||
const reader = new FileReader();
|
||||
reader.onload = async (e) => {
|
||||
const arrayBuffer = e.target.result;
|
||||
|
||||
// 1. 按“[医案]”分割,生成数组
|
||||
const caseList = rawText
|
||||
.split(/[医案]/)
|
||||
.filter(Boolean);
|
||||
|
||||
// 2. 每个医案内判断是否有“相关课程”,有则去掉后面部分
|
||||
const cleanedCases = caseList.map(item => {
|
||||
let content = item.trim();
|
||||
try {
|
||||
// ✨ 第一步:提取纯文字,保留换行格式(用于显示)
|
||||
const textResult = await mammoth.extractRawText({ arrayBuffer });
|
||||
const rawText = textResult.value.trim();
|
||||
|
||||
const caseTexts = rawText.split(/[医案]/).filter(Boolean).map(raw => {
|
||||
let content = raw.trim();
|
||||
if (content.includes('相关课程')) {
|
||||
content = content.split('相关课程')[0].trim();
|
||||
}
|
||||
|
||||
return content; // 补回前缀
|
||||
});
|
||||
|
||||
|
||||
// 如果你只是要显示全部文字,也可以合并
|
||||
// this.content = fullCases.join('\n\n');
|
||||
callback(cleanedCases)
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('提取失败:', err);
|
||||
return '[医案]' + content;
|
||||
});
|
||||
// mammoth.extractRawText({ arrayBuffer })
|
||||
// .then((result) => {
|
||||
// this.content = result.value // 设置到 textarea 中
|
||||
// console.log('提取内容:', result.value)
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// console.error('提取失败:', err)
|
||||
// })
|
||||
|
||||
// ✨ 第二步:提取 HTML,解析图片(不管文字)
|
||||
const htmlResult = await mammoth.convertToHtml({ arrayBuffer }, {
|
||||
convertImage: mammoth.images.inline(image =>
|
||||
image.read("base64").then(buffer => ({
|
||||
src: "data:" + image.contentType + ";base64," + buffer
|
||||
}))
|
||||
)
|
||||
});
|
||||
|
||||
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) {
|
||||
// const file = event.target.files[0]
|
||||
// if (!file) return
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
"
|
||||
:visible.sync="dialogVisible"
|
||||
:close-on-click-modal="false"
|
||||
:wrapperClosable="false"
|
||||
:wrapperClosable="true"
|
||||
:before-close="handleClose"
|
||||
custom-class="yianDrawer"
|
||||
size="1200px"
|
||||
>
|
||||
@@ -60,23 +61,34 @@
|
||||
<div
|
||||
v-for="(v, i) in messageList"
|
||||
class="wordItem"
|
||||
@click="insertMessage(v)"
|
||||
@click="insertMessage(v.text, v.images ? v.images : [])"
|
||||
style="width: 32%;margin-right: 15px;margin-bottom: 10px;cursor: pointer;"
|
||||
>
|
||||
<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
|
||||
style="font-weight: bold;margin-bottom:2px;margin-top: -1px;background-color: #f0f0f0;color: #333;padding: 2px 10px 2px 2px;"
|
||||
>
|
||||
【医案 {{ numberToChineseLower(i + 1) }}】
|
||||
<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"
|
||||
type=""
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
style="margin-left: 10px; padding: 2px;float: right;"
|
||||
>快速填入</el-button
|
||||
>选择</el-button
|
||||
>
|
||||
</p>
|
||||
<div
|
||||
@@ -89,7 +101,16 @@
|
||||
text-overflow: ellipsis;
|
||||
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>
|
||||
@@ -157,7 +178,7 @@
|
||||
v-if="tishi"
|
||||
:title="
|
||||
loading
|
||||
? '解析预计耗时约50秒,请耐心等待'
|
||||
? '解析预计耗时约50秒,请耐心等待,也可在草稿箱中查看内容'
|
||||
: '好的,结合您的医案,下面是解析后的结果。5秒后自动关闭'
|
||||
"
|
||||
:type="loading ? 'warning' : 'success'"
|
||||
@@ -243,7 +264,10 @@
|
||||
>
|
||||
</div>
|
||||
<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"
|
||||
>
|
||||
<!-- <el-form-item
|
||||
@@ -273,7 +297,6 @@
|
||||
<div>
|
||||
<el-cascader
|
||||
size="mini"
|
||||
:disabled="isEdit"
|
||||
style="width: 100%;"
|
||||
:show-all-levels="false"
|
||||
v-model="addCertificateForm.labelId"
|
||||
@@ -281,7 +304,9 @@
|
||||
value: 'id',
|
||||
label: 'title'
|
||||
}"
|
||||
filterable
|
||||
:options="cateOptions"
|
||||
@change="selectLabelId"
|
||||
placeholder="医案分类"
|
||||
></el-cascader></div
|
||||
></el-form-item>
|
||||
@@ -330,7 +355,6 @@
|
||||
<el-form-item
|
||||
label="医案详情:"
|
||||
label-width="110px"
|
||||
|
||||
class="form_item"
|
||||
>
|
||||
<div style="padding-top: 15px;">
|
||||
@@ -377,7 +401,6 @@
|
||||
|
||||
<el-form-item
|
||||
label="上传图片:"
|
||||
|
||||
label-width="110px"
|
||||
class="form_item custom-upload-box"
|
||||
v-if="dialogVisible"
|
||||
@@ -438,13 +461,11 @@
|
||||
</div>
|
||||
</div>
|
||||
</el-upload>
|
||||
<template v-if="addCertificateForm.img !== ''&&type == 'detail'">
|
||||
<template
|
||||
v-if="addCertificateForm.img !== '' && type == 'detail'"
|
||||
>
|
||||
<el-image
|
||||
v-if="
|
||||
|
||||
fileList.length > 0
|
||||
|
||||
"
|
||||
v-if="fileList.length > 0"
|
||||
:key="index"
|
||||
class="el-upload-list__item-thumbnail"
|
||||
v-for="(item, index) in addCertificateForm.img.split(',')"
|
||||
@@ -455,7 +476,6 @@
|
||||
</el-image>
|
||||
</template>
|
||||
|
||||
|
||||
<!-- <div class="flexBox" style="width:100%;justify-content: space-between;">
|
||||
<div class="" style="display:flex">
|
||||
|
||||
@@ -613,10 +633,13 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
isShowWord: false,
|
||||
imagePreviews: false,
|
||||
record: {},
|
||||
loading: false,
|
||||
tishi: false,
|
||||
message: "",
|
||||
currentMedicalWordImageList: [],
|
||||
currentMedicalWordImageStr: "",
|
||||
messageList: [],
|
||||
showMessages: false,
|
||||
editableMap: {}, // 存储每个字段的内部可编辑内容
|
||||
@@ -684,6 +707,7 @@ export default {
|
||||
addForm: {},
|
||||
audioFileList: [],
|
||||
isFresh: false,
|
||||
pollInterval: null,
|
||||
type: "",
|
||||
detailContent: "",
|
||||
medicalId: "",
|
||||
@@ -698,6 +722,7 @@ export default {
|
||||
commonShopTable,
|
||||
quillEditor
|
||||
},
|
||||
|
||||
watch: {
|
||||
filterText(val) {
|
||||
this.$refs.tree.filter(val);
|
||||
@@ -712,6 +737,30 @@ export default {
|
||||
// this.getDataList();
|
||||
},
|
||||
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) {
|
||||
const cnNums = [
|
||||
"零",
|
||||
@@ -743,10 +792,20 @@ export default {
|
||||
result = result.replace(/^一十/, "十"); // 10-19 处理为 十一、十二...
|
||||
return result;
|
||||
},
|
||||
insertMessage(data) {
|
||||
insertMessage(data, images) {
|
||||
this.message = "";
|
||||
this.currentMedicalWordImageList = [];
|
||||
this.currentMedicalWordImageStr = "";
|
||||
this.message = data;
|
||||
if (images.length > 0) {
|
||||
this.currentMedicalWordImageList = [...images];
|
||||
}
|
||||
console.log("this.message at line 650:", this.message);
|
||||
},
|
||||
async analyzingMessage(data, images) {
|
||||
await this.insertMessage(data, images);
|
||||
await this.submit()
|
||||
},
|
||||
// 点击按钮触发上传
|
||||
triggerUpload() {
|
||||
this.messageList = [];
|
||||
@@ -756,19 +815,22 @@ export default {
|
||||
|
||||
// 处理上传文件
|
||||
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 => {
|
||||
console.log("content at line 618:", arr);
|
||||
// const text = html
|
||||
// .replace(/<[^>]+>/g, '') // 清除所有 HTML 标签
|
||||
// .replace(/ /g, ' ') // 替换空格实体
|
||||
// .replace(/</g, '<') // 还原小于号
|
||||
// .replace(/>/g, '>') // 还原大于号
|
||||
// .replace(/&/g, '&') // 还原 &
|
||||
// .replace(/\r?\n\s*\r?\n/g, '\n') // 去掉多余空行
|
||||
|
||||
|
||||
this.messageList = arr;
|
||||
|
||||
// document.getElementById("result").innerHTML = content
|
||||
loading.close();
|
||||
}).catch(()=>{
|
||||
loading.close();
|
||||
});
|
||||
},
|
||||
beforeClose() {
|
||||
@@ -887,6 +949,8 @@ export default {
|
||||
init(type, data) {
|
||||
this.showMessages = false;
|
||||
this.messageList = [];
|
||||
this.currentMedicalWordImageList = [];
|
||||
this.currentMedicalWordImageStr = "";
|
||||
this.message = "";
|
||||
this.tishi = false;
|
||||
this.loading = false;
|
||||
@@ -900,10 +964,11 @@ export default {
|
||||
chiefComplaint: "<h1>主诉</h1>",
|
||||
historyOfPresentIllness: "<h1>现病史</h1>",
|
||||
pastHistory: "<h1>既往史</h1>",
|
||||
personalAndFamilyHistory: "<h1>家族史</h1>",
|
||||
personalAndFamilyHistory: "<h1>个人史与家族史</h1>",
|
||||
physicaExamination: "<h1>体格检查</h1>",
|
||||
diagnosis: "<h1>诊断</h1>",
|
||||
treatmentPlan: "<h1>治疗和后续治疗</h1>"
|
||||
treatmentPlan: "<h1>治疗和后续治疗</h1>",
|
||||
treatmentPlan: "<h1>其他</h1>"
|
||||
};
|
||||
this.isEdit = type == "edit" || type == "add" ? true : false;
|
||||
if (type == "add") {
|
||||
@@ -1047,34 +1112,95 @@ export default {
|
||||
this.reviewType = type;
|
||||
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
|
||||
if (!this.message) {
|
||||
this.$message.error("请输入医案详情");
|
||||
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
|
||||
|
||||
},
|
||||
//创建新对话
|
||||
createChat() {
|
||||
this.loading = true;
|
||||
this.$http({
|
||||
url: this.$http.adornUrl("/common/medicalRecords/medicalRecordsSplit"),
|
||||
method: "post",
|
||||
data: this.$http.adornData({
|
||||
userId: "1",
|
||||
message: this.message
|
||||
userId: "12301",
|
||||
message: this.message,
|
||||
img: this.currentMedicalWordImageStr
|
||||
})
|
||||
}).then(res => {
|
||||
})
|
||||
.then(res => {
|
||||
console.log("res at line 872:", res);
|
||||
if (res.data.code == 0) {
|
||||
this.medicalId = res.data.data;
|
||||
|
||||
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.loading = true;
|
||||
var that = this;
|
||||
//展示提示语
|
||||
this.tishi = true;
|
||||
@@ -1094,14 +1219,15 @@ export default {
|
||||
const poll = () => {
|
||||
this.getMedicalDetail(() => {
|
||||
// 停止轮询
|
||||
clearInterval(pollInterval);
|
||||
clearInterval(this.pollInterval);
|
||||
this.pollInterval = null;
|
||||
setTimeout(() => {
|
||||
this.tishi = false;
|
||||
}, 5000);
|
||||
});
|
||||
};
|
||||
// 每5秒发送一次请求,直到收到正确的响应
|
||||
const pollInterval = setInterval(poll, 5000);
|
||||
this.pollInterval = setInterval(poll, 5000);
|
||||
|
||||
//调用后端 SSE 接口,发送问题并接收实时回答
|
||||
// this.startSSE(params);
|
||||
@@ -1119,6 +1245,18 @@ export default {
|
||||
})
|
||||
|
||||
.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 (
|
||||
res.data.code == 0 &&
|
||||
res.data.medicalRecords != null &&
|
||||
@@ -1163,6 +1301,22 @@ export default {
|
||||
// this.$refs.commonMedicalDetail.initRecordData(this.medicalRecords);
|
||||
// that.initRecordData();
|
||||
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();
|
||||
|
||||
// 滚动到最底部锚点
|
||||
@@ -1192,6 +1346,7 @@ export default {
|
||||
this.$message.error("请选择用户");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.editableMap.chiefComplaint == "") {
|
||||
const titleHtml = this.getTitleHtml(
|
||||
this.record["chiefComplaint"]
|
||||
@@ -1220,6 +1375,49 @@ export default {
|
||||
this.$message.error("请输入 " + titleHtml);
|
||||
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 };
|
||||
for (const key in recordData) {
|
||||
const titleHtml = this.getTitleHtml(recordData[key]);
|
||||
@@ -1234,29 +1432,52 @@ export default {
|
||||
userId: this.addCertificateForm.userId,
|
||||
...recordData
|
||||
};
|
||||
|
||||
// if(this.record.)
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(
|
||||
this.type == "edit"
|
||||
? "/master/medicalRecords/editMedicalRecords"
|
||||
: "/master/medicalRecords/addMedicalRecords"
|
||||
),
|
||||
method: "post",
|
||||
data: this.$http.adornData(
|
||||
this.type == "edit"
|
||||
? {
|
||||
if (this.currentNode.data.id == "caogao") {
|
||||
const label = this.addCertificateForm.labelId;
|
||||
console.log(
|
||||
"this.addCertificateForm at line 1286:",
|
||||
this.addCertificateForm
|
||||
);
|
||||
const value = Array.isArray(label)
|
||||
? label[label.length - 1]
|
||||
: label;
|
||||
console.log("value at line 1289:", value);
|
||||
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: this.addCertificateForm.data
|
||||
? this.addCertificateForm.data
|
||||
: "",
|
||||
id: this.addCertificateForm.id
|
||||
}
|
||||
: {
|
||||
};
|
||||
} else {
|
||||
data = {
|
||||
...data,
|
||||
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 }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
@@ -1315,7 +1536,14 @@ export default {
|
||||
},
|
||||
handlePictureCardPreview(file) {
|
||||
// 图片预览逻辑
|
||||
},
|
||||
handleClose(done) {
|
||||
done();
|
||||
this.$emit("refresh");
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
clearInterval(this.pollInterval);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
>
|
||||
<div
|
||||
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"><span class="line"></span>基本标签信息</div>
|
||||
@@ -86,7 +88,14 @@
|
||||
>
|
||||
( {{ currentNode.data ? currentNode.data.title : "" }} )
|
||||
</span>
|
||||
|
||||
<el-button v-if="currentNode&¤tNode.data.id=='caogao'"
|
||||
plain
|
||||
type="primary"
|
||||
style="margin-left: 20px"
|
||||
@click="openTable('addForm')"
|
||||
size="mini"
|
||||
>新增</el-button
|
||||
>
|
||||
<!-- <div style="" class="button_box"> -->
|
||||
<!-- <el-button plain type="danger" @click="handleCheckAllChange(true)" size="mini">清空</el-button> -->
|
||||
|
||||
@@ -115,7 +124,7 @@
|
||||
:isNoPaging="true"
|
||||
:isShowPagination="true"
|
||||
:isShowNewOperation="
|
||||
addForm.id == 'wait' || addForm.id == 'false' ? true : false
|
||||
addForm.id == 'wait' || addForm.id == 'false' || addForm.id == 'caogao'? true : false
|
||||
"
|
||||
getAssociatedGoodsListValue="result"
|
||||
:tableColumnList="tableColumnList"
|
||||
@@ -134,7 +143,9 @@
|
||||
:style="{
|
||||
height:
|
||||
currentNode.data &&
|
||||
['wait', 'false', 'success'].includes(currentNode.data.id)
|
||||
['wait', 'false', 'success', 'caogao'].includes(
|
||||
currentNode.data.id
|
||||
)
|
||||
? 'calc(100vh - 200px) !important'
|
||||
: 'calc(100vh - 340px)'
|
||||
}"
|
||||
@@ -199,6 +210,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="currentNode && currentNode.data.id != 'caogao'"
|
||||
width="180"
|
||||
prop="toSociologySort"
|
||||
header-align="center"
|
||||
@@ -225,6 +237,7 @@
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
v-if="currentNode && currentNode.data.id != 'caogao'"
|
||||
prop="labelTitle"
|
||||
header-align="center"
|
||||
align="center"
|
||||
@@ -233,6 +246,7 @@
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="currentNode && currentNode.data.id != 'caogao'"
|
||||
prop="title"
|
||||
header-align="center"
|
||||
align="center"
|
||||
@@ -240,6 +254,49 @@
|
||||
>
|
||||
</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"
|
||||
header-align="center"
|
||||
align="center"
|
||||
@@ -250,7 +307,7 @@
|
||||
<el-switch
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
@change="e=>changeTrainValue(e,scope.row)"
|
||||
@change="e => changeTrainValue(e, scope.row)"
|
||||
:value="scope.row.train"
|
||||
active-color="#17B3A3"
|
||||
inactive-color="#aaaaaa96"
|
||||
@@ -270,12 +327,23 @@
|
||||
<template
|
||||
slot="operation"
|
||||
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
|
||||
>
|
||||
<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>
|
||||
|
||||
</commonShop>
|
||||
|
||||
<!-- <div
|
||||
@@ -438,7 +506,7 @@
|
||||
<el-switch
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
@change="e=>changeTrainValue(e,scope.row)"
|
||||
@change="e => changeTrainValue(e, scope.row)"
|
||||
:value="scope.row.train"
|
||||
active-color="#17B3A3"
|
||||
inactive-color="#aaaaaa96"
|
||||
@@ -800,8 +868,7 @@ export default {
|
||||
this.getDataList();
|
||||
},
|
||||
methods: {
|
||||
changeTrainValue(status,data){
|
||||
|
||||
changeTrainValue(status, data) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl("/master/medicalRecords/editMedicalRecords"),
|
||||
method: "post",
|
||||
@@ -812,13 +879,11 @@ export default {
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.refresh()
|
||||
|
||||
this.refresh();
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
refresh() {
|
||||
this.$nextTick(() => {
|
||||
@@ -1048,7 +1113,7 @@ export default {
|
||||
// name: "audio--"
|
||||
// });
|
||||
// }
|
||||
if (!["wait", "false"].includes(form.id)) {
|
||||
if (!["wait", "false", "caogao"].includes(form.id)) {
|
||||
await this.getDataList();
|
||||
this.$nextTick(() => {
|
||||
// this.$refs.commonShop.clear();
|
||||
@@ -1548,6 +1613,16 @@ export default {
|
||||
console.log("🚀 ~ getDataList ~ data:", data);
|
||||
if (data && data.code === 0) {
|
||||
this.treeDataList = [
|
||||
{
|
||||
title: "草稿箱",
|
||||
id: "caogao",
|
||||
disabled: true,
|
||||
isDisableAddChild: true,
|
||||
color: "#bbb",
|
||||
bgcolor: "#f0f0f0",
|
||||
children: [],
|
||||
state: 0
|
||||
},
|
||||
{
|
||||
title: "待审核",
|
||||
id: "wait",
|
||||
|
||||
Reference in New Issue
Block a user