fix: 慢性病管理功能优化完善。

This commit is contained in:
tianyongbao
2026-03-21 22:31:14 +08:00
parent 639c2c913d
commit 9fd1ebc65e
5 changed files with 319 additions and 109 deletions

View File

@@ -26,11 +26,11 @@ export function delMedicationTask(id) {
}
// 确认服药
export function confirmMedication(id, confirmType) {
export function confirmMedication(id, confirmType, confirmTime) {
return request({
url: '/health/medicationTask/confirm/' + id,
method: 'put',
params: { confirmType }
params: { confirmType, confirmTime }
})
}
@@ -50,4 +50,4 @@ export function markMissed(id, notes) {
method: 'put',
params: { notes }
})
}
}

View File

@@ -3,8 +3,8 @@
<div class="search-con">
<div class="title">查询条件</div>
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="成员" prop="memberId">
<el-select v-model="queryParams.memberId" placeholder="请选择成员" clearable filterable>
<el-form-item label="成员" prop="personId">
<el-select v-model="queryParams.personId" placeholder="请选择成员" clearable filterable>
<el-option v-for="item in memberList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
@@ -39,7 +39,7 @@
<el-table v-loading="loading" :data="chronicDiseaseList" @selection-change="handleSelectionChange" height="calc(100% - 0.65rem)">
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="index" label="序号" :index="indexMethod" width="50"></el-table-column>
<el-table-column label="成员" align="center" prop="memberName" width="100" />
<el-table-column label="成员" align="center" prop="personName" width="100" />
<el-table-column label="疾病名称" align="center" prop="diseaseName" min-width="120" show-overflow-tooltip />
<el-table-column label="疾病编码" align="center" prop="diseaseCode" width="100" />
<el-table-column label="确诊日期" align="center" prop="diagnosisDate" width="110">
@@ -91,8 +91,8 @@
<!-- 添加或修改慢性疾病档案对话框 -->
<el-dialog :title="title" v-model="open" width="880px" append-to-body>
<el-form ref="chronicDiseaseRef" :model="form" :inline="true" :rules="rules" label-width="120px">
<el-form-item label="成员" prop="memberId">
<el-select v-model="form.memberId" placeholder="请选择成员" filterable @change="handleMemberChange">
<el-form-item label="成员" prop="personId">
<el-select v-model="form.personId" placeholder="请选择成员" filterable @change="handleMemberChange">
<el-option v-for="item in memberList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
@@ -108,13 +108,7 @@
<el-input v-model="form.diseaseCode" placeholder="ICD-10编码可选" />
</el-form-item>
<el-form-item label="确诊日期" prop="diagnosisDate">
<el-date-picker
v-model="form.diagnosisDate"
type="date"
placeholder="选择确诊日期"
value-format="YYYY-MM-DD"
style="width: 200px"
/>
<el-date-picker v-model="form.diagnosisDate" type="date" placeholder="选择确诊日期" value-format="YYYY-MM-DD" style="width: 200px" />
</el-form-item>
<el-form-item label="状态" prop="diseaseStatus">
<el-select v-model="form.diseaseStatus" placeholder="请选择状态">
@@ -130,8 +124,8 @@
<el-form-item label="科室" prop="department">
<el-input v-model="form.department" placeholder="请输入科室" />
</el-form-item>
<el-form-item label="备注说明" style="width: 792px" prop="notes">
<el-input v-model="form.notes" type="textarea" :rows="3" placeholder="请输入备注说明" />
<el-form-item label="诊断结果" style="width: 792px" prop="notes">
<el-input v-model="form.notes" type="textarea" :rows="3" placeholder="请输入说明" />
</el-form-item>
<el-form-item label="备注" style="width: 792px" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
@@ -177,13 +171,13 @@ const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 10,
memberId: null,
personId: null,
diseaseName: null,
diseaseStatus: null,
isActive: null
},
rules: {
memberId: [{ required: true, message: '成员不能为空', trigger: 'change' }],
personId: [{ required: true, message: '成员不能为空', trigger: 'change' }],
diseaseName: [{ required: true, message: '疾病名称不能为空', trigger: 'blur' }],
diseaseStatus: [{ required: true, message: '状态不能为空', trigger: 'change' }]
}
@@ -222,14 +216,14 @@ const handleOperate = (operate, row) => {
/** 查询成员列表 */
function getMemberList() {
listPerson({ pageNum: 1, pageSize: 1000 }).then(response => {
listPerson({ pageNum: 1, pageSize: 1000 }).then((response) => {
memberList.value = response.rows || []
})
}
/** 查询疾病列表 */
function getDiseaseList() {
listHealthDiseases({ pageNum: 1, pageSize: 1000 }).then(response => {
listHealthDiseases({ pageNum: 1, pageSize: 1000 }).then((response) => {
diseaseList.value = response.rows || []
})
}
@@ -237,7 +231,7 @@ function getDiseaseList() {
/** 查询慢性疾病档案列表 */
function getList() {
loading.value = true
listChronicDisease(queryParams.value).then(response => {
listChronicDisease(queryParams.value).then((response) => {
chronicDiseaseList.value = response.rows
total.value = response.total
loading.value = false
@@ -254,7 +248,7 @@ function cancel() {
function reset() {
form.value = {
id: null,
memberId: null,
personId: null,
diseaseId: null,
diseaseName: null,
diseaseCode: null,
@@ -303,7 +297,7 @@ const indexMethod = (index) => {
// 多选框选中数据
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id)
ids.value = selection.map((item) => item.id)
single.value = selection.length !== 1
multiple.value = !selection.length
}
@@ -326,7 +320,7 @@ function handleAdd() {
function handleUpdate(row) {
reset()
const _id = row.id || ids.value
getChronicDisease(_id).then(response => {
getChronicDisease(_id).then((response) => {
form.value = response.data
open.value = true
title.value = '修改慢性疾病档案'
@@ -336,19 +330,23 @@ function handleUpdate(row) {
/** 状态修改 */
function handleStatusChange(row) {
const text = row.isActive === 1 ? '启用' : '停用'
proxy.$modal.confirm('确认要"' + text + '"该慢性疾病档案吗?').then(() => {
return updateChronicDisease({ id: row.id, isActive: row.isActive })
}).then(() => {
proxy.$modal.msgSuccess(text + '成功')
}).catch(() => {
row.isActive = row.isActive === 0 ? 1 : 0
})
proxy.$modal
.confirm('确认要"' + text + '"该慢性疾病档案吗?')
.then(() => {
return updateChronicDisease({ id: row.id, isActive: row.isActive })
})
.then(() => {
proxy.$modal.msgSuccess(text + '成功')
})
.catch(() => {
row.isActive = row.isActive === 0 ? 1 : 0
})
}
/** 选择疾病时自动填充疾病名称 */
function handleDiseaseChange(diseaseId) {
if (diseaseId) {
const disease = diseaseList.value.find(item => item.id === diseaseId)
const disease = diseaseList.value.find((item) => item.id === diseaseId)
if (disease) {
form.value.diseaseName = disease.name
}
@@ -362,16 +360,16 @@ function handleMemberChange() {
/** 提交按钮 */
function submitForm() {
proxy.$refs.chronicDiseaseRef.validate(valid => {
proxy.$refs.chronicDiseaseRef.validate((valid) => {
if (valid) {
if (form.value.id != null) {
updateChronicDisease(form.value).then(response => {
updateChronicDisease(form.value).then((response) => {
proxy.$modal.msgSuccess('修改成功')
open.value = false
getList()
})
} else {
addChronicDisease(form.value).then(response => {
addChronicDisease(form.value).then((response) => {
proxy.$modal.msgSuccess('新增成功')
open.value = false
getList()
@@ -402,5 +400,4 @@ getDiseaseList()
getList()
</script>
<style scoped>
</style>
<style scoped></style>

View File

@@ -44,17 +44,30 @@
<el-table-column type="index" label="序号" :index="indexMethod" width="50"></el-table-column>
<el-table-column label="计划名称" align="center" prop="planName" width="150" />
<el-table-column label="人员" align="center" prop="personName" width="100" />
<el-table-column label="药品" align="center" width="200">
<template #default="scope"> {{ scope.row.shortName }}-{{ scope.row.brand }} </template>
<el-table-column label="药品" align="center" prop="medicineName" width="200" />
<el-table-column label="剂量" align="center" width="100">
<template #default="scope">
<span style="display: inline-flex; align-items: center; gap: 4px">
{{ scope.row.dosagePerTime }}
<dict-tag :options="medical_unit" :value="scope.row.dosageUnit" style="display: inline-flex" />
</span>
</template>
</el-table-column>
<el-table-column label="剂量/频率" align="center" width="120">
<template #default="scope"> {{ scope.row.dosage }}{{ scope.row.dosageUnit }} × {{ scope.row.frequency }}/ </template>
</el-table-column>
<el-table-column label="频率类型" align="center" prop="frequencyType" width="100">
<el-table-column label="频次类型" align="center" prop="frequencyType" width="100">
<template #default="scope">
<dict-tag :options="medication_frequency_type" :value="scope.row.frequencyType" />
</template>
</el-table-column>
<el-table-column label="服药时间" align="center" width="180">
<template #default="scope">
<div v-if="scope.row.timeSlots" class="time-slots-list">
<el-tag v-for="(time, idx) in parseTimeSlots(scope.row.timeSlots)" :key="idx" size="small" type="info" class="time-tag">
{{ time }}
</el-tag>
</div>
<span v-else>--</span>
</template>
</el-table-column>
<el-table-column label="开始日期" align="center" prop="startDate" width="110">
<template #default="scope">
{{ formatDate(scope.row.startDate) }}
@@ -67,13 +80,13 @@
</el-table-column>
<el-table-column label="今日进度" align="center" width="100">
<template #default="scope">
<span v-if="scope.row.status === '1'"> {{ scope.row.todayTakenCount || 0 }}/{{ scope.row.todayTotalCount || 0 }} </span>
<span v-if="scope.row.status === 1"> {{ scope.row.todayCompleted || 0 }}/{{ scope.row.todayTotal || 0 }} </span>
<span v-else>--</span>
</template>
</el-table-column>
<el-table-column label="提醒" align="center" prop="reminderEnabled" width="80">
<el-table-column label="提醒" align="center" prop="remindEnabled" width="80">
<template #default="scope">
<el-tag v-if="scope.row.reminderEnabled === '1'" type="success"></el-tag>
<el-tag v-if="scope.row.remindEnabled === 1" type="success"></el-tag>
<el-tag v-else type="info"></el-tag>
</template>
</el-table-column>
@@ -82,19 +95,19 @@
<dict-tag :options="medication_plan_status" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
<el-table-column label="操作" align="center" class-name="small-padding">
<template v-slot="scope">
<div class="ctrl-btn d-flex">
<el-tooltip class="item" effect="dark" content="查看" placement="top">
<el-button icon="View" v-hasPermi="['health:medicationPlan:query']" circle @click="handleView(scope.row)"></el-button>
</el-tooltip>
<el-tooltip v-if="scope.row.status === '1'" class="item" effect="dark" content="暂停" placement="top">
<el-tooltip v-if="scope.row.status === 1" class="item" effect="dark" content="暂停" placement="top">
<el-button icon="VideoPause" v-hasPermi="['health:medicationPlan:edit']" circle @click="handlePause(scope.row)"></el-button>
</el-tooltip>
<el-tooltip v-if="scope.row.status === '3'" class="item" effect="dark" content="恢复" placement="top">
<el-tooltip v-if="scope.row.status === 2 || scope.row.status === 3" class="item" effect="dark" content="恢复" placement="top">
<el-button icon="VideoPlay" v-hasPermi="['health:medicationPlan:edit']" circle @click="handleResume(scope.row)"></el-button>
</el-tooltip>
<el-tooltip v-if="scope.row.status !== '2'" class="item" effect="dark" content="结束" placement="top">
<el-tooltip v-if="scope.row.status !== 2" class="item" effect="dark" content="结束" placement="top">
<el-button icon="Finished" v-hasPermi="['health:medicationPlan:edit']" circle @click="handleEnd(scope.row)"></el-button>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="修改" placement="top">
@@ -121,20 +134,20 @@
<el-dialog :title="title" v-model="open" width="900px" append-to-body>
<el-form ref="planRef" :model="form" :inline="true" :rules="rules" label-width="120px">
<el-form-item label="计划名称" prop="planName">
<el-input v-model="form.planName" placeholder="请输入计划名称(可选)" style="width: 300px" />
<el-input v-model="form.planName" placeholder="请输入计划名称(可选)" />
</el-form-item>
<el-form-item label="人员" prop="personId">
<el-select v-model="form.personId" placeholder="请选择人员" filterable style="width: 200px" @change="handlePersonChange">
<el-select v-model="form.personId" placeholder="请选择人员" filterable @change="handlePersonChange">
<el-option v-for="item in personList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="慢性疾病" prop="chronicDiseaseId">
<el-select v-model="form.chronicDiseaseId" placeholder="请选择慢性疾病(可选)" filterable clearable style="width: 300px">
<el-select v-model="form.chronicDiseaseId" placeholder="请选择慢性疾病(可选)" filterable clearable>
<el-option v-for="item in chronicDiseaseList" :key="item.id" :label="item.diseaseName" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="药品" prop="medicineId">
<el-select v-model="form.medicineId" placeholder="请选择药品" filterable style="width: 300px" @change="handleMedicineChange">
<el-select v-model="form.medicineId" placeholder="请选择药品" filterable @change="handleMedicineChange">
<el-option v-for="item in medicineList" :key="item.id" :label="item.shortName + '-' + item.brand" :value="item.id" />
</el-select>
</el-form-item>
@@ -145,32 +158,51 @@
</el-select>
</el-form-item>
<el-form-item label="频次类型" prop="frequencyType">
<el-select v-model="form.frequencyType" placeholder="请选择频次类型" style="width: 150px">
<el-select v-model="form.frequencyType" placeholder="请选择频次类型">
<el-option label="每天" :value="1" />
<el-option label="每周" :value="2" />
<el-option label="隔天" :value="3" />
<el-option label="自定义" :value="4" />
</el-select>
</el-form-item>
<el-form-item label="服药时间点" prop="timeSlots">
<el-tag v-for="(time, index) in form.timePointList" :key="index" closable @close="removeTimePoint(index)" style="margin-right: 10px">
{{ time }}
</el-tag>
<el-time-picker v-model="newTimePoint" placeholder="添加时间" format="HH:mm" value-format="HH:mm" @change="addTimePoint" style="width: 120px" />
<el-form-item label="服药时间点" prop="timeSlots" style="width: 100%">
<div class="time-slots-wrapper">
<div v-for="(time, index) in form.timePointList" :key="index" class="time-slot-item">
<span class="time-text">{{ time }}</span>
<el-icon class="close-icon" @click="removeTimePoint(index)"><Close /></el-icon>
</div>
<el-time-picker
v-model="newTimePoint"
placeholder="添加时间"
format="HH:mm"
value-format="HH:mm"
@change="addTimePoint"
style="width: 110px"
size="small"
/>
</div>
</el-form-item>
<el-form-item label="开始日期" prop="startDate">
<el-date-picker v-model="form.startDate" type="date" placeholder="选择开始日期" value-format="YYYY-MM-DD" style="width: 180px" />
<el-date-picker v-model="form.startDate" type="date" placeholder="选择开始日期" value-format="YYYY-MM-DD" />
</el-form-item>
<el-form-item label="结束日期" prop="endDate">
<el-date-picker v-model="form.endDate" type="date" placeholder="选择结束日期(可选)" value-format="YYYY-MM-DD" style="width: 180px" />
<el-date-picker v-model="form.endDate" type="date" placeholder="选择结束日期(可选)" value-format="YYYY-MM-DD" />
</el-form-item>
<el-form-item label="启用提醒" prop="remindEnabled">
<el-switch v-model="form.remindEnabled" :active-value="1" :inactive-value="0" />
</el-form-item>
<el-form-item v-if="form.remindEnabled === 1" label="提前提醒" prop="remindAdvanceMin">
<el-input-number v-model="form.remindAdvanceMin" :min="0" :max="60" style="width: 150px" />
<el-input-number v-model="form.remindAdvanceMin" :min="0" :max="60" />
<span style="margin-left: 10px">分钟</span>
</el-form-item>
<el-form-item label="通知家属" prop="notifyFamily">
<el-switch v-model="form.notifyFamily" :active-value="1" :inactive-value="0" />
</el-form-item>
<el-form-item v-if="form.notifyFamily === 1" label="家属成员" prop="familyMemberIds">
<el-select v-model="form.familyMemberIdList" multiple placeholder="请选择家属成员" filterable style="width: 300px">
<el-option v-for="item in personList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="备注" style="width: 100%">
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" :rows="3" />
</el-form-item>
@@ -199,6 +231,7 @@ import {
import { listMedicineBasic } from '@/api/health/medicineBasic'
import { listPerson } from '@/api/health/person'
import { listChronicDiseaseByMember } from '@/api/health/chronicDisease'
import { Close } from '@element-plus/icons-vue'
const { proxy } = getCurrentInstance()
const { medication_frequency_type, medication_plan_status, medical_unit } = proxy.useDict('medication_frequency_type', 'medication_plan_status', 'medical_unit')
@@ -290,6 +323,7 @@ function reset() {
remindAdvanceMin: 15,
notifyFamily: 0,
familyMemberIds: null,
familyMemberIdList: [],
status: 1,
remark: null
}
@@ -337,13 +371,46 @@ function handleSelectionChange(selection) {
// 格式化日期
function formatDate(date) {
if (!date) return ''
return date.substring(0, 10)
// 处理数组格式 [2026, 3, 21]
if (Array.isArray(date)) {
return `${date[0]}-${String(date[1]).padStart(2, '0')}-${String(date[2]).padStart(2, '0')}`
}
// 处理字符串格式
if (typeof date === 'string') {
return date.substring(0, 10)
}
return ''
}
// 解析服药时间点 JSON
function parseTimeSlots(timeSlots) {
if (!timeSlots) return []
try {
return typeof timeSlots === 'string' ? JSON.parse(timeSlots) : timeSlots
} catch (e) {
return []
}
}
// 将数组日期转换为字符串日期
function convertArrayDateToString(dateArray) {
if (!dateArray) return null
if (Array.isArray(dateArray)) {
return `${dateArray[0]}-${String(dateArray[1]).padStart(2, '0')}-${String(dateArray[2]).padStart(2, '0')}`
}
if (typeof dateArray === 'string') {
return dateArray.substring(0, 10)
}
return null
}
// 查看
const handleView = (row) => {
getMedicationPlan(row.id).then((response) => {
form.value = response.data
// 转换日期格式
form.value.startDate = convertArrayDateToString(form.value.startDate)
form.value.endDate = convertArrayDateToString(form.value.endDate)
// 解析 timeSlots JSON
if (form.value.timeSlots) {
try {
@@ -354,6 +421,16 @@ const handleView = (row) => {
} else {
form.value.timePointList = []
}
// 解析 familyMemberIds JSON
if (form.value.familyMemberIds) {
try {
form.value.familyMemberIdList = typeof form.value.familyMemberIds === 'string' ? JSON.parse(form.value.familyMemberIds) : form.value.familyMemberIds
} catch (e) {
form.value.familyMemberIdList = []
}
} else {
form.value.familyMemberIdList = []
}
title.value = '查看用药计划'
open.value = true
// 加载该人员的慢性疾病列表
@@ -378,6 +455,9 @@ function handleUpdate(row) {
const _id = row.id || ids.value
getMedicationPlan(_id).then((response) => {
form.value = response.data
// 转换日期格式
form.value.startDate = convertArrayDateToString(form.value.startDate)
form.value.endDate = convertArrayDateToString(form.value.endDate)
// 解析 timeSlots JSON
if (form.value.timeSlots) {
try {
@@ -388,6 +468,16 @@ function handleUpdate(row) {
} else {
form.value.timePointList = []
}
// 解析 familyMemberIds JSON
if (form.value.familyMemberIds) {
try {
form.value.familyMemberIdList = typeof form.value.familyMemberIds === 'string' ? JSON.parse(form.value.familyMemberIds) : form.value.familyMemberIds
} catch (e) {
form.value.familyMemberIdList = []
}
} else {
form.value.familyMemberIdList = []
}
open.value = true
title.value = '修改用药计划'
// 加载该人员的慢性疾病列表
@@ -406,7 +496,7 @@ function handlePause(row) {
.then(() => {
return pauseMedicationPlan(row.id)
})
.then(() => {
.then((response) => {
getList()
proxy.$modal.msgSuccess('暂停成功')
})
@@ -439,22 +529,34 @@ function handleEnd(row) {
function submitForm() {
proxy.$refs.planRef.validate((valid) => {
if (valid) {
// 构建提交数据,排除后端自动生成的字段
const submitData = { ...form.value }
// 将时间点列表转为 JSON 字符串
form.value.timeSlots = JSON.stringify(form.value.timePointList)
// 根据药品ID获取药品名称和规格
const medicine = medicineList.value.find((m) => m.id === form.value.medicineId)
if (medicine) {
form.value.medicineName = medicine.shortName + '-' + medicine.brand
form.value.specification = medicine.specification || ''
submitData.timeSlots = JSON.stringify(form.value.timePointList)
// 将家属成员ID列表转为 JSON 字符串
if (form.value.familyMemberIdList && form.value.familyMemberIdList.length > 0) {
submitData.familyMemberIds = JSON.stringify(form.value.familyMemberIdList)
} else {
submitData.familyMemberIds = null
}
if (form.value.id != null) {
updateMedicationPlan(form.value).then((response) => {
// 根据药品ID获取药品名称和规格
const medicine = medicineList.value.find((m) => m.id === submitData.medicineId)
if (medicine) {
submitData.medicineName = medicine.shortName + '-' + medicine.brand
submitData.specification = medicine.specification || ''
}
// 移除后端自动管理的字段
delete submitData.createTime
delete submitData.updateTime
delete submitData.familyMemberIdList
if (submitData.id != null) {
updateMedicationPlan(submitData).then((response) => {
proxy.$modal.msgSuccess('修改成功')
open.value = false
getList()
})
} else {
addMedicationPlan(form.value).then((response) => {
addMedicationPlan(submitData).then((response) => {
proxy.$modal.msgSuccess('新增成功')
open.value = false
getList()
@@ -515,3 +617,63 @@ getPersonList()
getMedicineList()
getList()
</script>
<style scoped>
.time-slots-wrapper {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
padding: 10px 12px;
background: #fafbfc;
border: 1px solid #e4e7ed;
border-radius: 6px;
min-height: 44px;
}
.time-slot-item {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 4px 10px;
background: #fff;
border: 1px solid #dcdfe6;
border-radius: 4px;
color: #606266;
font-size: 13px;
transition: all 0.2s ease;
}
.time-slot-item:hover {
border-color: #409eff;
color: #409eff;
}
.time-text {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
font-weight: 500;
}
.close-icon {
cursor: pointer;
font-size: 12px;
color: #c0c4cc;
transition: all 0.2s;
margin-left: 2px;
}
.close-icon:hover {
color: #f56c6c;
}
.time-slots-list {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 4px;
}
.time-tag {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
</style>

View File

@@ -30,7 +30,7 @@
<!-- 概览卡片 -->
<div class="overview-cards" v-loading="loading">
<div class="stat-card">
<div class="stat-icon" style="background: #409EFF;">
<div class="stat-icon" style="background: #409eff">
<el-icon><Calendar /></el-icon>
</div>
<div class="stat-content">
@@ -39,7 +39,7 @@
</div>
</div>
<div class="stat-card">
<div class="stat-icon" style="background: #67C23A;">
<div class="stat-icon" style="background: #67c23a">
<el-icon><Check /></el-icon>
</div>
<div class="stat-content">
@@ -48,7 +48,7 @@
</div>
</div>
<div class="stat-card">
<div class="stat-icon" style="background: #F56C6C;">
<div class="stat-icon" style="background: #f56c6c">
<el-icon><Close /></el-icon>
</div>
<div class="stat-content">
@@ -57,7 +57,7 @@
</div>
</div>
<div class="stat-card">
<div class="stat-icon" style="background: #E6A23C;">
<div class="stat-icon" style="background: #e6a23c">
<el-icon><Timer /></el-icon>
</div>
<div class="stat-content">
@@ -66,7 +66,7 @@
</div>
</div>
<div class="stat-card">
<div class="stat-icon" style="background: #909399;">
<div class="stat-icon" style="background: #909399">
<el-icon><Clock /></el-icon>
</div>
<div class="stat-content">
@@ -98,7 +98,9 @@
<el-button-group>
<el-button @click="changeMonth(-1)" icon="ArrowLeft">上月</el-button>
<el-button>{{ currentMonth }}</el-button>
<el-button @click="changeMonth(1)">下月<el-icon class="el-icon--right"><ArrowRight /></el-icon></el-button>
<el-button @click="changeMonth(1)"
>下月<el-icon class="el-icon--right"><ArrowRight /></el-icon
></el-button>
</el-button-group>
</div>
</div>
@@ -107,12 +109,7 @@
<div v-for="day in weekdays" :key="day" class="weekday">{{ day }}</div>
</div>
<div class="calendar-days">
<div
v-for="(day, index) in calendarDays"
:key="index"
class="calendar-day"
:class="{ 'other-month': day.otherMonth, 'today': day.isToday }"
>
<div v-for="(day, index) in calendarDays" :key="index" class="calendar-day" :class="{ 'other-month': day.otherMonth, today: day.isToday }">
<div class="day-number">{{ day.day }}</div>
<div class="day-stats" v-if="day.data && day.data.totalTasks > 0">
<span class="stat-dot completed" :title="`已服药: ${day.data.completedTasks}`"></span>
@@ -181,7 +178,7 @@ const calendarDays = computed(() => {
const todayStr = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, '0')}-${String(today.getDate()).padStart(2, '0')}`
const dataMap = {}
calendarData.value.forEach(d => {
calendarData.value.forEach((d) => {
dataMap[d.date] = d
})
@@ -276,7 +273,7 @@ const renderTrendChart = (data) => {
},
xAxis: {
type: 'category',
data: data.map(d => d.date?.substring(5) || '')
data: data.map((d) => d.date?.substring(5) || '')
},
yAxis: {
type: 'value',
@@ -286,14 +283,14 @@ const renderTrendChart = (data) => {
{
name: '服药率',
type: 'line',
data: data.map(d => d.adherenceRate || 0),
data: data.map((d) => d.adherenceRate || 0),
smooth: true,
itemStyle: { color: '#409EFF' }
},
{
name: '准时率',
type: 'line',
data: data.map(d => d.ontimeRate || 0),
data: data.map((d) => d.ontimeRate || 0),
smooth: true,
itemStyle: { color: '#67C23A' }
}
@@ -391,6 +388,11 @@ onMounted(() => {
</script>
<style scoped lang="scss">
.app-container {
height: calc(100vh - 84px);
overflow-y: auto;
}
.overview-cards {
display: flex;
gap: 16px;
@@ -498,19 +500,21 @@ onMounted(() => {
.calendar-day {
min-height: 80px;
border: 1px solid #EBEEF5;
border: 1px solid #ebeef5;
border-radius: 4px;
padding: 4px;
&.other-month {
background: #F5F7FA;
.day-number { color: #C0C4CC; }
background: #f5f7fa;
.day-number {
color: #c0c4cc;
}
}
&.today {
border-color: #409EFF;
border-color: #409eff;
.day-number {
color: #409EFF;
color: #409eff;
font-weight: bold;
}
}
@@ -531,8 +535,12 @@ onMounted(() => {
height: 8px;
border-radius: 50%;
&.completed { background: #67C23A; }
&.missed { background: #F56C6C; }
&.completed {
background: #67c23a;
}
&.missed {
background: #f56c6c;
}
}
.stat-rate {
@@ -544,4 +552,4 @@ onMounted(() => {
}
}
}
</style>
</style>

View File

@@ -47,7 +47,7 @@
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="index" label="序号" :index="indexMethod" width="50"></el-table-column>
<el-table-column label="计划名称" align="center" prop="planName" width="150" />
<el-table-column label="人员" align="center" prop="memberName" width="80" />
<el-table-column label="人员" align="center" prop="personName" width="80" />
<el-table-column label="药品" align="center" prop="medicineName" width="180" />
<el-table-column label="计划日期" align="center" prop="plannedDate" width="110">
<template #default="scope">
@@ -75,7 +75,7 @@
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="notes" show-overflow-tooltip />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<div class="ctrl-btn d-flex">
<el-tooltip v-if="scope.row.status === 0" class="item" effect="dark" content="确认服药" placement="top">
@@ -105,6 +105,19 @@
</div>
</div>
<!-- 确认服药对话框 -->
<el-dialog title="确认服药" v-model="confirmDialogVisible" width="400px">
<el-form>
<el-form-item label="实际服药时间">
<el-time-picker v-model="actualTime" placeholder="选择实际服药时间" format="HH:mm" value-format="HH:mm" style="width: 100%" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="confirmDialogVisible = false">取消</el-button>
<el-button type="primary" @click="submitConfirm">确定</el-button>
</template>
</el-dialog>
<!-- 跳过对话框 -->
<el-dialog title="跳过服药" v-model="skipDialogVisible" width="400px">
<el-form>
@@ -147,6 +160,8 @@ const queryParams = reactive({
plannedDateEnd: null
})
const confirmDialogVisible = ref(false)
const actualTime = ref('')
const skipDialogVisible = ref(false)
const skipNotes = ref('')
const currentRow = ref(null)
@@ -193,14 +208,27 @@ const resetQuery = () => {
}
const handleSelectionChange = (selection) => {
ids.value = selection.map(item => item.id)
ids.value = selection.map((item) => item.id)
multiple.value = !selection.length
}
const handleConfirm = async (row) => {
await proxy.$modal.confirm('确认已服药?')
await confirmMedication(row.id, 1)
const handleConfirm = (row) => {
currentRow.value = row
// 默认当前时间
const now = new Date()
actualTime.value = `${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}`
confirmDialogVisible.value = true
}
const submitConfirm = async () => {
if (!actualTime.value) {
proxy.$modal.msgError('请选择实际服药时间')
return
}
// confirmType=1 表示确认服药confirmTime 传递时间字符串
await confirmMedication(currentRow.value.id, 1, actualTime.value)
proxy.$modal.msgSuccess('操作成功')
confirmDialogVisible.value = false
getList()
}
@@ -231,12 +259,28 @@ const indexMethod = (index) => {
const formatDate = (date) => {
if (!date) return '--'
return date.substring(0, 10)
// 处理数组格式 [2026, 3, 21]
if (Array.isArray(date)) {
return `${date[0]}-${String(date[1]).padStart(2, '0')}-${String(date[2]).padStart(2, '0')}`
}
// 处理字符串格式
if (typeof date === 'string') {
return date.substring(0, 10)
}
return '--'
}
const formatTime = (time) => {
if (!time) return '--'
return time.substring(0, 5)
// 处理数组格式 [8, 0] 或 [14, 30]
if (Array.isArray(time)) {
return `${String(time[0]).padStart(2, '0')}:${String(time[1]).padStart(2, '0')}`
}
// 处理字符串格式
if (typeof time === 'string') {
return time.substring(0, 5)
}
return '--'
}
const formatDateTime = (datetime) => {
@@ -251,5 +295,4 @@ onMounted(() => {
})
</script>
<style scoped lang="scss">
</style>
<style scoped lang="scss"></style>