This commit is contained in:
2025-07-28 11:02:26 +08:00
parent 859a342326
commit 6de8ce34e6
10 changed files with 2038 additions and 348 deletions

View File

@@ -23,7 +23,7 @@ module.exports = {
},
// Various Dev Server settings
host: '192.168.110.160', // can be overwritten by process.env.HOST
host: '192.168.110.159', // can be overwritten by process.env.HOST
port: 8001, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: true,
errorOverlay: true,

View File

@@ -17,6 +17,7 @@
<script src="./static/plugins/ueditor-1.4.3.3/ueditor.config.js"></script>
<script src="./static/plugins/ueditor-1.4.3.3/ueditor.all.min.js"></script>
<script src="./static/plugins/ueditor-1.4.3.3/lang/zh-cn/zh-cn.js"></script>
<script src="https://unpkg.com/mammoth/mammoth.browser.min.js"></script>
<% } %>
</head>
<body>

View File

@@ -24,6 +24,7 @@
"gulp-replace": "1.0.0",
"gulp-shell": "0.8.0",
"lodash": "4.17.5",
"mammoth": "^1.9.1",
"node-sass": "^4.0.0",
"npm": "^6.9.0",
"quill-image-resize-module": "^3.0.0",

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 B

View File

@@ -12,6 +12,7 @@ import '@/element-ui-theme'
import '@/assets/scss/index.scss'
import '@/assets/css/time-line.less' // 引入时间线样式
import Bus from '@/assets/js/eventBus.js'
import commonJS from '@/views/common/js/commonJS'
import httpRequest from '@/utils/httpRequest' // api: https://github.com/axios/axios
import { isAuth } from '@/utils'
import cloneDeep from 'lodash/cloneDeep'
@@ -38,10 +39,11 @@ if (process.env.NODE_ENV !== 'production') {
}
// 挂载全局
Vue.prototype.$http = httpRequest // ajax请求方法
Vue.prototype.isAuth = isAuth // 权限方法
Vue.prototype.$bus = Bus
Vue.prototype.$commonJS = commonJS //
// 保存整站vuex本地储存初始状态
window.SITE_CONFIG['storeState'] = cloneDeep(store.state)

View File

@@ -0,0 +1,88 @@
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

@@ -55,21 +55,21 @@
<!-- -->
<el-table-column
v-if="!disableOperate"
v-if="!isDisableOperate"
header-align="center"
align="center"
label="操作"
width="120"
:width="operationWidth?operationWidth:120"
>
<template slot-scope="scope">
<slot name="operation" :row="scope.row"></slot>
<el-button
type="text"
v-if="urlList.editCourse"
v-if="urlList.editCourse&&!isShowNewOperation"
@click="editCourse(scope.row)"
>编辑</el-button
>
<el-button
<el-button v-if="!isShowNewOperation"
type="text"
style="color: red;"
@click="shopDelete(scope.row)"
@@ -155,11 +155,14 @@ export default {
"isShowPagination",
"axiosType",
"otherInfo",
"isShowNewOperation",
"operationWidth",
"CustomEdit",
"pageSizes"
],
data() {
return {
isDisableOperate: this.disableOperate,
multipleSelectionAll: [], // 所有选中的数据包含跨页数据
goodsTypeList: [], // goodsTypeList
multipleSelection: [], // 当前页选中的数据
@@ -458,7 +461,7 @@ export default {
// 获取关联数据列表
async getAssociatedGoodsList() {
this.$emit("changeStatisticsQuery");
this.disableOperate = false;
this.isDisableOperate = false;
console.log("🚀 ~ getAssociatedGoodsList ~ form:11111", form);
var form = { ...this.defaultForm, ...this.dataForm };
@@ -564,7 +567,7 @@ export default {
}
},
async statisticsQuery() {
this.disableOperate = true;
this.isDisableOperate = true;
var form = { ...this.defaultForm, ...this.dataForm };
this.dataListLoading = true;

File diff suppressed because it is too large Load Diff

View File

@@ -20,11 +20,77 @@
<div
v-if="dialogVisible"
style="padding: 0 20px;box-sizing: border-box;height: calc(100% - 40px);overflow-y: auto;"
:style="addCertificateForm.state == 2 ? 'height:100%' : ''"
:style="
addCertificateForm.state == 2 || !showMessages ? 'height:100%' : ''
"
>
<template v-if="!showMessages">
<!-- 触发按钮 -->
<p style="cursor: pointer;margin: 0;margin-bottom: 10px;" v-if="isShowWord">
<span @click="triggerUpload">上传 Word</span>
<img
src="../../../assets/img/word-iocn.png"
alt=""
@click="triggerUpload"
/>
<span
style="color:red;float: right;"
v-if="messageList.length > 0"
@click="messageList = []"
>
<i class="el-icon-delete"></i>
清空
</span>
</p>
<!-- 隐藏上传框 -->
<input
type="file"
ref="uploadInput"
accept=".docx"
@change="handleUpload"
style="display: none"
/>
<div
style="display: flex;align-items: center;justify-content: flex-start;flex-wrap: wrap;" v-if="isShowWord"
>
<div
v-for="(v, i) in messageList"
class="wordItem" @click="insertMessage(v)"
style="width: 32%;margin-right: 15px;margin-bottom: 10px;cursor: pointer;"
>
<div
style="border: 1px solid #bbb;border-radius: 8px;height: 88px;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
size="mini"
type=""
plain
icon="el-icon-plus"
<div class="home_wrap home_wrap_analysis" >
style="margin-left: 10px; padding: 2px;float: right;"
>快速填入</el-button
>
</p>
<div
style=" overflow: hidden;font-size: 13px;padding: 10px 10px 0;box-sizing: border-box;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-height: 1.5;
max-height: calc(1.5em * 3);
text-overflow: ellipsis;
word-break: break-word; /* 可选:精确限制高度,兼容性更好 */"
>
{{ v }}
</div>
</div>
</div>
</div>
<template v-if="!showMessages">
<div class="home_wrap home_wrap_analysis">
<div class="home_form" style="position: relative">
<div
class="form_item"
@@ -38,48 +104,68 @@
<!-- 固定标题和输入框部分 -->
<div class="analysis_box">
<div class="analysis_title">
<div
class="analysis_title"
style="width: 100%;overflow: hidden;"
>
智能分析医案
</div>
<!-- 固定的输入框部分 -->
<div style="height: calc(100% - 120px)">
<quill-editor
<div
style="height: calc(100% - 20px);padding:15px 15px 0;box-sizing: border-box;"
>
<!-- <quill-editor
style=" min-height: 95% !important;"
placeholder="请输入医案到此处,将自动解析医案信息"
v-model="message"
ref="myQuillEditor"
:options="editorOption"
class="shangpin_editor"
>
</quill-editor>
</quill-editor> -->
<textarea
style=" min-height: 95% !important;"
placeholder="请输入医案到此处,将自动解析医案信息"
v-model="message"
ref="myQuillEditor"
:options="editorOption"
>
</textarea>
<el-button
type="primary"
size="mini"
@click="submit"
style="float: right;margin-right: 10px;margin-top: 4px;background-color: #1781ff;"
>解析医案</el-button
>
</div>
</div>
<div class="submit_btn" @click="submit">解析医案</div>
</div>
</div>
<!-- 搜索结果列表 -->
<scroll-div
scroll-y
class="result-list"
v-if="searchResultStatus && searchResults.length > 0"
>
<div
v-for="item in searchResults"
:key="item.id"
@click="selectItem(item)"
class="result-item"
>
{{ item.name }}
</div>
</scroll-div>
</div>
</template>
<template v-else> <div
v-if="addCertificateForm.mark&&(addCertificateForm.mark.state==2||addCertificateForm.state==3)"
<template v-else>
<el-alert
v-if="tishi"
:title="
loading
? '解析预计耗时约50秒,请耐心等待'
: '好的结合您的医案下面是解析后的结果。5秒后自动关闭'
"
:type="loading ? 'warning' : 'success'"
show-icon
>
</el-alert>
<template v-if="!loading">
<div
v-if="
addCertificateForm.mark &&
(addCertificateForm.mark.state == 2 ||
addCertificateForm.state == 3)
"
style="padding:4px 10px;border-radius: 4px;white-space: wrap;"
:style="
`color:${currentNode.data.color ? currentNode.data.color : ''};
@@ -155,7 +241,11 @@
v-if="pageType == 'user'"
style="display:flex;align-items:center;justify-content:space-between"
>
<el-form-item label="手机号/邮箱:" prop="user" class="form_item">
<el-form-item
label="手机号/邮箱:"
prop="user"
class="form_item"
>
<div style="display: flex;align-items: center;">
{{ addCertificateForm.userKey }}
</div>
@@ -367,17 +457,25 @@
</div> -->
</el-form-item>
</el-form></template>
</el-form>
</template>
<div v-else v-loading="loading" style="height: 95%;"></div>
</template>
</div>
<div class="demo-drawer__footer" v-if="type == 'edit' || type == 'add'">
<div
class="demo-drawer__footer"
v-if="
type == 'edit' || (type == 'add' && showMessages && loading == false)
"
>
<div class="drawer_footer_box">
<el-button
style="float: right;margin:0 10px;"
type="primary"
size="mini"
@click="handleSubmit('addCertificateForm')"
:loading="loading"
>{{ loading ? "提交中 ..." : "确 定" }}</el-button
>提 交</el-button
>
<el-button
size="mini"
@@ -386,18 +484,19 @@
>取 消</el-button
>
</div>
</div>
<div
class="demo-drawer__footer"
v-if="type == 'detail' && addCertificateForm.state == 1"
>
<div class="drawer_footer_box">
<!-- <el-checkbox v-model="addCertificateForm.train" true-label="1" false-label="0">是否加入Ai训练库</el-checkbox> -->
<el-button
style="float: right;margin:0 10px;"
type="primary"
size="mini"
@click="handleReview('approved', 1)"
:loading="loading"
>审核通过</el-button
>
<el-button
@@ -408,6 +507,7 @@
>审核拒绝</el-button
>
</div>
</div>
</el-drawer>
<el-dialog
:title="`审核${reviewType == 'approved' ? '通过' : '拒绝'}备注`"
@@ -488,9 +588,13 @@ export default {
props: ["data", "pageType", "dataInfo", "labelId", "currentNode"],
data() {
return {
isShowWord:false,
record: {},
loading: false,
tishi: false,
message: "",
showMessages:true,
messageList: [],
showMessages: false,
editableMap: {}, // 存储每个字段的内部可编辑内容
editorOption: {
modules: {
@@ -550,7 +654,10 @@ export default {
audioFileList: [],
isFresh: false,
type: "",
detailContent: ""
detailContent: "",
medicalId: "",
medicalRecords: {},
content: ""
};
},
components: {
@@ -574,6 +681,65 @@ export default {
// this.getDataList();
},
methods: {
numberToChineseLower(n) {
const cnNums = [
"零",
"一",
"二",
"三",
"四",
"五",
"六",
"七",
"八",
"九"
];
const cnUnits = ["", "十", "百", "千", "万", "亿"];
if (n === 0) return cnNums[0];
let result = "";
const digits = String(n)
.split("")
.reverse();
for (let i = 0; i < digits.length; i++) {
const num = Number(digits[i]);
const unit = num === 0 ? "" : cnUnits[i];
result = (num === 0 ? cnNums[num] : cnNums[num] + unit) + result;
}
// 去除多余的“零”
result = result.replace(/零+/g, "零").replace(/零$/g, "");
result = result.replace(/^一十/, "十"); // 10-19 处理为 十一、十二...
return result;
},
insertMessage(data) {
this.message = data;
console.log("this.message at line 650:", this.message);
},
// 点击按钮触发上传
triggerUpload() {
this.messageList=[]
this.$refs.uploadInput.value = null;
this.$refs.uploadInput.click();
},
// 处理上传文件
handleUpload(event) {
this.$commonJS.handleUpload(event, 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;
// document.getElementById("result").innerHTML = content
});
},
beforeClose() {
this.dialogMarkVisible = false;
},
@@ -688,6 +854,11 @@ export default {
alert("保存成功!");
},
init(type, data) {
this.showMessages = false;
this.messageList = [];
this.message = "";
this.tishi = false;
this.loading = false;
this.getCateList();
this.type = type;
console.log("data at line 372:", data);
@@ -705,9 +876,13 @@ export default {
};
this.isEdit = type == "edit" || type == "add" ? true : false;
if (type == "add") {
this.isShowWord=true
this.record = {
...recordData
};
}else{
this.isShowWord=false
this.showMessages = true;
}
if (data) {
if (type == "edit" || type == "detail") {
@@ -799,9 +974,8 @@ export default {
userId: this.addCertificateForm.userId,
train: this.addCertificateForm.train, //是否加入ai训练库0否1是
mark: this.addCertificateForm.mark, //备注
state: this.reviewType == "approved" ? 3 : 2 ,//备注
...recordData,
state: this.reviewType == "approved" ? 3 : 2, //备注
...recordData
};
// if(this.record.)
@@ -810,7 +984,9 @@ export default {
method: "post",
data: this.$http.adornData({
...data,
data: this.addCertificateForm.data?this.addCertificateForm.data:'',
data: this.addCertificateForm.data
? this.addCertificateForm.data
: "",
id: this.addCertificateForm.id
})
}).then(({ data }) => {
@@ -837,6 +1013,140 @@ export default {
this.reviewType = type;
this.dialogMarkVisible = true;
},
submit() {
//没有次数的时候要求购买vip
if (!this.message) {
this.$message.error("请输入医案详情");
return;
}
//创建对话 获取sessionId
this.createChat();
},
//创建新对话
createChat() {
this.$http({
url: this.$http.adornUrl("/common/medicalRecords/medicalRecordsSplit"),
method: "post",
data: this.$http.adornData({
userId: "13487",
message: this.message
})
}).then(res => {
console.log("res at line 872:", res);
if (res.data.code == 0) {
this.medicalId = res.data.data;
this.sendQuestion();
}
});
},
//交谈请求,获取回答
sendQuestion() {
//清空消息记录
this.showMessages = true;
this.loading = true;
var that = this;
//展示提示语
this.tishi = true;
this.isShowWord=false
this.messageList=[]
const poll = () => {
this.getMedicalDetail(() => {
// 停止轮询
clearInterval(pollInterval);
setTimeout(() => {
this.tishi = false;
}, 5000);
});
};
// 每5秒发送一次请求直到收到正确的响应
const pollInterval = setInterval(poll, 5000);
//调用后端 SSE 接口,发送问题并接收实时回答
// this.startSSE(params);
},
getMedicalDetail(fn) {
//清空消息记录
this.$http({
url: this.$http.adornUrl(
"/common/medicalRecords/medicalRecordsQuerySplit"
),
method: "post",
data: this.$http.adornData({
id: this.medicalId
})
})
.then(res => {
if (
res.data.code == 0 &&
res.data.medicalRecords != null &&
res.data.medicalRecords.data != ""
) {
console.log(res, "999999");
var data = { ...res.data.medicalRecords };
this.loading = false;
this.record = {
information: data.information
? data.information
: recordData.information,
chiefComplaint: data.chiefComplaint
? data.chiefComplaint
: recordData.chiefComplaint,
historyOfPresentIllness: data.historyOfPresentIllness
? data.historyOfPresentIllness
: recordData.historyOfPresentIllness,
pastHistory: data.pastHistory
? data.pastHistory
: recordData.pastHistory,
personalAndFamilyHistory: data.personalAndFamilyHistory
? data.personalAndFamilyHistory
: recordData.personalAndFamilyHistory,
physicaExamination: data.physicaExamination
? data.physicaExamination
: recordData.physicaExamination,
diagnosis: data.diagnosis ? data.diagnosis : recordData.diagnosis,
treatmentPlan: data.treatmentPlan
? data.treatmentPlan
: recordData.treatmentPlan
};
for (const key in this.record) {
this.$set(
this.editableMap,
key,
this.getInnerHtml(this.record[key])
);
}
// this.$refs.commonMedicalDetail.initRecordData(this.medicalRecords);
// that.initRecordData();
console.log("at line 558:", this.record);
this.$forceUpdate();
// 滚动到最底部锚点
// that.$nextTick(() => {
// that.scrollToBottom();
// });
// 停止轮询
if (fn) {
fn();
}
}
})
.catch(error => {
console.log("请求出错:", error);
});
//调用后端 SSE 接口,发送问题并接收实时回答
// this.startSSE(params);
},
handleSubmit: debounce(async function() {
// this.addCertificateForm
console.log("this.addCertificateForm at line 479:", this.editableMap);
@@ -901,7 +1211,9 @@ export default {
this.type == "edit"
? {
...data,
data:this.addCertificateForm.data?this.addCertificateForm.data:'',
data: this.addCertificateForm.data
? this.addCertificateForm.data
: "",
id: this.addCertificateForm.id
}
: {
@@ -976,9 +1288,7 @@ data:this.addCertificateForm.data?this.addCertificateForm.data:'',
.width100 {
width: 100% !important;
}
.el-drawer__header {
margin-bottom: 0 !important;
}
.el-form-item {
margin-bottom: 8px;
}
@@ -1034,17 +1344,17 @@ data:this.addCertificateForm.data?this.addCertificateForm.data:'',
}
}
.analysis_box {
padding-bottom: 40px;
padding-bottom: 10px;
width: 100%;
background-color: #fff;
border: 1px solid #188bff !important;
border-radius: 20px;
height: 84vh;
min-height: 84vh;
height: auto;
border-radius: 10px;
box-sizing: border-box !important;
uni-textarea {
textarea {
border: none !important;
}
.analysis_title {
@@ -1057,7 +1367,7 @@ data:this.addCertificateForm.data?this.addCertificateForm.data:'',
}
}
/deep/.home_wrap_analysis {
height: 89vh;
// height: 89vh;
.home_form {
padding-bottom: 0px;
}
@@ -1070,21 +1380,22 @@ data:this.addCertificateForm.data?this.addCertificateForm.data:'',
.uni-textarea-wrapper {
// height: 100% !important;
}
textarea {
max-width: 100%;
width: 100%;
min-width: 100%;
height: calc(95vh - 200px) !important;
border: none;
}
.ql-container {
height: calc(95vh - 200px) !important;
border: none;
}
textarea:focus {
outline: none; /* 去除系统默认黑色描边 */
border: 1px solid #409eff; /* 可选:设置你希望的边框颜色 */
box-shadow: none; /* 可选:移除蓝色阴影(某些浏览器) */
}
.submit_btn {
padding: 0 20px;
position: absolute;
right: 24px;
bottom: 24px;
background-color: #1985fd;
margin: auto auto;
margin-top: 10px;
border-radius: 4px;
line-height: 30px;
height: 30px;
text-align: center;
color: #fff;
// font-weight: bold;
}
}
.content_detail {
@@ -1093,4 +1404,7 @@ data:this.addCertificateForm.data?this.addCertificateForm.data:'',
.message_wrap_detail {
padding: 0;
}
.wordItem:nth-child(3n) {
margin-right: 0 !important;
}
</style>

View File

@@ -243,7 +243,7 @@
prop="title"
header-align="center"
align="center"
width="120"
width="110"
label="是否加入数据库"
>
<template slot-scope="scope">
@@ -431,7 +431,7 @@
prop="title"
header-align="center"
align="center"
width="120"
width="110"
label="是否加入数据库"
>
<template slot-scope="scope">