增加抽屉

This commit is contained in:
Euni4U 2025-03-20 15:58:02 +08:00
parent a2ea8d2ba8
commit ca52b5985a
5 changed files with 357 additions and 40 deletions

View File

@ -0,0 +1,172 @@
<template>
<el-drawer
v-model="visible"
title="诊断模板"
direction="rtl"
size="30%"
:destroy-on-close="false"
:before-close="handleClose"
>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<el-form-item label="模板名称" prop="contentName">
<el-input
v-model="queryParams.contentName"
placeholder="请输入模板名称"
clearable
@keyup.enter="handleQuery"
class="!w-160px"
/>
</el-form-item>
<el-form-item label="模板类型" prop="type" class="w-200px">
<el-select v-model="queryParams.type" placeholder="请选择模板类型" clearable>
<el-option label="一般检查" value="一般检查" />
<el-option label="超声" value="超声" />
<el-option label="心电图" value="心电图" />
<el-option label="血常规" value="血常规" />
<el-option label="尿常规" value="尿常规" />
<el-option label="生化" value="生化" />
<el-option label="通用" value="通用" />
<el-option label="汇总" value="汇总" />
</el-select>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table
v-loading="loading"
:data="list"
:stripe="true"
:show-overflow-tooltip="true"
:header-cell-style="{ background: 'rgb(235, 241, 250)', height: '56px', color: '#333333' }"
:row-style="{ height: '56px' }"
@row-click="handleRowClick"
>
<el-table-column label="主键" align="center" prop="id" v-if="false" />
<el-table-column label="模板名称" align="center" prop="contentName" />
<el-table-column label="模板内容" align="center" prop="content" />
<el-table-column label="模板类型" align="center" prop="type" />
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
</el-drawer>
</template>
<script setup lang="ts">
import { ref, computed, watch, nextTick } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { TemplateApi, TemplateVO } from '@/api/inspect/inspecttemplate'
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const list = ref<TemplateVO[]>([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
id: undefined,
type: undefined,
status: undefined,
content: undefined,
orderNum: undefined,
contentName: undefined
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
const Type = ref()
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
queryParams.type = Type.value
const data = await TemplateApi.getTemplatePage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
Type.value = queryParams.type
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
// propsemits
const props = defineProps({
modelValue: {
type: Boolean,
default: false
},
templateType: {
type: String,
required: true
}
})
const emit = defineEmits(['update:modelValue', 'select-template'])
//
const visible = computed({
get: () => props.modelValue,
set: (val) => emit('update:modelValue', val)
})
//
watch(visible, (newVal) => {
if (newVal) {
Type.value = props.templateType
getList()
}
})
//
const handleClose = (done) => {
done()
}
//
const handleRowClick = (template) => {
ElMessageBox.confirm('确认要使用该模板吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
emit('select-template', template.content)
visible.value = false //
ElMessage.success('模板应用成功')
})
.catch(() => {
//
})
}
</script>

View File

@ -255,7 +255,14 @@
<!-- 修改体检小结部分 -->
<div v-if="['ultrasound', 'ecg'].includes(currentTab)" class="findings-diagnosis-container">
<div class="findings-section">
<div class="section-title">检查所见</div>
<div class="section-title">
<span class="title-text">
检查所见
<el-button type="text" @click="openTemplateDrawer('finding')" :disabled="isReadOnly">
诊断模板
</el-button>
</span>
</div>
<textarea
v-model="conclusionData[currentTab].finding"
placeholder="请输入检查所见"
@ -265,7 +272,14 @@
</div>
<div class="diagnosis-section">
<div class="section-title">检查结果</div>
<div class="section-title">
<span class="title-text">
检查结果
<el-button type="text" @click="openTemplateDrawer('diagnosis')" :disabled="isReadOnly">
诊断模板
</el-button>
</span>
</div>
<textarea
v-model="conclusionData[currentTab].diagnosis"
placeholder="请输入检查结果"
@ -277,7 +291,14 @@
<!-- 其他类型使用单栏小结但不包括汇总标签 -->
<div v-else-if="currentTab !== 'summary'" class="summary-section">
<div class="section-title">体检小结</div>
<div class="section-title">
<span class="title-text">
体检小结
<el-button type="text" @click="openTemplateDrawer('summary')" :disabled="isReadOnly">
诊断模板
</el-button>
</span>
</div>
<textarea
v-model="currentSummary"
placeholder="输入多个以分号隔开"
@ -329,6 +350,12 @@
</div>
</div>
</div>
<!-- 添加模板抽屉组件 -->
<template-drawer
v-model="drawerVisible"
:template-type="currentTemplateType"
@select-template="insertTemplate"
/>
</template>
<script setup>
@ -343,6 +370,7 @@ import All from './All.vue' // 导入All组件用于超声、心电图等
import { PacsDataApi } from '@/api/inspect/inspectpacsdata' // PacsDataApi
import { getStrDictOptions } from '@/utils/dict'//
import Summary from './summary.vue' // Summary
import TemplateDrawer from './Drawer-Template.vue'
const dialogTitle = ref('体检报告')
@ -1915,6 +1943,75 @@ const currentSummary = computed({
}
});
//
const drawerVisible = ref(false)
const currentTemplateType = ref('')
//
const openTemplateDrawer = (type) => {
if (isReadOnly.value) {
ElMessage.warning('已检查患者不可修改内容')
return
}
//
let templateType
switch (currentTab.value) {
case 'general':
templateType = '一般检查'
break
case 'ultrasound':
templateType = '超声'
break
case 'ecg':
templateType = '心电图'
break
case 'blood':
templateType = '血常规'
break
case 'urine':
templateType = '尿常规'
break
case 'biochemical':
templateType = '生化'
break
case 'summary':
templateType = '汇总'
break
default:
templateType = '通用'
}
currentTemplateType.value = templateType
drawerVisible.value = true
}
//
const insertTemplate = (templateContent) => {
if (isReadOnly.value) return
switch(currentTab.value) {
case 'ultrasound':
conclusionData.value.ultrasound.finding += templateContent
break
case 'ecg':
conclusionData.value.ecg.finding += templateContent
break
case 'blood':
case 'urine':
case 'biochemical':
case 'general':
conclusionData.value[currentTab.value].summary += templateContent
break
case 'summary':
summaryRef.value?.insertTemplate(templateContent)
break
}
drawerVisible.value = false
}
</script>
<style scoped>
@ -2929,4 +3026,44 @@ cursor: not-allowed;
white-space: nowrap;
display: block;
}
.section-title {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
}
.section-title .el-button {
padding: 0;
font-size: 14px;
}
.section-title {
margin-bottom: 10px;
}
.title-text {
display: flex;
align-items: center;
gap: 8px; /* 调整文字和按钮之间的间距 */
font-weight: bold;
}
.title-text .el-button {
padding: 0;
height: auto;
font-size: 14px;
margin-left: 8px;
font-weight: normal;
color: #409EFF;
}
.title-text .el-button:hover {
color: #66b1ff;
}
.title-text .el-button[disabled] {
color: #C0C4CC;
}
</style>

View File

@ -3,15 +3,7 @@
<div class="summary-header">
<div class="title-with-button">
<h3>体检汇总</h3>
<!-- <el-button
type="success"
circle
size="small"
@click="loadPatientItems"
class="refresh-button"
>
<el-icon><Refresh /></el-icon>
</el-button> -->
<el-button type="text" @click="openTemplateDrawer" style="margin-left: 15px;">诊断模板</el-button>
</div>
</div>
@ -26,6 +18,12 @@
></textarea>
</div>
</div>
<!-- 添加诊断模板抽屉组件 -->
<template-drawer
v-model="drawerVisible"
@select-template="insertTemplate"
/>
</div>
</template>
@ -35,6 +33,7 @@ import { PatientitemsApi } from '@/api/inspect/inspectpatientitems'
import { PatientApi } from '@/api/inspect/inspectpatient'
import { ElLoading, ElMessage } from 'element-plus'
import { Refresh } from '@element-plus/icons-vue'
import TemplateDrawer from '@/views/Department-entry/Drawer-Template.vue'
const props = defineProps({
patient: {
@ -75,7 +74,6 @@ const checkPatientStatus = () => {
if (props.patient?.status) {
//
isReadOnly.value = String(props.patient.status) === '1'
console.log('患者状态:', props.patient.status, '只读模式:', isReadOnly.value)
}
}
@ -132,7 +130,6 @@ const formatSummaryData = () => {
// DOM
const getDataFromDOM = () => {
console.log('尝试从DOM中获取数据...')
try {
const parentDoc = window.parent ? window.parent.document : document
@ -160,7 +157,6 @@ const getDataFromDOM = () => {
for (const selector of selectorList) {
const element = parentDoc.querySelector(selector)
if (element) {
console.log(`找到元素 ${selector}:`, element)
return element.value || ''
}
}
@ -177,28 +173,15 @@ const getDataFromDOM = () => {
const urineSummary = getElementValue(selectors.urine)
const biochemicalSummary = getElementValue(selectors.biochemical)
console.log('从DOM获取的数据:')
console.log('一般检查小结:', generalSummary)
console.log('超声检查所见:', ultrasoundFinding)
console.log('超声检查结果:', ultrasoundDiagnosis)
console.log('心电图检查所见:', ecgFinding)
console.log('心电图检查结果:', ecgDiagnosis)
console.log('血常规小结:', bloodSummary)
console.log('尿常规小结:', urineSummary)
console.log('生化小结:', biochemicalSummary)
//
if (!generalSummary) {
console.log('尝试从体检小结文本框获取数据...')
const generalTextarea =
parentDoc.querySelector('#体检小结') ||
parentDoc.querySelector('.体检小结') ||
parentDoc.querySelector('[placeholder*="体检小结"]')
if (generalTextarea) {
console.log('找到体检小结文本框:', generalTextarea)
const generalText = generalTextarea.value || ''
console.log('体检小结内容:', generalText)
//
return {
@ -242,17 +225,14 @@ const loadPatientItems = async () => {
background: 'rgba(255, 255, 255, 0.7)'
})
console.log('当前患者信息:', props.patient)
//
checkPatientStatus()
// 使propsconclusionData
if (props.conclusionData) {
console.log('从props获取conclusionData:', props.conclusionData)
summaryData.value = props.conclusionData
} else if (window.parent?.conclusionData) {
console.log('父窗口conclusionData:', window.parent.conclusionData)
const parentData = window.parent.conclusionData
//
@ -271,20 +251,17 @@ const loadPatientItems = async () => {
biochemical: { summary: parentData.biochemical?.summary || '' }
}
console.log('从父窗口获取的汇总数据:', summaryData.value)
} else {
console.warn('父窗口中没有找到conclusionData尝试从全局变量获取')
//
if (window.conclusionData) {
console.log('从全局变量获取conclusionData:', window.conclusionData)
summaryData.value = window.conclusionData
} else {
console.warn('全局变量中没有找到conclusionData尝试从props获取')
// props
if (props.reportData && props.reportData.conclusionData) {
console.log('从props.reportData中获取数据:', props.reportData.conclusionData)
summaryData.value = props.reportData.conclusionData
} else {
// DOM
@ -301,7 +278,6 @@ const loadPatientItems = async () => {
//
const formattedText = formatSummaryData()
console.log('格式化后的文本:', formattedText)
editableSummary.value = formattedText
loading.close()
} catch (error) {
@ -336,7 +312,6 @@ const saveSummary = async () => {
summaryResult: editableSummary.value
}
console.log('保存汇总数据:', saveData)
// API
const response = await PatientApi.updatemedicalSn(saveData)
@ -371,8 +346,6 @@ const queryPatientData = async () => {
try {
const response = await PatientApi.getByMedicalSn(props.patient.medicalSn)
if (response && response.code === 200 && response.data) {
console.log('查询到的患者数据:', response.data)
//
if (response.data.summaryResult) {
editableSummary.value = response.data.summaryResult
@ -381,7 +354,6 @@ const queryPatientData = async () => {
//
if (response.data.status) {
isReadOnly.value = response.data.status === 2
console.log('更新后的患者状态:', response.data.status, '只读模式:', isReadOnly.value)
}
}
} catch (error) {
@ -407,6 +379,29 @@ watch(() => props.patient, (newVal) => {
}
}, { deep: true, immediate: true })
//
const drawerVisible = ref(false)
//
const openTemplateDrawer = () => {
if (isReadOnly.value) {
ElMessage.warning('已检查患者不可修改汇总内容')
return
}
drawerVisible.value = true
}
//
const insertTemplate = (templateContent) => {
if (isReadOnly.value) return
//
editableSummary.value += templateContent
//
drawerVisible.value = false
}
//
defineExpose({ saveSummary })
</script>

View File

@ -10,6 +10,18 @@
<el-form-item label="模板名称" prop="contentName">
<el-input v-model="formData.contentName" placeholder="请输入模板名称" />
</el-form-item>
<el-form-item label="模板类型" prop="type">
<el-select v-model="formData.type" placeholder="请选择模板类型">
<el-option label="一般检查" value="一般检查" />
<el-option label="超声" value="超声" />
<el-option label="心电图" value="心电图" />
<el-option label="血常规" value="血常规" />
<el-option label="尿常规" value="尿常规" />
<el-option label="生化" value="生化" />
<el-option label="通用" value="通用" />
<el-option label="汇总" value="汇总" />
</el-select>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="formData.status">
<el-radio-button label="启用" value="1" />

View File

@ -71,6 +71,7 @@
</el-tag>
</template>
</el-table-column>
<el-table-column label="模板类型" align="center" prop="type" />
<el-table-column label="操作" align="center" min-width="120px">
<template #default="scope">
<el-button
@ -136,7 +137,7 @@ const getList = async () => {
try {
const data = await TemplateApi.getTemplatePage(queryParams)
list.value = data.list
total.value = data.totall
total.value = data.total
} finally {
loading.value = false
}