fix: 去掉用药计划。
This commit is contained in:
@@ -1,387 +0,0 @@
|
||||
<template>
|
||||
<view class="container" style="paddingBottom:1rpx;">
|
||||
<view class="section">
|
||||
<view class="section-title">{{ title }}</view>
|
||||
<view class="form-view">
|
||||
<u--form labelPosition="left" :model="form" :rules="rules" ref="uForm" label-width="160rpx"
|
||||
:labelStyle="{ color: '#333333', fontSize: '30rpx', marginRight: '24rpx' }">
|
||||
<u-form-item label="成员" prop="memberName" required @click="handleMember">
|
||||
<view class="input-with-arrow">
|
||||
<u--input v-model="form.memberName" disabled disabledColor="#ffffff" placeholder="请选择成员"
|
||||
inputAlign="left" :customStyle="getInputStyle('memberName')"></u--input>
|
||||
<text class="arrow-icon">▼</text>
|
||||
</view>
|
||||
</u-form-item>
|
||||
<u-form-item label="疾病名称" prop="diseaseName" required>
|
||||
<u--input v-model="form.diseaseName" placeholder="请输入疾病名称"
|
||||
inputAlign="left" :customStyle="getInputStyle('diseaseName')"></u--input>
|
||||
</u-form-item>
|
||||
<u-form-item label="疾病编码" prop="diseaseCode">
|
||||
<u--input v-model="form.diseaseCode" placeholder="ICD-10编码(可选)"
|
||||
inputAlign="left" :customStyle="getInputStyle('diseaseCode')"></u--input>
|
||||
</u-form-item>
|
||||
<u-form-item label="确诊日期" prop="diagnosisDate" @click="selectDate">
|
||||
<view class="input-with-arrow">
|
||||
<u--input v-model="form.diagnosisDate" disabled disabledColor="#ffffff" placeholder="请选择确诊日期"
|
||||
inputAlign="left" :customStyle="getInputStyle('diagnosisDate')"></u--input>
|
||||
<text class="arrow-icon">▼</text>
|
||||
</view>
|
||||
</u-form-item>
|
||||
<u-form-item label="疾病状态" prop="diseaseStatusName" required @click="handleStatus">
|
||||
<view class="input-with-arrow">
|
||||
<u--input v-model="form.diseaseStatusName" disabled disabledColor="#ffffff" placeholder="请选择疾病状态"
|
||||
inputAlign="left" :customStyle="getInputStyle('diseaseStatusName')"></u--input>
|
||||
<text class="arrow-icon">▼</text>
|
||||
</view>
|
||||
</u-form-item>
|
||||
<u-form-item label="主治医生" prop="mainDoctor">
|
||||
<u--input v-model="form.mainDoctor" placeholder="请输入主治医生"
|
||||
inputAlign="left" :customStyle="getInputStyle('mainDoctor')"></u--input>
|
||||
</u-form-item>
|
||||
<u-form-item label="就诊医院" prop="hospital">
|
||||
<u--input v-model="form.hospital" placeholder="请输入就诊医院"
|
||||
inputAlign="left" :customStyle="getInputStyle('hospital')"></u--input>
|
||||
</u-form-item>
|
||||
<u-form-item label="科室" prop="department">
|
||||
<u--input v-model="form.department" placeholder="请输入科室"
|
||||
inputAlign="left" :customStyle="getInputStyle('department')"></u--input>
|
||||
</u-form-item>
|
||||
<u-form-item label="是否启用" prop="isActive">
|
||||
<u-switch v-model="isActiveSwitch" activeColor="#667eea" @change="handleActiveChange"></u-switch>
|
||||
</u-form-item>
|
||||
<u-form-item label="备注说明" prop="notes" labelPosition="top">
|
||||
<u--textarea v-model="form.notes" height="60rpx" placeholder="请输入备注说明" inputAlign="left"
|
||||
style="border: 2rpx solid #dcdfe6 !important; height: 160rpx;"
|
||||
:customStyle="getTextareaStyle('notes')"></u--textarea>
|
||||
</u-form-item>
|
||||
<u-form-item label="备注" prop="remark" labelPosition="top">
|
||||
<u--textarea v-model="form.remark" height="40rpx" placeholder="请输入备注" inputAlign="left"
|
||||
style="border: 2rpx solid #dcdfe6 !important; height: 160rpx;"
|
||||
:customStyle="getTextareaStyle('remark')"></u--textarea>
|
||||
</u-form-item>
|
||||
</u--form>
|
||||
<view class="form-btn">
|
||||
<u-button type="primary" text="提交" @click="submit"></u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-toast ref="uToast"></u-toast>
|
||||
<u-picker itemHeight="88" :show="showMember" :columns="memberList" keyName="name"
|
||||
@cancel="handleMemberCancel" @confirm="handleMemberConfirm"></u-picker>
|
||||
<u-picker itemHeight="88" :show="showStatus" :columns="statusList" keyName="label"
|
||||
@cancel="handleStatusCancel" @confirm="handleStatusConfirm"></u-picker>
|
||||
<u-datetime-picker
|
||||
:show="datePickShow"
|
||||
mode="date"
|
||||
ref="diagnosisDateRef"
|
||||
@cancel="datePickShow=false"
|
||||
@confirm="datePickConfirm"
|
||||
itemHeight="88"
|
||||
:maxDate="maxDate"
|
||||
></u-datetime-picker>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getChronicDisease, addChronicDisease, updateChronicDisease } from '@/api/health/chronicDisease'
|
||||
import { listPerson } from '@/api/health/person'
|
||||
import { onLoad, onReady } from "@dcloudio/uni-app"
|
||||
import dayjs from 'dayjs'
|
||||
import { reactive, toRefs, ref, computed, getCurrentInstance } from "vue"
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const datePickShow = ref(false)
|
||||
const showMember = ref(false)
|
||||
const showStatus = ref(false)
|
||||
const title = ref("慢性疾病档案")
|
||||
const memberList = ref([])
|
||||
const maxDate = ref(Date.now())
|
||||
|
||||
const statusList = ref([
|
||||
[
|
||||
{ value: 1, label: '稳定' },
|
||||
{ value: 2, label: '需关注' },
|
||||
{ value: 3, label: '急性期' }
|
||||
]
|
||||
])
|
||||
|
||||
const data = reactive({
|
||||
form: {
|
||||
id: null,
|
||||
memberId: null,
|
||||
memberName: null,
|
||||
diseaseName: null,
|
||||
diseaseCode: null,
|
||||
diagnosisDate: null,
|
||||
diseaseStatus: 1,
|
||||
diseaseStatusName: '稳定',
|
||||
mainDoctor: null,
|
||||
hospital: null,
|
||||
department: null,
|
||||
isActive: 1,
|
||||
notes: null,
|
||||
remark: null
|
||||
},
|
||||
queryPersonParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 1000
|
||||
},
|
||||
rules: {
|
||||
memberName: [{ required: true, message: '成员不能为空', trigger: ['change', 'blur'] }],
|
||||
diseaseName: [{ required: true, message: '疾病名称不能为空', trigger: ['change', 'blur'] }],
|
||||
diseaseStatusName: [{ required: true, message: '疾病状态不能为空', trigger: ['change', 'blur'] }]
|
||||
}
|
||||
})
|
||||
|
||||
const { form, queryPersonParams, rules } = toRefs(data)
|
||||
|
||||
// 错误字段
|
||||
const errorFields = ref([])
|
||||
|
||||
// 输入框基础样式
|
||||
const inputBaseStyle = {
|
||||
background: '#ffffff',
|
||||
border: '2rpx solid #dcdfe6',
|
||||
borderRadius: '8rpx',
|
||||
padding: '0 24rpx',
|
||||
height: '68rpx',
|
||||
width: '100%',
|
||||
boxSizing: 'border-box'
|
||||
}
|
||||
|
||||
// 输入框错误样式
|
||||
const inputErrorStyle = {
|
||||
background: '#fef0f0',
|
||||
border: '2rpx solid #f56c6c',
|
||||
borderRadius: '8rpx',
|
||||
padding: '0 24rpx',
|
||||
height: '68rpx',
|
||||
width: '100%',
|
||||
boxSizing: 'border-box'
|
||||
}
|
||||
|
||||
// 根据字段名获取输入框样式
|
||||
const getInputStyle = (field) => {
|
||||
return errorFields.value.includes(field) ? inputErrorStyle : inputBaseStyle
|
||||
}
|
||||
|
||||
// 文本域基础样式
|
||||
const textareaBaseStyle = {
|
||||
background: '#ffffff',
|
||||
border: '2rpx solid #dcdfe6',
|
||||
}
|
||||
|
||||
// 文本域错误样式
|
||||
const textareaErrorStyle = {
|
||||
background: '#fef0f0',
|
||||
border: '2rpx solid #f56c6c'
|
||||
}
|
||||
|
||||
// 根据字段名获取文本域样式
|
||||
const getTextareaStyle = (field) => {
|
||||
return errorFields.value.includes(field) ? textareaErrorStyle : textareaBaseStyle
|
||||
}
|
||||
|
||||
// 是否启用开关
|
||||
const isActiveSwitch = computed({
|
||||
get: () => form.value.isActive === 1,
|
||||
set: (val) => { form.value.isActive = val ? 1 : 0 }
|
||||
})
|
||||
|
||||
onLoad((option) => {
|
||||
form.value.id = option.id
|
||||
if (form.value.id != null) {
|
||||
title.value = "慢性疾病档案-修改"
|
||||
} else {
|
||||
title.value = "慢性疾病档案-新增"
|
||||
}
|
||||
getData()
|
||||
})
|
||||
|
||||
function getData() {
|
||||
listPerson(queryPersonParams.value).then((response) => {
|
||||
memberList.value = [response.rows]
|
||||
if (form.value.id != null) {
|
||||
getChronicDisease(form.value.id).then(res => {
|
||||
form.value = res.data
|
||||
// 设置状态名称
|
||||
const statusItem = statusList.value[0].find(s => s.value === form.value.diseaseStatus)
|
||||
if (statusItem) {
|
||||
form.value.diseaseStatusName = statusItem.label
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// 默认选择第一个成员
|
||||
if (response.rows.length > 0) {
|
||||
form.value.memberName = response.rows[0].name
|
||||
form.value.memberId = response.rows[0].id
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function handleMember() {
|
||||
if (memberList.value[0].length === 0) {
|
||||
proxy.$refs['uToast'].show({
|
||||
message: '成员为空', type: 'warning'
|
||||
})
|
||||
} else {
|
||||
showMember.value = true
|
||||
}
|
||||
}
|
||||
|
||||
function handleMemberConfirm(e) {
|
||||
form.value.memberName = e.value[0].name
|
||||
form.value.memberId = e.value[0].id
|
||||
showMember.value = false
|
||||
}
|
||||
|
||||
function handleMemberCancel() {
|
||||
showMember.value = false
|
||||
}
|
||||
|
||||
function handleStatus() {
|
||||
showStatus.value = true
|
||||
}
|
||||
|
||||
function handleStatusConfirm(e) {
|
||||
form.value.diseaseStatusName = e.value[0].label
|
||||
form.value.diseaseStatus = e.value[0].value
|
||||
showStatus.value = false
|
||||
}
|
||||
|
||||
function handleStatusCancel() {
|
||||
showStatus.value = false
|
||||
}
|
||||
|
||||
function selectDate() {
|
||||
datePickShow.value = true
|
||||
proxy.$refs['diagnosisDateRef'].innerValue = new Date().getTime()
|
||||
}
|
||||
|
||||
function datePickConfirm(e) {
|
||||
form.value.diagnosisDate = dayjs(e.value).format("YYYY-MM-DD")
|
||||
datePickShow.value = false
|
||||
}
|
||||
|
||||
function handleActiveChange(val) {
|
||||
form.value.isActive = val ? 1 : 0
|
||||
}
|
||||
|
||||
function submit() {
|
||||
proxy.$refs['uForm'].validate().then(() => {
|
||||
if (form.value.id != null) {
|
||||
updateChronicDisease(form.value).then(res => {
|
||||
proxy.$refs['uToast'].show({
|
||||
message: '修改成功', complete() {
|
||||
uni.navigateTo({ url: `/pages/health/chronicDisease/list` })
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
addChronicDisease(form.value).then(res => {
|
||||
proxy.$refs['uToast'].show({
|
||||
message: '新增成功', complete() {
|
||||
uni.navigateTo({ url: `/pages/health/chronicDisease/list` })
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}).catch(errors => {
|
||||
if (errors && errors.length > 0) {
|
||||
errorFields.value = errors.map(err => err.field)
|
||||
}
|
||||
proxy.$modal.msgError('请填写完整信息')
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
page {
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.section {
|
||||
margin: 24rpx;
|
||||
padding: 0;
|
||||
background-color: #fff;
|
||||
border-radius: 16rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
overflow: hidden;
|
||||
|
||||
.section-title {
|
||||
padding: 16rpx 24rpx;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: #ffffff;
|
||||
line-height: 1.2;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
width: 6rpx;
|
||||
height: 28rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 3rpx;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.form-view {
|
||||
padding: 24rpx;
|
||||
|
||||
.form-btn {
|
||||
padding-top: 16rpx;
|
||||
}
|
||||
|
||||
.input-with-arrow {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
|
||||
.arrow-icon {
|
||||
position: absolute;
|
||||
right: 20rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
color: #c0c4cc;
|
||||
font-size: 20rpx;
|
||||
pointer-events: none;
|
||||
z-index: 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
.form-btn .u-button {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
|
||||
border: none !important;
|
||||
border-radius: 24rpx !important;
|
||||
height: 80rpx !important;
|
||||
box-shadow: 0 4rpx 16rpx rgba(102, 126, 234, 0.4) !important;
|
||||
}
|
||||
|
||||
.form-btn .u-button__text {
|
||||
font-size: 30rpx !important;
|
||||
font-weight: 500 !important;
|
||||
letter-spacing: 2rpx !important;
|
||||
}
|
||||
|
||||
.u-form-item--error .u--input,
|
||||
.u-form-item--error .u-input,
|
||||
.u-form-item--error .u-input__content,
|
||||
.u-form-item--error .u-input__content__field-wrapper {
|
||||
border: 2rpx solid #f56c6c !important;
|
||||
background: #fef0f0 !important;
|
||||
}
|
||||
|
||||
.u-form-item--error .u--textarea,
|
||||
.u-form-item--error .u-textarea {
|
||||
border: 2rpx solid #f56c6c !important;
|
||||
background: #fef0f0 !important;
|
||||
}
|
||||
</style>
|
||||
@@ -1,684 +0,0 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<u-sticky offsetTop="0rpx" customNavHeight="0rpx">
|
||||
<view class="search-container">
|
||||
<view class="search-row">
|
||||
<view class="search-input-wrapper">
|
||||
<u--input
|
||||
v-model="queryParams.diseaseName"
|
||||
border="surround"
|
||||
placeholder="请输入疾病名称"
|
||||
placeholderStyle="color: #909399"
|
||||
color="#333333"
|
||||
customStyle="background: rgba(102, 126, 234, 0.08); border: 2rpx solid rgba(102, 126, 234, 0.3); border-radius: 24rpx; height: 66rpx"
|
||||
class="search-input"
|
||||
@blur="searchBlur">
|
||||
</u--input>
|
||||
</view>
|
||||
<view class="add-btn" @click="handleAdd()">
|
||||
<uni-icons type="plusempty" size="18" color="#667eea"></uni-icons>
|
||||
<text>新增</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="search-row">
|
||||
<view class="search-input-wrapper">
|
||||
<u--input
|
||||
v-model="queryParams.memberName"
|
||||
border="surround"
|
||||
readonly
|
||||
placeholder="请选择成员"
|
||||
placeholderStyle="color: #909399"
|
||||
color="#333333"
|
||||
customStyle="background: rgba(102, 126, 234, 0.08); border: 2rpx solid rgba(102, 126, 234, 0.3); border-radius: 24rpx; height: 66rpx"
|
||||
class="search-input">
|
||||
</u--input>
|
||||
<uni-icons
|
||||
type="search"
|
||||
size="18"
|
||||
color="#667eea"
|
||||
class="search-icon"
|
||||
@click="handleMember">
|
||||
</uni-icons>
|
||||
</view>
|
||||
<view class="filter-btn" @click="filterPanel = !filterPanel">
|
||||
<uni-icons type="list" size="18" color="#667eea"></uni-icons>
|
||||
<text>筛选</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<u-transition :show="filterPanel" mode="fade">
|
||||
<view class="filter-panel" :style="{ height: `${windowHeight - 42}px` }">
|
||||
<view class="filter-panel-content">
|
||||
<view class="filter-title">疾病状态</view>
|
||||
<view class="state-list">
|
||||
<view v-for="item in diseaseStatusList" :key="item.value" class="state-item"
|
||||
:class="item.selected ? 'active' : ''" @click="selectStatus(item)">{{ item.label }}</view>
|
||||
</view>
|
||||
<view class="filter-title">是否启用</view>
|
||||
<view class="state-list">
|
||||
<view v-for="item in isActiveList" :key="item.value" class="state-item"
|
||||
:class="item.selected ? 'active' : ''" @click="selectActive(item)">{{ item.label }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn-box">
|
||||
<view class="btn-reset" @click="resetQuery()">
|
||||
<uni-icons type="reload" size="16" color="#909399"></uni-icons>
|
||||
<text>重置</text>
|
||||
</view>
|
||||
<view class="btn-confirm" @click="searchSubmit()">
|
||||
<uni-icons type="checkmarkempty" size="16" color="#ffffff"></uni-icons>
|
||||
<text>确定</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-transition>
|
||||
</u-sticky>
|
||||
|
||||
<u-list @scrolltolower="loadmore" :spaceHeight="170" lowerThreshold="100">
|
||||
<u-list-item v-for="(item, index) in listData" :key="index">
|
||||
<view class="list-item">
|
||||
<view class="item-header">
|
||||
<view class="card-name-section">
|
||||
<view class="card-icon">
|
||||
<uni-icons type="heart-filled" size="20" color="#ffffff"></uni-icons>
|
||||
</view>
|
||||
<view class="card-info">
|
||||
<text class="card-name">{{ item.diseaseName }}</text>
|
||||
<text class="card-code" v-if="item.diseaseCode">{{ item.diseaseCode }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="card-body">
|
||||
<view class="info-row">
|
||||
<view class="info-item">
|
||||
<text class="info-label">成员</text>
|
||||
<text class="info-value">{{ item.memberName || '--' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">确诊日期</text>
|
||||
<text class="info-value">{{ item.diagnosisDate || '--' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">疾病状态</text>
|
||||
<text class="info-value" :class="getStatusClass(item.diseaseStatus)">{{ getStatusText(item.diseaseStatus) }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">是否启用</text>
|
||||
<text class="info-value" :class="item.isActive === 1 ? 'active' : 'inactive'">{{ item.isActive === 1 ? '启用' : '停用' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">主治医生</text>
|
||||
<text class="info-value">{{ item.mainDoctor || '--' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">就诊医院</text>
|
||||
<text class="info-value">{{ item.hospital || '--' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">科室</text>
|
||||
<text class="info-value">{{ item.department || '--' }}</text>
|
||||
</view>
|
||||
<view class="info-item info-item-full" v-if="item.notes">
|
||||
<text class="info-label">备注说明</text>
|
||||
<text class="info-value">{{ item.notes }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="operate" @click.stop>
|
||||
<view class="btn-edit" @click="handleEdit(item)">
|
||||
<uni-icons type="compose" size="16" color="#667eea"></uni-icons>
|
||||
<text>修改</text>
|
||||
</view>
|
||||
<view class="btn-delete" @click="handleDelete(item)">
|
||||
<uni-icons type="trash" size="16" color="#f5576c"></uni-icons>
|
||||
<text>删除</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-list-item>
|
||||
<u-loadmore :status="status" loadingIcon="semicircle" height="88" fontSize="32rpx" @loadmore="loadmore" />
|
||||
</u-list>
|
||||
|
||||
<u-picker itemHeight="88" :show="showMember" :columns="memberList" keyName="name" @cancel="handleMemberCancel"
|
||||
@confirm="handleMemberConfirm"></u-picker>
|
||||
</view>
|
||||
<suspend></suspend>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { listChronicDisease, delChronicDisease } from '@/api/health/chronicDisease'
|
||||
import { listPerson } from '@/api/health/person'
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import { reactive, toRefs, ref, computed } from "vue"
|
||||
|
||||
const pageNum = ref(1)
|
||||
const listData = ref([])
|
||||
const isShow = ref(false)
|
||||
const status = ref('loadmore')
|
||||
const showMember = ref(false)
|
||||
const memberList = ref([])
|
||||
const filterPanel = ref(false)
|
||||
|
||||
const diseaseStatusList = ref([
|
||||
{ value: 1, label: '稳定', selected: false },
|
||||
{ value: 2, label: '需关注', selected: false },
|
||||
{ value: 3, label: '急性期', selected: false }
|
||||
])
|
||||
|
||||
const isActiveList = ref([
|
||||
{ value: 1, label: '启用', selected: false },
|
||||
{ value: 0, label: '停用', selected: false }
|
||||
])
|
||||
|
||||
const data = reactive({
|
||||
queryPersonParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 100
|
||||
},
|
||||
queryParams: {
|
||||
diseaseName: null,
|
||||
memberId: null,
|
||||
memberName: null,
|
||||
diseaseStatus: null,
|
||||
isActive: null
|
||||
}
|
||||
})
|
||||
|
||||
const { queryPersonParams, queryParams } = toRefs(data)
|
||||
|
||||
const windowHeight = computed(() => {
|
||||
return uni.getSystemInfoSync().windowHeight - 50
|
||||
})
|
||||
|
||||
onLoad(() => {
|
||||
getData()
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
if (isShow.value) {
|
||||
listData.value = []
|
||||
pageNum.value = 1
|
||||
getList()
|
||||
isShow.value = false
|
||||
}
|
||||
})
|
||||
|
||||
function loadmore() {
|
||||
pageNum.value += 1
|
||||
if (status.value == 'loadmore') {
|
||||
getList()
|
||||
}
|
||||
}
|
||||
|
||||
function getData() {
|
||||
listPerson(queryPersonParams.value).then((response) => {
|
||||
memberList.value = [response.rows]
|
||||
getList()
|
||||
})
|
||||
}
|
||||
|
||||
function getList() {
|
||||
status.value = 'loading'
|
||||
listChronicDisease({ pageSize: 10, pageNum: pageNum.value, ...queryParams.value }).then(res => {
|
||||
listData.value = listData.value.concat(res.rows)
|
||||
if (listData.value.length < res.total) {
|
||||
status.value = 'loadmore'
|
||||
} else {
|
||||
status.value = 'nomore'
|
||||
}
|
||||
}).catch(() => {
|
||||
status.value = 'nomore'
|
||||
})
|
||||
}
|
||||
|
||||
function handleMember() {
|
||||
if (memberList.value[0].length === 0) {
|
||||
uni.showToast({ title: '成员为空', icon: 'none' })
|
||||
} else {
|
||||
showMember.value = true
|
||||
}
|
||||
}
|
||||
|
||||
function handleMemberConfirm(e) {
|
||||
queryParams.value.memberName = e.value[0].name
|
||||
queryParams.value.memberId = e.value[0].id
|
||||
showMember.value = false
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
}
|
||||
|
||||
function handleMemberCancel() {
|
||||
queryParams.value.memberName = ''
|
||||
queryParams.value.memberId = ''
|
||||
showMember.value = false
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
}
|
||||
|
||||
function selectStatus(item) {
|
||||
queryParams.value.diseaseStatus = item.selected ? null : item.value
|
||||
diseaseStatusList.value.forEach(ele => {
|
||||
ele.selected = ele.value === item.value && !item.selected
|
||||
})
|
||||
}
|
||||
|
||||
function selectActive(item) {
|
||||
queryParams.value.isActive = item.selected ? null : item.value
|
||||
isActiveList.value.forEach(ele => {
|
||||
ele.selected = ele.value === item.value && !item.selected
|
||||
})
|
||||
}
|
||||
|
||||
function searchBlur() {
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
}
|
||||
|
||||
function searchSubmit() {
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
filterPanel.value = false
|
||||
}
|
||||
|
||||
function resetQuery() {
|
||||
queryParams.value.diseaseName = null
|
||||
queryParams.value.memberId = null
|
||||
queryParams.value.memberName = null
|
||||
queryParams.value.diseaseStatus = null
|
||||
queryParams.value.isActive = null
|
||||
diseaseStatusList.value.forEach(ele => ele.selected = false)
|
||||
isActiveList.value.forEach(ele => ele.selected = false)
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
uni.navigateTo({ url: `/pages/health/chronicDisease/addEdit` })
|
||||
isShow.value = true
|
||||
}
|
||||
|
||||
function handleEdit(item) {
|
||||
uni.navigateTo({ url: `/pages/health/chronicDisease/addEdit?id=${item.id}` })
|
||||
isShow.value = true
|
||||
}
|
||||
|
||||
function handleDelete(item) {
|
||||
uni.showModal({
|
||||
title: '确认删除',
|
||||
content: '确定要删除该慢性疾病档案吗?',
|
||||
confirmText: '删除',
|
||||
cancelText: '取消',
|
||||
confirmColor: '#f5576c',
|
||||
cancelColor: '#909399',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
delChronicDisease(item.id).then(() => {
|
||||
uni.showToast({ title: '删除成功', icon: 'success' })
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getStatusClass(status) {
|
||||
const classes = { 1: 'status-normal', 2: 'status-warning', 3: 'status-danger' }
|
||||
return classes[status] || 'status-default'
|
||||
}
|
||||
|
||||
function getStatusText(status) {
|
||||
const texts = { 1: '稳定', 2: '需关注', 3: '急性期' }
|
||||
return texts[status] || '未知'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
page {
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.search-container {
|
||||
background-color: #ffffff;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
|
||||
position: relative;
|
||||
z-index: 100;
|
||||
|
||||
.search-row {
|
||||
padding: 12rpx 32rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 10rpx;
|
||||
|
||||
&:first-child {
|
||||
padding-bottom: 8rpx;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
padding-top: 8rpx;
|
||||
}
|
||||
|
||||
.search-input-wrapper {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
|
||||
.search-icon {
|
||||
position: absolute;
|
||||
right: 20rpx;
|
||||
z-index: 10;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.search-input {
|
||||
background: rgba(102, 126, 234, 0.08);
|
||||
color: #333333;
|
||||
width: 100%;
|
||||
border-radius: 24rpx;
|
||||
border: 2rpx solid rgba(102, 126, 234, 0.3);
|
||||
height: 66rpx !important;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.filter-btn,
|
||||
.add-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6rpx;
|
||||
padding: 12rpx 24rpx;
|
||||
background: rgba(102, 126, 234, 0.08);
|
||||
border-radius: 24rpx;
|
||||
border: 2rpx solid rgba(102, 126, 234, 0.3);
|
||||
flex-shrink: 0;
|
||||
|
||||
&:active {
|
||||
transform: scale(0.95);
|
||||
background: rgba(102, 126, 234, 0.12);
|
||||
}
|
||||
|
||||
text {
|
||||
color: #667eea;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.filter-panel {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 180rpx;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
z-index: 999;
|
||||
|
||||
.filter-panel-content {
|
||||
background-color: #ffffff;
|
||||
padding: 0 30rpx 30rpx;
|
||||
border-radius: 16rpx 16rpx 0 0;
|
||||
|
||||
.filter-title {
|
||||
color: #2c3e50;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
padding: 32rpx 0 24rpx 20rpx;
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
width: 6rpx;
|
||||
height: 32rpx;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
border-radius: 3rpx;
|
||||
margin-right: 12rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.state-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16rpx;
|
||||
|
||||
.state-item {
|
||||
padding: 0 32rpx;
|
||||
height: 68rpx;
|
||||
border: 2rpx solid #e8edf3;
|
||||
border-radius: 34rpx;
|
||||
text-align: center;
|
||||
line-height: 68rpx;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.active {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
border: 2rpx solid transparent;
|
||||
color: #ffffff;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn-box {
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
padding: 24rpx 30rpx;
|
||||
background-color: #fff;
|
||||
box-shadow: 0rpx -10rpx 20rpx #EEEEEE;
|
||||
|
||||
.btn-reset,
|
||||
.btn-confirm {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8rpx;
|
||||
height: 88rpx;
|
||||
border-radius: 12rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
flex: 1;
|
||||
|
||||
text {
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-reset {
|
||||
background: #f5f7fa;
|
||||
border: 2rpx solid #dcdfe6;
|
||||
|
||||
text {
|
||||
color: #606266;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-confirm {
|
||||
background: #667eea;
|
||||
box-shadow: 0 2rpx 8rpx rgba(102, 126, 234, 0.2);
|
||||
border: none;
|
||||
|
||||
text {
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.list-item {
|
||||
margin: 10rpx 24rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:active {
|
||||
transform: scale(0.98);
|
||||
box-shadow: 0 1rpx 6rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
.item-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 16rpx 24rpx;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
|
||||
.card-name-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.card-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
background: rgba(255, 255, 255, 0.25);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-right: 12rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.card-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
|
||||
.card-name {
|
||||
color: #ffffff;
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
line-height: 1.3;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
letter-spacing: 0.5rpx;
|
||||
}
|
||||
|
||||
.card-code {
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
line-height: 1.3;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.card-body {
|
||||
padding: 24rpx;
|
||||
background: #fafbfc;
|
||||
border: 2rpx solid #f0f2f5;
|
||||
margin: 15rpx 16rpx 2rpx;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.info-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin: 0 -12rpx;
|
||||
|
||||
.info-item {
|
||||
width: 50%;
|
||||
padding: 0 12rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
&.info-item-full {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.info-label {
|
||||
font-size: 24rpx;
|
||||
color: #667eea;
|
||||
font-weight: 500;
|
||||
background: rgba(102, 126, 234, 0.08);
|
||||
padding: 6rpx 12rpx;
|
||||
border-radius: 8rpx;
|
||||
align-self: flex-start;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
flex: 1;
|
||||
line-height: 1.5;
|
||||
word-break: break-all;
|
||||
|
||||
&.active { color: #52c41a; }
|
||||
&.inactive { color: #ff4d4f; }
|
||||
&.status-normal { color: #52c41a; }
|
||||
&.status-warning { color: #faad14; }
|
||||
&.status-danger { color: #ff4d4f; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.operate {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 16rpx 24rpx 24rpx;
|
||||
gap: 16rpx;
|
||||
|
||||
.btn-edit,
|
||||
.btn-delete {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6rpx;
|
||||
padding: 0 24rpx;
|
||||
height: 64rpx;
|
||||
border-radius: 12rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:active {
|
||||
transform: scale(0.95);
|
||||
}
|
||||
}
|
||||
|
||||
.btn-edit {
|
||||
background: rgba(102, 126, 234, 0.1);
|
||||
color: #667eea;
|
||||
border: 1rpx solid rgba(102, 126, 234, 0.3);
|
||||
}
|
||||
|
||||
.btn-delete {
|
||||
background: rgba(245, 87, 108, 0.1);
|
||||
color: #f5576c;
|
||||
border: 1rpx solid rgba(245, 87, 108, 0.3);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,456 +0,0 @@
|
||||
<template>
|
||||
<view class="container" style="paddingBottom: 120rpx;">
|
||||
<view class="section">
|
||||
<view class="section-title">{{ title }}</view>
|
||||
<view class="form-view">
|
||||
<u--form labelPosition="left" :model="form" :rules="rules" ref="uForm" label-width="180rpx"
|
||||
:labelStyle="{ color: '#333333', fontSize: '30rpx', marginRight: '24rpx' }">
|
||||
|
||||
<u-form-item label="计划名称" prop="planName">
|
||||
<u--input v-model="form.planName" placeholder="请填写计划名称(可选)" inputAlign="left"
|
||||
:customStyle="inputBaseStyle"></u--input>
|
||||
</u-form-item>
|
||||
|
||||
<u-form-item label="人员" prop="personName" required @click="handlePerson">
|
||||
<view class="input-with-arrow">
|
||||
<u--input v-model="form.personName" disabled disabledColor="#ffffff" placeholder="请选择人员"
|
||||
inputAlign="left" :customStyle="inputBaseStyle"></u--input>
|
||||
<text class="arrow-icon">▼</text>
|
||||
</view>
|
||||
</u-form-item>
|
||||
|
||||
<u-form-item label="药品" prop="medicineName" required @click="handleMedicine">
|
||||
<view class="input-with-arrow">
|
||||
<u--input v-model="form.medicineName" disabled disabledColor="#ffffff" placeholder="请选择药品"
|
||||
inputAlign="left" :customStyle="inputBaseStyle"></u--input>
|
||||
<text class="arrow-icon">▼</text>
|
||||
</view>
|
||||
</u-form-item>
|
||||
|
||||
<u-form-item label="每次剂量" prop="dosage" required>
|
||||
<view class="dosage-input">
|
||||
<u--input v-model="form.dosage" type="digit" placeholder="剂量" inputAlign="left"
|
||||
:customStyle="inputBaseStyle" style="flex: 1"></u--input>
|
||||
<u--input v-model="form.dosageUnit" disabled disabledColor="#ffffff" placeholder="单位"
|
||||
inputAlign="left" :customStyle="inputBaseStyle" style="width: 160rpx; margin-left: 16rpx"></u--input>
|
||||
</view>
|
||||
</u-form-item>
|
||||
|
||||
<u-form-item label="每日次数" prop="frequency" required>
|
||||
<view class="stepper">
|
||||
<view class="stepper-btn" @click="decreaseFrequency">-</view>
|
||||
<text class="stepper-value">{{ form.frequency }}</text>
|
||||
<view class="stepper-btn" @click="increaseFrequency">+</view>
|
||||
</view>
|
||||
</u-form-item>
|
||||
|
||||
<u-form-item label="频率类型" prop="frequencyTypeName" @click="handleFrequencyType">
|
||||
<view class="input-with-arrow">
|
||||
<u--input v-model="form.frequencyTypeName" disabled disabledColor="#ffffff" placeholder="请选择频率类型"
|
||||
inputAlign="left" :customStyle="inputBaseStyle"></u--input>
|
||||
<text class="arrow-icon">▼</text>
|
||||
</view>
|
||||
</u-form-item>
|
||||
|
||||
<u-form-item label="服药时间点" prop="timePointsText">
|
||||
<view class="time-points-box">
|
||||
<view v-for="(time, idx) in form.timePointList" :key="idx" class="time-tag">
|
||||
<text>{{ time }}</text>
|
||||
<uni-icons type="closeempty" size="14" color="#909399" @click="removeTimePoint(idx)"></uni-icons>
|
||||
</view>
|
||||
<view class="time-add" @click="showTimePicker = true">
|
||||
<uni-icons type="plusempty" size="16" color="#667eea"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</u-form-item>
|
||||
|
||||
<u-form-item label="开始日期" prop="startDate" required @click="showStartDate = true">
|
||||
<view class="input-with-arrow">
|
||||
<u--input v-model="form.startDate" disabled disabledColor="#ffffff" placeholder="请选择开始日期"
|
||||
inputAlign="left" :customStyle="inputBaseStyle"></u--input>
|
||||
<text class="arrow-icon">▼</text>
|
||||
</view>
|
||||
</u-form-item>
|
||||
|
||||
<u-form-item label="结束日期" prop="endDate" @click="showEndDate = true">
|
||||
<view class="input-with-arrow">
|
||||
<u--input v-model="form.endDate" disabled disabledColor="#ffffff" placeholder="可选,不填则长期"
|
||||
inputAlign="left" :customStyle="inputBaseStyle"></u--input>
|
||||
<text class="arrow-icon">▼</text>
|
||||
</view>
|
||||
</u-form-item>
|
||||
|
||||
<u-form-item label="启用提醒">
|
||||
<u-switch v-model="form.reminderEnabled" activeValue="1" inactiveValue="0"
|
||||
activeColor="#667eea" inactiveColor="#dcdfe6"></u-switch>
|
||||
</u-form-item>
|
||||
|
||||
<u-form-item label="提前提醒" v-if="form.reminderEnabled === '1'">
|
||||
<view class="stepper">
|
||||
<view class="stepper-btn" @click="form.reminderMinutes = Math.max(0, form.reminderMinutes - 5)">-</view>
|
||||
<text class="stepper-value">{{ form.reminderMinutes }}分钟</text>
|
||||
<view class="stepper-btn" @click="form.reminderMinutes += 5">+</view>
|
||||
</view>
|
||||
</u-form-item>
|
||||
|
||||
<u-form-item label="备注" prop="remark" labelPosition="top">
|
||||
<u--textarea v-model="form.remark" placeholder="请填写备注" inputAlign="left"
|
||||
style="border: 2rpx solid #dcdfe6 !important; height: 160rpx;"></u--textarea>
|
||||
</u-form-item>
|
||||
</u--form>
|
||||
|
||||
<view class="form-btn">
|
||||
<u-button type="primary" text="提交" @click="submit"></u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<u-toast ref="uToast"></u-toast>
|
||||
|
||||
<!-- 选择器 -->
|
||||
<u-picker :show="showPersonPicker" :columns="personPickerList" keyName="name" @cancel="showPersonPicker = false"
|
||||
@confirm="onPersonConfirm"></u-picker>
|
||||
<u-picker :show="showMedicinePicker" :columns="medicinePickerList" keyName="shortNameBrand" @cancel="showMedicinePicker = false"
|
||||
@confirm="onMedicineConfirm"></u-picker>
|
||||
<u-picker :show="showFrequencyTypePicker" :columns="frequencyTypeList" keyName="label" @cancel="showFrequencyTypePicker = false"
|
||||
@confirm="onFrequencyTypeConfirm"></u-picker>
|
||||
<u-datetime-picker :show="showStartDate" mode="date" @cancel="showStartDate = false"
|
||||
@confirm="onStartDateConfirm" :maxDate="maxDate"></u-datetime-picker>
|
||||
<u-datetime-picker :show="showEndDate" mode="date" @cancel="showEndDate = false"
|
||||
@confirm="onEndDateConfirm"></u-datetime-picker>
|
||||
<u-datetime-picker :show="showTimePicker" mode="time" @cancel="showTimePicker = false"
|
||||
@confirm="onTimeConfirm"></u-datetime-picker>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getMedicationPlan, addMedicationPlan, updateMedicationPlan } from '@/api/health/medicationPlan'
|
||||
import { listMedicineBasic } from '@/api/health/medicineBasic'
|
||||
import { listPerson } from '@/api/health/person'
|
||||
import { onLoad, onReady } from "@dcloudio/uni-app"
|
||||
import { reactive, toRefs, ref, computed, getCurrentInstance } from "vue"
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const title = ref("新增用药计划")
|
||||
const planId = ref(null)
|
||||
const copyFlag = ref(false)
|
||||
|
||||
const inputBaseStyle = {
|
||||
background: '#ffffff',
|
||||
border: '2rpx solid #dcdfe6',
|
||||
borderRadius: '8rpx',
|
||||
padding: '0 24rpx',
|
||||
height: '68rpx',
|
||||
width: '100%',
|
||||
boxSizing: 'border-box'
|
||||
}
|
||||
|
||||
const data = reactive({
|
||||
form: {
|
||||
id: null,
|
||||
personId: null,
|
||||
personName: null,
|
||||
medicineId: null,
|
||||
medicineName: null,
|
||||
dosage: 1,
|
||||
dosageUnit: '片',
|
||||
frequency: 3,
|
||||
frequencyType: '1',
|
||||
frequencyTypeName: '每日',
|
||||
timePointList: ['08:00', '12:00', '18:00'],
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
reminderEnabled: '0',
|
||||
reminderMinutes: 15,
|
||||
remark: null
|
||||
},
|
||||
rules: {
|
||||
personName: [{ required: true, message: '请选择人员', trigger: 'change' }],
|
||||
medicineName: [{ required: true, message: '请选择药品', trigger: 'change' }],
|
||||
dosage: [{ required: true, message: '请输入剂量', trigger: 'blur' }],
|
||||
frequency: [{ required: true, message: '请设置每日次数', trigger: 'change' }],
|
||||
startDate: [{ required: true, message: '请选择开始日期', trigger: 'change' }]
|
||||
}
|
||||
})
|
||||
|
||||
const { form, rules } = toRefs(data)
|
||||
|
||||
// 选择器相关
|
||||
const showPersonPicker = ref(false)
|
||||
const showMedicinePicker = ref(false)
|
||||
const showFrequencyTypePicker = ref(false)
|
||||
const showStartDate = ref(false)
|
||||
const showEndDate = ref(false)
|
||||
const showTimePicker = ref(false)
|
||||
|
||||
const personList = ref([])
|
||||
const medicineList = ref([])
|
||||
const frequencyTypeList = ref([
|
||||
[{ value: '1', label: '每日' }],
|
||||
[{ value: '2', label: '隔日' }],
|
||||
[{ value: '3', label: '每周' }],
|
||||
[{ value: '4', label: '自定义' }]
|
||||
])
|
||||
|
||||
const maxDate = ref(Date.now() + 365 * 24 * 60 * 60 * 1000)
|
||||
|
||||
const personPickerList = computed(() => [personList.value])
|
||||
const medicinePickerList = computed(() => [medicineList.value])
|
||||
|
||||
onLoad((options) => {
|
||||
if (options.id) {
|
||||
planId.value = options.id
|
||||
if (options.flag === 'copy') {
|
||||
copyFlag.value = true
|
||||
title.value = "复制用药计划"
|
||||
} else {
|
||||
title.value = "编辑用药计划"
|
||||
}
|
||||
}
|
||||
getPersonList()
|
||||
getMedicineList()
|
||||
})
|
||||
|
||||
onReady(() => {
|
||||
if (planId.value) {
|
||||
getDetail()
|
||||
}
|
||||
})
|
||||
|
||||
function getPersonList() {
|
||||
listPerson({ pageNum: 1, pageSize: 100 }).then(res => {
|
||||
personList.value = res.rows || []
|
||||
})
|
||||
}
|
||||
|
||||
function getMedicineList() {
|
||||
listMedicineBasic({ pageNum: 1, pageSize: 1000 }).then(res => {
|
||||
medicineList.value = (res.rows || []).map(item => ({
|
||||
...item,
|
||||
shortNameBrand: `${item.shortName}-${item.brand}`
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
function getDetail() {
|
||||
getMedicationPlan(planId.value).then(res => {
|
||||
form.value = {
|
||||
...res.data,
|
||||
personName: res.data.personName,
|
||||
medicineName: res.data.shortName ? `${res.data.shortName}-${res.data.brand}` : null,
|
||||
frequencyTypeName: getFrequencyTypeName(res.data.frequencyType),
|
||||
timePointList: res.data.timePoints ? JSON.parse(res.data.timePoints) : [],
|
||||
startDate: res.data.startDate ? res.data.startDate.substring(0, 10) : null,
|
||||
endDate: res.data.endDate ? res.data.endDate.substring(0, 10) : null
|
||||
}
|
||||
if (copyFlag.value) {
|
||||
form.value.id = null
|
||||
title.value = "复制用药计划"
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getFrequencyTypeName(type) {
|
||||
const map = { '1': '每日', '2': '隔日', '3': '每周', '4': '自定义' }
|
||||
return map[type] || '每日'
|
||||
}
|
||||
|
||||
function handlePerson() { showPersonPicker.value = true }
|
||||
function handleMedicine() { showMedicinePicker.value = true }
|
||||
function handleFrequencyType() { showFrequencyTypePicker.value = true }
|
||||
|
||||
function onPersonConfirm(e) {
|
||||
const selected = e.value[0]
|
||||
form.value.personId = selected.id
|
||||
form.value.personName = selected.name
|
||||
showPersonPicker.value = false
|
||||
}
|
||||
|
||||
function onMedicineConfirm(e) {
|
||||
const selected = e.value[0]
|
||||
form.value.medicineId = selected.id
|
||||
form.value.medicineName = selected.shortNameBrand
|
||||
form.value.dosageUnit = selected.unit || '片'
|
||||
showMedicinePicker.value = false
|
||||
}
|
||||
|
||||
function onFrequencyTypeConfirm(e) {
|
||||
const selected = e.value[0]
|
||||
form.value.frequencyType = selected.value
|
||||
form.value.frequencyTypeName = selected.label
|
||||
showFrequencyTypePicker.value = false
|
||||
}
|
||||
|
||||
function onStartDateConfirm(e) {
|
||||
form.value.startDate = dayjs(e.value).format('YYYY-MM-DD')
|
||||
showStartDate.value = false
|
||||
}
|
||||
|
||||
function onEndDateConfirm(e) {
|
||||
form.value.endDate = dayjs(e.value).format('YYYY-MM-DD')
|
||||
showEndDate.value = false
|
||||
}
|
||||
|
||||
function onTimeConfirm(e) {
|
||||
const time = dayjs(e.value).format('HH:mm')
|
||||
if (!form.value.timePointList.includes(time)) {
|
||||
form.value.timePointList.push(time)
|
||||
form.value.timePointList.sort()
|
||||
}
|
||||
showTimePicker.value = false
|
||||
}
|
||||
|
||||
function removeTimePoint(idx) {
|
||||
form.value.timePointList.splice(idx, 1)
|
||||
}
|
||||
|
||||
function decreaseFrequency() {
|
||||
if (form.value.frequency > 1) form.value.frequency--
|
||||
}
|
||||
|
||||
function increaseFrequency() {
|
||||
if (form.value.frequency < 10) form.value.frequency++
|
||||
}
|
||||
|
||||
function submit() {
|
||||
proxy.$refs.uForm.validate().then(() => {
|
||||
const data = {
|
||||
...form.value,
|
||||
timePoints: JSON.stringify(form.value.timePointList)
|
||||
}
|
||||
|
||||
if (form.value.id && !copyFlag.value) {
|
||||
updateMedicationPlan(data).then(() => {
|
||||
proxy.$refs.uToast.show({ message: '修改成功', type: 'success' })
|
||||
setTimeout(() => uni.navigateBack(), 1000)
|
||||
})
|
||||
} else {
|
||||
addMedicationPlan(data).then(() => {
|
||||
proxy.$refs.uToast.show({ message: '新增成功', type: 'success' })
|
||||
setTimeout(() => uni.navigateBack(), 1000)
|
||||
})
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log('验证失败', err)
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container {
|
||||
background: #f5f7fa;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.section {
|
||||
background: #fff;
|
||||
margin: 24rpx;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
|
||||
.section-title {
|
||||
padding: 32rpx 24rpx 16rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
border-bottom: 1rpx solid #f0f2f5;
|
||||
}
|
||||
|
||||
.form-view {
|
||||
padding: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.input-with-arrow {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
|
||||
.arrow-icon {
|
||||
position: absolute;
|
||||
right: 24rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
color: #909399;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.dosage-input {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.stepper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.stepper-btn {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
background: #f5f7fa;
|
||||
border-radius: 8rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 36rpx;
|
||||
color: #667eea;
|
||||
font-weight: 600;
|
||||
|
||||
&:active { background: #e8edf3; }
|
||||
}
|
||||
|
||||
.stepper-value {
|
||||
min-width: 120rpx;
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
|
||||
.time-points-box {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16rpx;
|
||||
|
||||
.time-tag {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 12rpx 20rpx;
|
||||
background: rgba(102, 126, 234, 0.1);
|
||||
border-radius: 8rpx;
|
||||
border: 1rpx solid rgba(102, 126, 234, 0.3);
|
||||
|
||||
text {
|
||||
font-size: 28rpx;
|
||||
color: #667eea;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.time-add {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
background: rgba(102, 126, 234, 0.08);
|
||||
border: 2rpx dashed #667eea;
|
||||
border-radius: 8rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
.form-btn {
|
||||
margin-top: 40rpx;
|
||||
padding: 24rpx;
|
||||
|
||||
:deep(.u-button) {
|
||||
height: 88rpx;
|
||||
border-radius: 12rpx;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,357 +0,0 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<view class="detail-card">
|
||||
<view class="card-header">
|
||||
<view class="header-left">
|
||||
<view class="icon-box">
|
||||
<uni-icons type="calendar" size="24" color="#667eea"></uni-icons>
|
||||
</view>
|
||||
<view class="header-info">
|
||||
<text class="plan-name">{{ detail.planName || '用药计划' }}</text>
|
||||
<view class="status-tag" :class="getStatusClass(detail.status)">
|
||||
{{ getStatusText(detail.status) }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="info-section">
|
||||
<view class="section-title">基本信息</view>
|
||||
<view class="info-grid">
|
||||
<view class="info-item">
|
||||
<text class="label">人员</text>
|
||||
<text class="value">{{ detail.personName || '--' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">药品</text>
|
||||
<text class="value">{{ detail.medicineDisplayName || '--' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">每次剂量</text>
|
||||
<text class="value">{{ detail.dosage }}{{ detail.dosageUnit }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">每日次数</text>
|
||||
<text class="value">{{ detail.frequency }}次</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">频率类型</text>
|
||||
<text class="value">{{ getFrequencyText(detail.frequencyType) }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">开始日期</text>
|
||||
<text class="value">{{ formatDate(detail.startDate) }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">结束日期</text>
|
||||
<text class="value">{{ detail.endDate ? formatDate(detail.endDate) : '长期' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">提醒</text>
|
||||
<text class="value">{{ detail.reminderEnabled === '1' ? '开启 (提前' + detail.reminderMinutes + '分钟)' : '关闭' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="info-section" v-if="detail.status === '1'">
|
||||
<view class="section-title">今日进度</view>
|
||||
<view class="progress-box">
|
||||
<view class="progress-bar">
|
||||
<view class="progress-fill" :style="{ width: progressPercent + '%' }"></view>
|
||||
</view>
|
||||
<text class="progress-text">{{ detail.todayTakenCount || 0 }}/{{ detail.todayTotalCount || 0 }} 次</text>
|
||||
</view>
|
||||
<view class="time-points">
|
||||
<view v-for="(time, idx) in timePointList" :key="idx" class="time-item"
|
||||
:class="takenTimes.includes(idx) ? 'taken' : ''">
|
||||
<text class="time">{{ time }}</text>
|
||||
<text class="status">{{ takenTimes.includes(idx) ? '已服' : '待服' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="info-section" v-if="detail.remark">
|
||||
<view class="section-title">备注</view>
|
||||
<text class="remark-text">{{ detail.remark }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="action-btns">
|
||||
<view class="btn-primary" v-if="detail.status === '1'" @click="handleTodayRecords">
|
||||
<uni-icons type="checkmarkempty" size="18" color="#fff"></uni-icons>
|
||||
<text>今日记录</text>
|
||||
</view>
|
||||
<view class="btn-default" v-show="auth.hasPermi('health:medicationPlan:edit')" @click="handleEdit">
|
||||
<uni-icons type="compose" size="18" color="#667eea"></uni-icons>
|
||||
<text>修改计划</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getMedicationPlan } from '@/api/health/medicationPlan'
|
||||
import { getRecordsByPlanAndDate } from '@/api/health/medicationRecord'
|
||||
import { onLoad } from "@dcloudio/uni-app"
|
||||
import auth from "@/plugins/auth"
|
||||
import { ref, computed } from "vue"
|
||||
|
||||
const detail = ref({})
|
||||
const timePointList = ref([])
|
||||
const takenTimes = ref([])
|
||||
|
||||
onLoad((options) => {
|
||||
if (options.id) {
|
||||
getDetail(options.id)
|
||||
}
|
||||
})
|
||||
|
||||
function getDetail(id) {
|
||||
getMedicationPlan(id).then(res => {
|
||||
detail.value = res.data
|
||||
if (res.data.timePoints) {
|
||||
try {
|
||||
timePointList.value = JSON.parse(res.data.timePoints)
|
||||
} catch (e) {
|
||||
timePointList.value = []
|
||||
}
|
||||
}
|
||||
// 获取今日记录
|
||||
if (res.data.status === '1') {
|
||||
const today = new Date().toISOString().substring(0, 10)
|
||||
getRecordsByPlanAndDate(id, today).then(records => {
|
||||
// 标记已服用的时间点
|
||||
takenTimes.value = (records.data || []).map((r, idx) => r.status === '2' ? idx : -1).filter(i => i >= 0)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const progressPercent = computed(() => {
|
||||
if (!detail.value.todayTotalCount) return 0
|
||||
return Math.round((detail.value.todayTakenCount || 0) / detail.value.todayTotalCount * 100)
|
||||
})
|
||||
|
||||
function formatDate(date) {
|
||||
if (!date) return '--'
|
||||
return date.substring(0, 10)
|
||||
}
|
||||
|
||||
function getStatusClass(status) {
|
||||
const map = { '1': 'status-active', '2': 'status-ended', '3': 'status-paused' }
|
||||
return map[status] || ''
|
||||
}
|
||||
|
||||
function getStatusText(status) {
|
||||
const map = { '1': '进行中', '2': '已结束', '3': '已暂停' }
|
||||
return map[status] || '--'
|
||||
}
|
||||
|
||||
function getFrequencyText(type) {
|
||||
const map = { '1': '每日', '2': '隔日', '3': '每周', '4': '自定义' }
|
||||
return map[type] || '--'
|
||||
}
|
||||
|
||||
function handleTodayRecords() {
|
||||
uni.navigateTo({ url: `/pages/health/medicationRecord/index?planId=${detail.value.id}` })
|
||||
}
|
||||
|
||||
function handleEdit() {
|
||||
uni.navigateTo({ url: `/pages/health/medicationPlan/addEdit?id=${detail.value.id}` })
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container {
|
||||
padding: 24rpx;
|
||||
background: #f5f7fa;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.detail-card {
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
|
||||
.card-header {
|
||||
padding: 32rpx 24rpx;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
|
||||
.header-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.icon-box {
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.header-info {
|
||||
flex: 1;
|
||||
|
||||
.plan-name {
|
||||
font-size: 36rpx;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
display: inline-block;
|
||||
margin-top: 12rpx;
|
||||
padding: 6rpx 16rpx;
|
||||
border-radius: 20rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
color: #fff;
|
||||
|
||||
&.status-active { background: rgba(82, 196, 26, 0.3); }
|
||||
&.status-ended { background: rgba(140, 140, 140, 0.3); }
|
||||
&.status-paused { background: rgba(250, 173, 20, 0.3); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.info-section {
|
||||
padding: 24rpx;
|
||||
border-bottom: 1rpx solid #f0f2f5;
|
||||
|
||||
.section-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 20rpx;
|
||||
padding-left: 16rpx;
|
||||
border-left: 6rpx solid #667eea;
|
||||
}
|
||||
|
||||
.info-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.info-item {
|
||||
width: 50%;
|
||||
padding: 12rpx 0;
|
||||
|
||||
.label {
|
||||
font-size: 24rpx;
|
||||
color: #909399;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
margin-top: 6rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.remark-text {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
line-height: 1.6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.progress-box {
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.progress-bar {
|
||||
height: 16rpx;
|
||||
background: #f0f2f5;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.progress-fill {
|
||||
height: 100%;
|
||||
background: linear-gradient(135deg, #52c41a 0%, #73d13d 100%);
|
||||
border-radius: 8rpx;
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
}
|
||||
|
||||
.progress-text {
|
||||
display: block;
|
||||
text-align: center;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.time-points {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16rpx;
|
||||
|
||||
.time-item {
|
||||
flex: 1;
|
||||
min-width: 140rpx;
|
||||
padding: 20rpx;
|
||||
background: #f5f7fa;
|
||||
border-radius: 12rpx;
|
||||
text-align: center;
|
||||
border: 2rpx solid #e8edf3;
|
||||
|
||||
&.taken {
|
||||
background: rgba(82, 196, 26, 0.1);
|
||||
border-color: #52c41a;
|
||||
|
||||
.time, .status { color: #52c41a; }
|
||||
}
|
||||
|
||||
.time {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.status {
|
||||
font-size: 24rpx;
|
||||
color: #909399;
|
||||
margin-top: 6rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.action-btns {
|
||||
margin-top: 32rpx;
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
|
||||
.btn-primary, .btn-default {
|
||||
flex: 1;
|
||||
height: 88rpx;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn-default {
|
||||
background: #fff;
|
||||
border: 2rpx solid #667eea;
|
||||
color: #667eea;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,359 +0,0 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<u-sticky offsetTop="0rpx" customNavHeight="0rpx">
|
||||
<view class="search-view">
|
||||
<u--input
|
||||
v-model="queryParams.keys"
|
||||
border="surround"
|
||||
@click="searchBlur"
|
||||
placeholder="搜索计划/药品名称"
|
||||
placeholderStyle="color: #909399"
|
||||
color="#333333"
|
||||
customStyle="background: rgba(102, 126, 234, 0.08); border: 2rpx solid rgba(102, 126, 234, 0.3); border-radius: 24rpx; height: 66rpx"
|
||||
class="search-input"
|
||||
suffixIcon="search"
|
||||
suffixIconStyle="color: #667eea">
|
||||
</u--input>
|
||||
<view class="filter-btn" @click="filterPanel = !filterPanel">
|
||||
<uni-icons type="list" size="18" color="#667eea"></uni-icons>
|
||||
<text>筛选</text>
|
||||
</view>
|
||||
<view class="add-btn" v-show="auth.hasPermi('health:medicationPlan:add')" @click="handleAdd()">
|
||||
<uni-icons type="plusempty" size="18" color="#667eea"></uni-icons>
|
||||
<text>新增</text>
|
||||
</view>
|
||||
<u-transition :show="filterPanel" mode="fade">
|
||||
<view class="filter-panel" :style="{ height: `${windowHeight - 42}px` }">
|
||||
<view class="filter-panel-content">
|
||||
<view class="filter-title">人员</view>
|
||||
<view class="state-list">
|
||||
<view v-for="item in personList" :key="item.id" class="state-item"
|
||||
:class="queryParams.personId === item.id ? 'active' : ''" @click="selectPerson(item)">{{ item.name }}</view>
|
||||
</view>
|
||||
<view class="filter-title">状态</view>
|
||||
<view class="state-list">
|
||||
<view v-for="item in statusList" :key="item.value" class="state-item"
|
||||
:class="queryParams.status === item.value ? 'active' : ''" @click="selectStatus(item)">{{ item.label }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn-box">
|
||||
<view class="btn-reset" @click="resetQuery()">
|
||||
<uni-icons type="reload" size="16" color="#909399"></uni-icons>
|
||||
<text>重置</text>
|
||||
</view>
|
||||
<view class="btn-confirm" @click="searchSubmit()">
|
||||
<uni-icons type="checkmarkempty" size="16" color="#ffffff"></uni-icons>
|
||||
<text>确定</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-transition>
|
||||
</view>
|
||||
</u-sticky>
|
||||
<u-list @scrolltolower="loadmore" :spaceHeight="116" lowerThreshold="100">
|
||||
<u-list-item v-for="(item, index) in listData" :key="index">
|
||||
<view class="list-item" @click="enterDetails(item)">
|
||||
<view class="item-header">
|
||||
<view class="card-name-section">
|
||||
<view class="card-icon">
|
||||
<uni-icons type="calendar" size="20" color="#ffffff"></uni-icons>
|
||||
</view>
|
||||
<view class="card-info">
|
||||
<text class="card-name">{{ item.planName || item.medicineDisplayName || '用药计划' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="status-tag" :class="getStatusClass(item.status)">
|
||||
{{ getStatusText(item.status) }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="card-body">
|
||||
<view class="info-row">
|
||||
<view class="info-item">
|
||||
<text class="info-label">人员</text>
|
||||
<text class="info-value">{{ item.personName || '--' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">药品</text>
|
||||
<text class="info-value">{{ item.shortName }}-{{ item.brand }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">剂量</text>
|
||||
<text class="info-value">{{ item.dosage }}{{ item.dosageUnit }} × {{ item.frequency }}次/日</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">今日进度</text>
|
||||
<text class="info-value" v-if="item.status === '1'">{{ item.todayTakenCount || 0 }}/{{ item.todayTotalCount || 0 }}</text>
|
||||
<text class="info-value" v-else>--</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">开始日期</text>
|
||||
<text class="info-value">{{ formatDate(item.startDate) }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">结束日期</text>
|
||||
<text class="info-value">{{ item.endDate ? formatDate(item.endDate) : '长期' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="operate" @click.stop>
|
||||
<view class="btn-take" v-if="item.status === '1'" @click="handleTodayRecords(item)">
|
||||
<uni-icons type="checkmarkempty" size="16" color="#52c41a"></uni-icons>
|
||||
<text>今日记录</text>
|
||||
</view>
|
||||
<view class="btn-pause" v-if="item.status === '1'" @click="handlePause(item)">
|
||||
<uni-icons type="hand-up" size="16" color="#faad14"></uni-icons>
|
||||
<text>暂停</text>
|
||||
</view>
|
||||
<view class="btn-resume" v-if="item.status === '3'" @click="handleResume(item)">
|
||||
<uni-icons type="play-filled" size="16" color="#667eea"></uni-icons>
|
||||
<text>恢复</text>
|
||||
</view>
|
||||
<view class="btn-end" v-if="item.status !== '2'" @click="handleEnd(item)">
|
||||
<uni-icons type="flag" size="16" color="#f5222d"></uni-icons>
|
||||
<text>结束</text>
|
||||
</view>
|
||||
<view class="btn-edit" v-show="auth.hasPermi('health:medicationPlan:edit')" @click="handleEdit(item)">
|
||||
<uni-icons type="compose" size="16" color="#667eea"></uni-icons>
|
||||
<text>修改</text>
|
||||
</view>
|
||||
<view class="btn-delete" v-show="auth.hasPermi('health:medicationPlan:remove')" @click="handleDelete(item)">
|
||||
<uni-icons type="trash" size="16" color="#f5576c"></uni-icons>
|
||||
<text>删除</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-list-item>
|
||||
<u-loadmore :status="status" loadingIcon="semicircle" height="88" fontSize="32rpx" @loadmore="loadmore" />
|
||||
</u-list>
|
||||
<suspend></suspend>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { listMedicationPlan, delMedicationPlan, pauseMedicationPlan, resumeMedicationPlan, endMedicationPlan } from '@/api/health/medicationPlan'
|
||||
import { listPerson } from '@/api/health/person'
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import auth from "@/plugins/auth"
|
||||
import { reactive, toRefs, ref, computed } from "vue"
|
||||
|
||||
const pageNum = ref(1)
|
||||
const listData = ref([])
|
||||
const isShow = ref(false)
|
||||
const status = ref('loadmore')
|
||||
const filterPanel = ref(false)
|
||||
const personList = ref([])
|
||||
const statusList = ref([
|
||||
{ value: '', label: '全部' },
|
||||
{ value: '1', label: '进行中' },
|
||||
{ value: '2', label: '已结束' },
|
||||
{ value: '3', label: '已暂停' }
|
||||
])
|
||||
|
||||
const data = reactive({
|
||||
queryParams: {
|
||||
keys: null,
|
||||
personId: null,
|
||||
status: null
|
||||
}
|
||||
})
|
||||
const { queryParams } = toRefs(data)
|
||||
const windowHeight = computed(() => uni.getSystemInfoSync().windowHeight - 50)
|
||||
|
||||
onLoad(() => {
|
||||
getPersonList()
|
||||
getList()
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
if (isShow.value) {
|
||||
listData.value = []
|
||||
pageNum.value = 1
|
||||
getList()
|
||||
isShow.value = false
|
||||
}
|
||||
})
|
||||
|
||||
function getPersonList() {
|
||||
listPerson({ pageNum: 1, pageSize: 100 }).then(res => {
|
||||
personList.value = res.rows || []
|
||||
})
|
||||
}
|
||||
|
||||
function loadmore() {
|
||||
pageNum.value += 1
|
||||
if (status.value == 'loadmore') {
|
||||
getList()
|
||||
}
|
||||
}
|
||||
|
||||
function getList() {
|
||||
status.value = 'loading'
|
||||
listMedicationPlan({ pageSize: 10, pageNum: pageNum.value, ...queryParams.value }).then(res => {
|
||||
listData.value = listData.value.concat(res.rows)
|
||||
if (listData.value.length < res.total) {
|
||||
status.value = 'loadmore'
|
||||
} else {
|
||||
status.value = 'nomore'
|
||||
}
|
||||
}).catch(() => {
|
||||
status.value = 'nomore'
|
||||
})
|
||||
}
|
||||
|
||||
function selectPerson(item) {
|
||||
queryParams.value.personId = item.id
|
||||
}
|
||||
|
||||
function selectStatus(item) {
|
||||
queryParams.value.status = item.value
|
||||
}
|
||||
|
||||
function searchSubmit() {
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
filterPanel.value = false
|
||||
}
|
||||
|
||||
function searchBlur() {
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
}
|
||||
|
||||
function resetQuery() {
|
||||
queryParams.value.keys = ''
|
||||
queryParams.value.personId = null
|
||||
queryParams.value.status = null
|
||||
}
|
||||
|
||||
function formatDate(date) {
|
||||
if (!date) return '--'
|
||||
return date.substring(0, 10)
|
||||
}
|
||||
|
||||
function getStatusClass(status) {
|
||||
const map = { '1': 'status-active', '2': 'status-ended', '3': 'status-paused' }
|
||||
return map[status] || ''
|
||||
}
|
||||
|
||||
function getStatusText(status) {
|
||||
const map = { '1': '进行中', '2': '已结束', '3': '已暂停' }
|
||||
return map[status] || '--'
|
||||
}
|
||||
|
||||
function enterDetails(item) {
|
||||
uni.navigateTo({ url: `/pages/health/medicationPlan/details?id=${item.id}` })
|
||||
}
|
||||
|
||||
function handleTodayRecords(item) {
|
||||
uni.navigateTo({ url: `/pages/health/medicationRecord/index?planId=${item.id}` })
|
||||
}
|
||||
|
||||
function handleEdit(item) {
|
||||
uni.navigateTo({ url: `/pages/health/medicationPlan/addEdit?id=${item.id}` })
|
||||
isShow.value = true
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
uni.navigateTo({ url: `/pages/health/medicationPlan/addEdit` })
|
||||
isShow.value = true
|
||||
}
|
||||
|
||||
function handlePause(item) {
|
||||
uni.showModal({
|
||||
title: '确认暂停',
|
||||
content: '确定暂停该用药计划?',
|
||||
confirmText: '暂停',
|
||||
cancelText: '取消',
|
||||
confirmColor: '#faad14',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
pauseMedicationPlan(item.id).then(() => {
|
||||
uni.showToast({ title: '已暂停', icon: 'success' })
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function handleResume(item) {
|
||||
resumeMedicationPlan(item.id).then(() => {
|
||||
uni.showToast({ title: '已恢复', icon: 'success' })
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
})
|
||||
}
|
||||
|
||||
function handleEnd(item) {
|
||||
uni.showModal({
|
||||
title: '确认结束',
|
||||
content: '结束后将不再生成用药记录,确定结束?',
|
||||
confirmText: '结束',
|
||||
cancelText: '取消',
|
||||
confirmColor: '#f5222d',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
endMedicationPlan(item.id).then(() => {
|
||||
uni.showToast({ title: '已结束', icon: 'success' })
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function handleDelete(item) {
|
||||
uni.showModal({
|
||||
title: '确认删除',
|
||||
content: '确定要删除这条记录吗?',
|
||||
confirmText: '删除',
|
||||
cancelText: '取消',
|
||||
confirmColor: '#f5576c',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
delMedicationPlan(item.id).then(() => {
|
||||
uni.showToast({ title: '删除成功', icon: 'success' })
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '@/styles/health-common.scss';
|
||||
|
||||
.status-tag {
|
||||
padding: 6rpx 16rpx;
|
||||
border-radius: 20rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
|
||||
&.status-active {
|
||||
background: rgba(82, 196, 26, 0.15);
|
||||
color: #52c41a;
|
||||
}
|
||||
|
||||
&.status-ended {
|
||||
background: rgba(140, 140, 140, 0.15);
|
||||
color: #8c8c8c;
|
||||
}
|
||||
|
||||
&.status-paused {
|
||||
background: rgba(250, 173, 20, 0.15);
|
||||
color: #faad14;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,464 +0,0 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<u-sticky offsetTop="0rpx" customNavHeight="0rpx">
|
||||
<view class="search-view">
|
||||
<u--input
|
||||
v-model="queryParams.keys"
|
||||
border="surround"
|
||||
@click="searchBlur"
|
||||
placeholder="搜索药品名称"
|
||||
placeholderStyle="color: #909399"
|
||||
color="#333333"
|
||||
customStyle="background: rgba(102, 126, 234, 0.08); border: 2rpx solid rgba(102, 126, 234, 0.3); border-radius: 24rpx; height: 66rpx"
|
||||
class="search-input"
|
||||
suffixIcon="search"
|
||||
suffixIconStyle="color: #667eea">
|
||||
</u--input>
|
||||
<view class="filter-btn" @click="filterPanel = !filterPanel">
|
||||
<uni-icons type="list" size="18" color="#667eea"></uni-icons>
|
||||
<text>筛选</text>
|
||||
</view>
|
||||
<u-transition :show="filterPanel" mode="fade">
|
||||
<view class="filter-panel" :style="{ height: `${windowHeight - 42}px` }">
|
||||
<view class="filter-panel-content">
|
||||
<view class="filter-title">人员</view>
|
||||
<view class="state-list">
|
||||
<view v-for="item in personList" :key="item.id" class="state-item"
|
||||
:class="queryParams.personId === item.id ? 'active' : ''" @click="selectPerson(item)">{{ item.name }}</view>
|
||||
</view>
|
||||
<view class="filter-title">状态</view>
|
||||
<view class="state-list">
|
||||
<view v-for="item in statusList" :key="item.value" class="state-item"
|
||||
:class="queryParams.status === item.value ? 'active' : ''" @click="selectStatus(item)">{{ item.label }}</view>
|
||||
</view>
|
||||
<view class="filter-title">日期范围</view>
|
||||
<view class="date-range">
|
||||
<u-input v-model="startDateText" placeholder="开始日期" @click="showStartDate = true" readonly />
|
||||
<text>至</text>
|
||||
<u-input v-model="endDateText" placeholder="结束日期" @click="showEndDate = true" readonly />
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn-box">
|
||||
<view class="btn-reset" @click="resetQuery()">
|
||||
<uni-icons type="reload" size="16" color="#909399"></uni-icons>
|
||||
<text>重置</text>
|
||||
</view>
|
||||
<view class="btn-confirm" @click="searchSubmit()">
|
||||
<uni-icons type="checkmarkempty" size="16" color="#ffffff"></uni-icons>
|
||||
<text>确定</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-transition>
|
||||
</view>
|
||||
</u-sticky>
|
||||
|
||||
<!-- 今日待服药快捷卡片 -->
|
||||
<view class="today-card" v-if="todayRecords.length > 0">
|
||||
<view class="today-header">
|
||||
<text class="today-title">今日待服药</text>
|
||||
<text class="today-count">{{ todayRecords.filter(r => r.status === '1').length }}项</text>
|
||||
</view>
|
||||
<scroll-view scroll-x class="today-scroll">
|
||||
<view v-for="(item, idx) in todayRecords.filter(r => r.status === '1')" :key="idx" class="today-item" @click="handleTake(item)">
|
||||
<view class="medicine-info">
|
||||
<text class="medicine-name">{{ item.shortName }}</text>
|
||||
<text class="dosage">{{ item.dosage }}{{ item.dosageUnit }}</text>
|
||||
</view>
|
||||
<view class="time-info">
|
||||
<text class="time">{{ formatTime(item.scheduledTime) }}</text>
|
||||
<view class="take-btn">点击服药</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<u-list @scrolltolower="loadmore" :spaceHeight="todayRecords.length > 0 ? 280 : 116" lowerThreshold="100">
|
||||
<u-list-item v-for="(item, index) in listData" :key="index">
|
||||
<view class="list-item">
|
||||
<view class="item-header">
|
||||
<view class="card-name-section">
|
||||
<view class="card-icon" :class="getStatusClass(item.status)">
|
||||
<uni-icons :type="getStatusIcon(item.status)" size="20" color="#ffffff"></uni-icons>
|
||||
</view>
|
||||
<view class="card-info">
|
||||
<text class="card-name">{{ item.shortName }}-{{ item.brand }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="status-tag" :class="getStatusClass(item.status)">
|
||||
{{ getStatusText(item.status) }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="card-body">
|
||||
<view class="info-row">
|
||||
<view class="info-item">
|
||||
<text class="info-label">计划时间</text>
|
||||
<text class="info-value">{{ formatDateTime(item.scheduledTime) }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">实际时间</text>
|
||||
<text class="info-value">{{ item.actualTime ? formatDateTime(item.actualTime) : '--' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">剂量</text>
|
||||
<text class="info-value">{{ item.dosage }}{{ item.dosageUnit }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">人员</text>
|
||||
<text class="info-value">{{ item.personName }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="operate" v-if="item.status === '1'" @click.stop>
|
||||
<view class="btn-take" @click="handleTake(item)">
|
||||
<uni-icons type="checkmarkempty" size="16" color="#52c41a"></uni-icons>
|
||||
<text>服药</text>
|
||||
</view>
|
||||
<view class="btn-skip" @click="handleSkip(item)">
|
||||
<uni-icons type="closeempty" size="16" color="#faad14"></uni-icons>
|
||||
<text>跳过</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-list-item>
|
||||
<u-loadmore :status="status" loadingIcon="semicircle" height="88" fontSize="32rpx" @loadmore="loadmore" />
|
||||
</u-list>
|
||||
|
||||
<!-- 日期选择器 -->
|
||||
<u-datetime-picker :show="showStartDate" mode="date" @cancel="showStartDate = false"
|
||||
@confirm="onStartDateConfirm"></u-datetime-picker>
|
||||
<u-datetime-picker :show="showEndDate" mode="date" @cancel="showEndDate = false"
|
||||
@confirm="onEndDateConfirm"></u-datetime-picker>
|
||||
|
||||
<suspend></suspend>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { listMedicationRecord, getTodayRecords, takeMedication, skipMedication } from '@/api/health/medicationRecord'
|
||||
import { listPerson } from '@/api/health/person'
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import auth from "@/plugins/auth"
|
||||
import { reactive, toRefs, ref, computed } from "vue"
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
const pageNum = ref(1)
|
||||
const listData = ref([])
|
||||
const todayRecords = ref([])
|
||||
const isShow = ref(false)
|
||||
const status = ref('loadmore')
|
||||
const filterPanel = ref(false)
|
||||
const personList = ref([])
|
||||
const showStartDate = ref(false)
|
||||
const showEndDate = ref(false)
|
||||
|
||||
const statusList = ref([
|
||||
{ value: '', label: '全部' },
|
||||
{ value: '1', label: '待服用' },
|
||||
{ value: '2', label: '已服用' },
|
||||
{ value: '3', label: '已跳过' },
|
||||
{ value: '4', label: '已过期' }
|
||||
])
|
||||
|
||||
const data = reactive({
|
||||
queryParams: {
|
||||
keys: null,
|
||||
personId: null,
|
||||
status: null,
|
||||
scheduledTimeBegin: null,
|
||||
scheduledTimeEnd: null
|
||||
}
|
||||
})
|
||||
const { queryParams } = toRefs(data)
|
||||
const windowHeight = computed(() => uni.getSystemInfoSync().windowHeight - 50)
|
||||
|
||||
const startDateText = computed(() => queryParams.value.scheduledTimeBegin ? queryParams.value.scheduledTimeBegin.substring(0, 10) : '')
|
||||
const endDateText = computed(() => queryParams.value.scheduledTimeEnd ? queryParams.value.scheduledTimeEnd.substring(0, 10) : '')
|
||||
|
||||
onLoad(() => {
|
||||
getPersonList()
|
||||
getList()
|
||||
getToday()
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
if (isShow.value) {
|
||||
listData.value = []
|
||||
pageNum.value = 1
|
||||
getList()
|
||||
getToday()
|
||||
isShow.value = false
|
||||
}
|
||||
})
|
||||
|
||||
function getPersonList() {
|
||||
listPerson({ pageNum: 1, pageSize: 100 }).then(res => {
|
||||
personList.value = res.rows || []
|
||||
})
|
||||
}
|
||||
|
||||
function getToday() {
|
||||
getTodayRecords().then(res => {
|
||||
todayRecords.value = res.data || []
|
||||
})
|
||||
}
|
||||
|
||||
function loadmore() {
|
||||
pageNum.value += 1
|
||||
if (status.value == 'loadmore') {
|
||||
getList()
|
||||
}
|
||||
}
|
||||
|
||||
function getList() {
|
||||
status.value = 'loading'
|
||||
listMedicationRecord({ pageSize: 10, pageNum: pageNum.value, ...queryParams.value }).then(res => {
|
||||
listData.value = listData.value.concat(res.rows)
|
||||
if (listData.value.length < res.total) {
|
||||
status.value = 'loadmore'
|
||||
} else {
|
||||
status.value = 'nomore'
|
||||
}
|
||||
}).catch(() => {
|
||||
status.value = 'nomore'
|
||||
})
|
||||
}
|
||||
|
||||
function selectPerson(item) {
|
||||
queryParams.value.personId = item.id
|
||||
}
|
||||
|
||||
function selectStatus(item) {
|
||||
queryParams.value.status = item.value
|
||||
}
|
||||
|
||||
function onStartDateConfirm(e) {
|
||||
queryParams.value.scheduledTimeBegin = dayjs(e.value).format('YYYY-MM-DD') + ' 00:00:00'
|
||||
showStartDate.value = false
|
||||
}
|
||||
|
||||
function onEndDateConfirm(e) {
|
||||
queryParams.value.scheduledTimeEnd = dayjs(e.value).format('YYYY-MM-DD') + ' 23:59:59'
|
||||
showEndDate.value = false
|
||||
}
|
||||
|
||||
function searchSubmit() {
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
filterPanel.value = false
|
||||
}
|
||||
|
||||
function searchBlur() {
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
}
|
||||
|
||||
function resetQuery() {
|
||||
queryParams.value.keys = ''
|
||||
queryParams.value.personId = null
|
||||
queryParams.value.status = null
|
||||
queryParams.value.scheduledTimeBegin = null
|
||||
queryParams.value.scheduledTimeEnd = null
|
||||
}
|
||||
|
||||
function formatDateTime(datetime) {
|
||||
if (!datetime) return '--'
|
||||
return datetime.substring(0, 16)
|
||||
}
|
||||
|
||||
function formatTime(datetime) {
|
||||
if (!datetime) return '--'
|
||||
return datetime.substring(11, 16)
|
||||
}
|
||||
|
||||
function getStatusClass(status) {
|
||||
const map = { '1': 'status-pending', '2': 'status-taken', '3': 'status-skipped', '4': 'status-expired' }
|
||||
return map[status] || ''
|
||||
}
|
||||
|
||||
function getStatusText(status) {
|
||||
const map = { '1': '待服用', '2': '已服用', '3': '已跳过', '4': '已过期' }
|
||||
return map[status] || '--'
|
||||
}
|
||||
|
||||
function getStatusIcon(status) {
|
||||
const map = { '1': 'clock', '2': 'checkmarkempty', '3': 'closeempty', '4': 'info' }
|
||||
return map[status] || 'clock'
|
||||
}
|
||||
|
||||
function handleTake(item) {
|
||||
uni.showModal({
|
||||
title: '确认服药',
|
||||
content: `确认已服用 ${item.shortName} ${item.dosage}${item.dosageUnit}?`,
|
||||
confirmText: '确认',
|
||||
cancelText: '取消',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
takeMedication(item.id, item.dosage, null).then(() => {
|
||||
uni.showToast({ title: '已记录', icon: 'success' })
|
||||
listData.value = []
|
||||
pageNum.value = 1
|
||||
getList()
|
||||
getToday()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function handleSkip(item) {
|
||||
uni.showModal({
|
||||
title: '跳过服药',
|
||||
content: '确定跳过本次服药?',
|
||||
confirmText: '跳过',
|
||||
confirmColor: '#faad14',
|
||||
cancelText: '取消',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
skipMedication(item.id, '用户主动跳过').then(() => {
|
||||
uni.showToast({ title: '已跳过', icon: 'none' })
|
||||
listData.value = []
|
||||
pageNum.value = 1
|
||||
getList()
|
||||
getToday()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '@/styles/health-common.scss';
|
||||
|
||||
.today-card {
|
||||
margin: 24rpx;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.today-header {
|
||||
padding: 24rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.today-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.today-count {
|
||||
font-size: 28rpx;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
}
|
||||
|
||||
.today-scroll {
|
||||
white-space: nowrap;
|
||||
padding: 0 24rpx 24rpx;
|
||||
}
|
||||
|
||||
.today-item {
|
||||
display: inline-flex;
|
||||
flex-direction: column;
|
||||
width: 200rpx;
|
||||
padding: 20rpx;
|
||||
margin-right: 16rpx;
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
border-radius: 12rpx;
|
||||
|
||||
.medicine-info {
|
||||
.medicine-name {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #fff;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.dosage {
|
||||
font-size: 24rpx;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.time-info {
|
||||
margin-top: 12rpx;
|
||||
|
||||
.time {
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.take-btn {
|
||||
margin-top: 8rpx;
|
||||
padding: 8rpx 16rpx;
|
||||
background: rgba(255, 255, 255, 0.25);
|
||||
border-radius: 20rpx;
|
||||
font-size: 22rpx;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
padding: 6rpx 16rpx;
|
||||
border-radius: 20rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
|
||||
&.status-pending {
|
||||
background: rgba(250, 173, 20, 0.15);
|
||||
color: #faad14;
|
||||
}
|
||||
|
||||
&.status-taken {
|
||||
background: rgba(82, 196, 26, 0.15);
|
||||
color: #52c41a;
|
||||
}
|
||||
|
||||
&.status-skipped {
|
||||
background: rgba(140, 140, 140, 0.15);
|
||||
color: #8c8c8c;
|
||||
}
|
||||
|
||||
&.status-expired {
|
||||
background: rgba(245, 34, 45, 0.15);
|
||||
color: #f5222d;
|
||||
}
|
||||
}
|
||||
|
||||
.card-icon {
|
||||
&.status-pending { background: #faad14; }
|
||||
&.status-taken { background: #52c41a; }
|
||||
&.status-skipped { background: #8c8c8c; }
|
||||
&.status-expired { background: #f5222d; }
|
||||
}
|
||||
|
||||
.date-range {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
padding: 0 24rpx;
|
||||
|
||||
:deep(.u-input) {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
text {
|
||||
color: #909399;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user