add DoctorNote
诊单 增加医生备注入口
This commit is contained in:
@@ -34,3 +34,4 @@ bin-release/
|
|||||||
/server/.claude
|
/server/.claude
|
||||||
/.spool
|
/.spool
|
||||||
TUICallKit-Vue3/.env
|
TUICallKit-Vue3/.env
|
||||||
|
/.codegraph
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="note-timeline-wrap">
|
<div class="note-timeline-wrap">
|
||||||
<div v-if="!readonly && diagnosisId" class="timeline-actions">
|
<div v-if="!readonly && diagnosisId" class="timeline-actions">
|
||||||
|
<el-button
|
||||||
|
v-if="hasAddDoctorNotePermission"
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
size="small"
|
||||||
|
@click="showNoteDialog = true"
|
||||||
|
>
|
||||||
|
添加备注
|
||||||
|
</el-button>
|
||||||
<material-picker
|
<material-picker
|
||||||
v-model="tongueModel"
|
v-model="tongueModel"
|
||||||
:limit="99"
|
:limit="99"
|
||||||
@@ -95,16 +104,32 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<el-empty v-if="!notes.length && readonly" description="暂无备注" :image-size="48" />
|
<el-empty v-if="!notes.length && readonly" description="暂无备注" :image-size="48" />
|
||||||
|
|
||||||
|
<el-dialog v-model="showNoteDialog" title="添加备注" width="480px" append-to-body>
|
||||||
|
<el-input
|
||||||
|
v-model="noteContent"
|
||||||
|
type="textarea"
|
||||||
|
:rows="4"
|
||||||
|
placeholder="输入今日备注..."
|
||||||
|
maxlength="500"
|
||||||
|
show-word-limit
|
||||||
|
/>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="showNoteDialog = false">取消</el-button>
|
||||||
|
<el-button type="primary" :loading="noteSaving" @click="handleSaveNote">保存</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
import { CircleClose, Document } from '@element-plus/icons-vue'
|
import { CircleClose, Document } from '@element-plus/icons-vue'
|
||||||
import { ElMessageBox } from 'element-plus'
|
import { ElMessageBox } from 'element-plus'
|
||||||
import useAppStore from '@/stores/modules/app'
|
import useAppStore from '@/stores/modules/app'
|
||||||
import { addDoctorNote, deleteDoctorNoteImage } from '@/api/patient'
|
import { addDoctorNote, deleteDoctorNoteImage } from '@/api/patient'
|
||||||
import feedback from '@/utils/feedback'
|
import feedback from '@/utils/feedback'
|
||||||
|
import { hasPermission } from '@/utils/perm'
|
||||||
|
|
||||||
export interface DoctorNoteItem {
|
export interface DoctorNoteItem {
|
||||||
id: number
|
id: number
|
||||||
@@ -122,6 +147,13 @@ const props = defineProps<{
|
|||||||
|
|
||||||
const emit = defineEmits<{ refresh: [] }>()
|
const emit = defineEmits<{ refresh: [] }>()
|
||||||
|
|
||||||
|
/** 与接诊台悬浮「备注」按钮一致 */
|
||||||
|
const hasAddDoctorNotePermission = computed(() => hasPermission(['doctor.appointment/addDoctorNote']))
|
||||||
|
|
||||||
|
const showNoteDialog = ref(false)
|
||||||
|
const noteContent = ref('')
|
||||||
|
const noteSaving = ref(false)
|
||||||
|
|
||||||
const appStore = useAppStore()
|
const appStore = useAppStore()
|
||||||
const getImageUrl = (url: string) => appStore.getImageUrl(url)
|
const getImageUrl = (url: string) => appStore.getImageUrl(url)
|
||||||
|
|
||||||
@@ -201,6 +233,30 @@ watch(() => props.notes, () => {
|
|||||||
prevReportCount.value = 0
|
prevReportCount.value = 0
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const handleSaveNote = async () => {
|
||||||
|
if (!props.diagnosisId) {
|
||||||
|
feedback.msgWarning('当前无诊单,无法添加备注')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const text = noteContent.value.trim()
|
||||||
|
if (!text) {
|
||||||
|
feedback.msgWarning('请输入备注内容')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
noteSaving.value = true
|
||||||
|
try {
|
||||||
|
await addDoctorNote({ diagnosis_id: props.diagnosisId, content: text })
|
||||||
|
feedback.msgSuccess('备注保存成功')
|
||||||
|
noteContent.value = ''
|
||||||
|
showNoteDialog.value = false
|
||||||
|
emit('refresh')
|
||||||
|
} catch (e: any) {
|
||||||
|
feedback.msgError(e?.message || '保存失败')
|
||||||
|
} finally {
|
||||||
|
noteSaving.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const handleDeleteImage = async (noteId: number, imageType: 'tongue_images' | 'report_files', imagePath: string) => {
|
const handleDeleteImage = async (noteId: number, imageType: 'tongue_images' | 'report_files', imagePath: string) => {
|
||||||
try {
|
try {
|
||||||
await ElMessageBox.confirm('确认删除?', '提示', { type: 'warning' })
|
await ElMessageBox.confirm('确认删除?', '提示', { type: 'warning' })
|
||||||
@@ -217,6 +273,7 @@ const handleDeleteImage = async (noteId: number, imageType: 'tongue_images' | 'r
|
|||||||
.timeline-actions {
|
.timeline-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
padding-bottom: 12px;
|
padding-bottom: 12px;
|
||||||
|
|||||||
Reference in New Issue
Block a user