@@ -10,9 +10,9 @@ export function listChronicDisease(query) {
|
||||
}
|
||||
|
||||
// 根据成员ID查询慢性疾病档案列表
|
||||
export function listChronicDiseaseByMember(memberId) {
|
||||
export function listChronicDiseaseByMember(personId) {
|
||||
return request({
|
||||
url: '/health/chronicDisease/listByMember/' + memberId,
|
||||
url: '/health/chronicDisease/listByPerson/' + personId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -45,14 +45,10 @@
|
||||
<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>
|
||||
<template #default="scope"> {{ scope.row.shortName }}-{{ scope.row.brand }} </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>
|
||||
<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">
|
||||
<template #default="scope">
|
||||
@@ -71,9 +67,7 @@
|
||||
</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.todayTakenCount || 0 }}/{{ scope.row.todayTotalCount || 0 }} </span>
|
||||
<span v-else>--</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -130,30 +124,35 @@
|
||||
<el-input v-model="form.planName" placeholder="请输入计划名称(可选)" style="width: 300px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="人员" prop="personId">
|
||||
<el-select v-model="form.personId" placeholder="请选择人员" filterable style="width: 200px">
|
||||
<el-select v-model="form.personId" placeholder="请选择人员" filterable style="width: 200px" @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-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-option v-for="item in medicineList" :key="item.id" :label="item.shortName + '-' + item.brand" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="每次剂量" prop="dosage">
|
||||
<el-input-number v-model="form.dosage" :min="0" :precision="2" style="width: 150px" />
|
||||
<el-form-item label="每次剂量" prop="dosagePerTime">
|
||||
<el-input-number v-model="form.dosagePerTime" :min="0" :precision="2" style="width: 150px" />
|
||||
<el-select v-model="form.dosageUnit" placeholder="单位" style="width: 100px; margin-left: 10px">
|
||||
<el-option v-for="dict in medical_unit" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="每日次数" prop="frequency">
|
||||
<el-input-number v-model="form.frequency" :min="1" :max="10" style="width: 150px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="频率类型" prop="frequencyType">
|
||||
<el-select v-model="form.frequencyType" placeholder="请选择频率类型" style="width: 150px">
|
||||
<el-option v-for="dict in medication_frequency_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
<el-form-item label="频次类型" prop="frequencyType">
|
||||
<el-select v-model="form.frequencyType" placeholder="请选择频次类型" style="width: 150px">
|
||||
<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="timePoints">
|
||||
<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>
|
||||
@@ -165,11 +164,11 @@
|
||||
<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-form-item>
|
||||
<el-form-item label="启用提醒" prop="reminderEnabled">
|
||||
<el-switch v-model="form.reminderEnabled" active-value="1" inactive-value="0" />
|
||||
<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.reminderEnabled === '1'" label="提前提醒" prop="reminderMinutes">
|
||||
<el-input-number v-model="form.reminderMinutes" :min="0" :max="60" style="width: 150px" />
|
||||
<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" />
|
||||
<span style="margin-left: 10px">分钟</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" style="width: 100%">
|
||||
@@ -187,20 +186,27 @@
|
||||
</template>
|
||||
|
||||
<script setup name="MedicationPlan">
|
||||
import { listMedicationPlan, getMedicationPlan, delMedicationPlan, addMedicationPlan, updateMedicationPlan, pauseMedicationPlan, resumeMedicationPlan, endMedicationPlan } from '@/api/health/medicationPlan'
|
||||
import {
|
||||
listMedicationPlan,
|
||||
getMedicationPlan,
|
||||
delMedicationPlan,
|
||||
addMedicationPlan,
|
||||
updateMedicationPlan,
|
||||
pauseMedicationPlan,
|
||||
resumeMedicationPlan,
|
||||
endMedicationPlan
|
||||
} from '@/api/health/medicationPlan'
|
||||
import { listMedicineBasic } from '@/api/health/medicineBasic'
|
||||
import { listPerson } from '@/api/health/person'
|
||||
import { listChronicDiseaseByMember } from '@/api/health/chronicDisease'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { medication_frequency_type, medication_plan_status, medical_unit } = proxy.useDict(
|
||||
'medication_frequency_type',
|
||||
'medication_plan_status',
|
||||
'medical_unit'
|
||||
)
|
||||
const { medication_frequency_type, medication_plan_status, medical_unit } = proxy.useDict('medication_frequency_type', 'medication_plan_status', 'medical_unit')
|
||||
|
||||
const planList = ref([])
|
||||
const personList = ref([])
|
||||
const medicineList = ref([])
|
||||
const chronicDiseaseList = ref([])
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
@@ -225,8 +231,7 @@ const data = reactive({
|
||||
rules: {
|
||||
personId: [{ required: true, message: '请选择人员', trigger: 'change' }],
|
||||
medicineId: [{ required: true, message: '请选择药品', trigger: 'change' }],
|
||||
dosage: [{ required: true, message: '请输入剂量', trigger: 'blur' }],
|
||||
frequency: [{ required: true, message: '请输入每日次数', trigger: 'blur' }],
|
||||
dosagePerTime: [{ required: true, message: '请输入剂量', trigger: 'blur' }],
|
||||
startDate: [{ required: true, message: '请选择开始日期', trigger: 'change' }]
|
||||
}
|
||||
})
|
||||
@@ -268,23 +273,27 @@ function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
personId: null,
|
||||
chronicDiseaseId: null,
|
||||
medicineId: null,
|
||||
stockInId: null,
|
||||
planName: null,
|
||||
dosage: 1,
|
||||
medicineName: null,
|
||||
specification: null,
|
||||
dosagePerTime: 1,
|
||||
dosageUnit: '片',
|
||||
frequency: 3,
|
||||
frequencyType: '1',
|
||||
timePoints: null,
|
||||
frequencyType: 1,
|
||||
frequencyConfig: null,
|
||||
timeSlots: null,
|
||||
timePointList: ['08:00', '12:00', '18:00'],
|
||||
weekDays: null,
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
reminderEnabled: '0',
|
||||
reminderMinutes: 15,
|
||||
status: '1',
|
||||
remindEnabled: 0,
|
||||
remindAdvanceMin: 15,
|
||||
notifyFamily: 0,
|
||||
familyMemberIds: null,
|
||||
status: 1,
|
||||
remark: null
|
||||
}
|
||||
chronicDiseaseList.value = []
|
||||
proxy.resetForm('planRef')
|
||||
}
|
||||
|
||||
@@ -335,9 +344,24 @@ function formatDate(date) {
|
||||
const handleView = (row) => {
|
||||
getMedicationPlan(row.id).then((response) => {
|
||||
form.value = response.data
|
||||
form.value.timePointList = form.value.timePoints ? JSON.parse(form.value.timePoints) : []
|
||||
// 解析 timeSlots JSON
|
||||
if (form.value.timeSlots) {
|
||||
try {
|
||||
form.value.timePointList = typeof form.value.timeSlots === 'string' ? JSON.parse(form.value.timeSlots) : form.value.timeSlots
|
||||
} catch (e) {
|
||||
form.value.timePointList = []
|
||||
}
|
||||
} else {
|
||||
form.value.timePointList = []
|
||||
}
|
||||
title.value = '查看用药计划'
|
||||
open.value = true
|
||||
// 加载该人员的慢性疾病列表
|
||||
if (form.value.personId) {
|
||||
listChronicDiseaseByMember(form.value.personId).then((res) => {
|
||||
chronicDiseaseList.value = res.data || []
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -354,20 +378,39 @@ function handleUpdate(row) {
|
||||
const _id = row.id || ids.value
|
||||
getMedicationPlan(_id).then((response) => {
|
||||
form.value = response.data
|
||||
form.value.timePointList = form.value.timePoints ? JSON.parse(form.value.timePoints) : []
|
||||
// 解析 timeSlots JSON
|
||||
if (form.value.timeSlots) {
|
||||
try {
|
||||
form.value.timePointList = typeof form.value.timeSlots === 'string' ? JSON.parse(form.value.timeSlots) : form.value.timeSlots
|
||||
} catch (e) {
|
||||
form.value.timePointList = []
|
||||
}
|
||||
} else {
|
||||
form.value.timePointList = []
|
||||
}
|
||||
open.value = true
|
||||
title.value = '修改用药计划'
|
||||
// 加载该人员的慢性疾病列表
|
||||
if (form.value.personId) {
|
||||
listChronicDiseaseByMember(form.value.personId).then((res) => {
|
||||
chronicDiseaseList.value = res.data || []
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 暂停按钮操作 */
|
||||
function handlePause(row) {
|
||||
proxy.$modal.confirm('确认暂停该用药计划?').then(() => {
|
||||
return pauseMedicationPlan(row.id)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess('暂停成功')
|
||||
}).catch(() => {})
|
||||
proxy.$modal
|
||||
.confirm('确认暂停该用药计划?')
|
||||
.then(() => {
|
||||
return pauseMedicationPlan(row.id)
|
||||
})
|
||||
.then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess('暂停成功')
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
/** 恢复按钮操作 */
|
||||
@@ -380,19 +423,30 @@ function handleResume(row) {
|
||||
|
||||
/** 结束按钮操作 */
|
||||
function handleEnd(row) {
|
||||
proxy.$modal.confirm('确认结束该用药计划?结束后将不再生成用药记录。').then(() => {
|
||||
return endMedicationPlan(row.id)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess('已结束')
|
||||
}).catch(() => {})
|
||||
proxy.$modal
|
||||
.confirm('确认结束该用药计划?结束后将不再生成用药记录。')
|
||||
.then(() => {
|
||||
return endMedicationPlan(row.id)
|
||||
})
|
||||
.then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess('已结束')
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs.planRef.validate((valid) => {
|
||||
if (valid) {
|
||||
form.value.timePoints = JSON.stringify(form.value.timePointList)
|
||||
// 将时间点列表转为 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 || ''
|
||||
}
|
||||
if (form.value.id != null) {
|
||||
updateMedicationPlan(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess('修改成功')
|
||||
@@ -413,12 +467,16 @@ function submitForm() {
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _ids = row.id || ids.value
|
||||
proxy.$modal.confirm('是否确认删除选中的数据项?').then(function () {
|
||||
return delMedicationPlan(_ids)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
}).catch(() => {})
|
||||
proxy.$modal
|
||||
.confirm('是否确认删除选中的数据项?')
|
||||
.then(function () {
|
||||
return delMedicationPlan(_ids)
|
||||
})
|
||||
.then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
/** 添加服药时间点 */
|
||||
@@ -436,12 +494,23 @@ function removeTimePoint(index) {
|
||||
|
||||
/** 药品选择变化 */
|
||||
function handleMedicineChange(medicineId) {
|
||||
const medicine = medicineList.value.find(m => m.id === medicineId)
|
||||
const medicine = medicineList.value.find((m) => m.id === medicineId)
|
||||
if (medicine) {
|
||||
form.value.dosageUnit = medicine.unit || '片'
|
||||
}
|
||||
}
|
||||
|
||||
/** 人员选择变化 */
|
||||
function handlePersonChange(personId) {
|
||||
form.value.chronicDiseaseId = null
|
||||
chronicDiseaseList.value = []
|
||||
if (personId) {
|
||||
listChronicDiseaseByMember(personId).then((response) => {
|
||||
chronicDiseaseList.value = response.data || []
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
getPersonList()
|
||||
getMedicineList()
|
||||
getList()
|
||||
|
||||
Reference in New Issue
Block a user