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