This commit is contained in:
左哥 2025-06-08 22:57:41 +08:00
parent 8b950b516b
commit 6f3401f501
20 changed files with 450 additions and 81 deletions

View File

@ -56,6 +56,10 @@
"root": "pages/article",
"name": "article",
"pages": ["index"]
},{
"root": "pages/articleList",
"name": "articleList",
"pages": ["index"]
},{
"root": "pages/therapeuticRegimen",
"name": "therapeuticRegimen",

View File

@ -18,6 +18,7 @@ Page({
},
mode: '',
dateVisible: false,
minuteVisible: false,
date: new Date('2021-12-23').getTime(), // 支持时间戳传入
dateText: '',
filter(type, options) {
@ -107,6 +108,11 @@ Page({
},
showPickertime(e){
this.setData({
minuteVisible: true,
});
},
handleSuccess(e) {

View File

@ -8,7 +8,8 @@
"t-button": "tdesign-miniprogram/button/button",
"t-upload": "tdesign-miniprogram/upload/upload",
"t-radio": "tdesign-miniprogram/radio/radio",
"t-radio-group": "tdesign-miniprogram/radio-group/radio-group"
"t-radio-group": "tdesign-miniprogram/radio-group/radio-group",
"t-tag": "tdesign-miniprogram/tag/tag"
},
"navigationBarTitleText": "用药方案"
}

View File

@ -28,6 +28,9 @@
line-height: 40rpx;
margin: 0 8rpx 16rpx;
}
.none{
opacity: 0;
}
.box{
display: flex;
justify-content: space-between;
@ -37,4 +40,35 @@
.t-overlay{
top: 0!important;
}
.yp-item{
border: 2rpx solid #efefef;
border-radius: 12rpx;
overflow: hidden;
}
.administration-time{
display: flex;
justify-content: space-between;
padding: 40rpx 0;
padding-left: 40rpx;
}
.radio-group{
width: 300rpx;
}
.add-btn{
margin-top: 40rpx;
}
.delete-btn{
text-align: right;
margin-bottom: 10rpx;
}
.reminder-time{
display: flex;
justify-content: space-between;
margin-bottom: 20rpx;
.label{
flex: 1;
line-height: 130rpx;
}
}
}

View File

@ -12,7 +12,7 @@
<view class="dark">
<view class="input-example">
<view class="input-example__label"> 用药周期 </view>
<t-input placeholder="请输入" bindtap="showPicker" size="small" borderless="{{true}}" style="{{style}}" data-mode="birth" suffixIcon="{{ { name: 'calendar-1', ariaLabel: '通讯录' } }}" />
<t-input placeholder="请输入" bindtap="showPicker" size="small" borderless="{{true}}" style="{{style}}" data-mode="birth" suffixIcon="{{ { name: 'calendar-1', ariaLabel: '通讯录' } }}" />
</view>
</view>
@ -20,20 +20,63 @@
<t-col span="12">
<view class="dark">
<view class="input-example">
<view class="input-example__label"> 体重kg </view>
<t-input placeholder="请输入" bindtap="showPicker" size="small" borderless="{{true}}" style="{{style}}" data-mode="birth" suffixIcon="{{ { name: 'calendar-1', ariaLabel: '通讯录' } }}" />
<view class="input-example__label none"> 体重kg </view>
<t-input placeholder="请输入" bindtap="showPicker" size="small" borderless="{{true}}" style="{{style}}" data-mode="birth" suffixIcon="{{ { name: 'calendar-1', ariaLabel: '通讯录' } }}" />
</view>
</view>
</t-col>
</t-row>
</t-row>
</view>
<view class="input-example">
<view class="input-example__label"> 药品信息 </view>
</view>
<t-input label="药品名称" placeholder="请输入文字" align="right" />
<t-input label="单次用药剂量" placeholder="请输入文字" align="right" />
<view class="delete-btn">
<t-tag class="margin-16" variant="light" theme="danger">删除</t-tag>
</view>
<view class="yp-item">
<t-input label="药品名称" placeholder="请输入" align="right" />
<t-input label="单次用药剂量" placeholder="请输入" align="right" />
<t-input label="单次频次(每日次数)" placeholder="请输入" align="right" />
<view class="administration-time">
<view>饭前/饭后</view>
<view class="radio-group">
<t-radio-group default-value="0" borderless t-class="box">
<t-radio block="{{false}}" label="饭前" value="0" />
<t-radio block="{{false}}" label="饭后" value="1" />
</t-radio-group>
</view>
</view>
</view>
<t-button class="add-btn" theme="primary" content="" block>+添加用药</t-button>
</view>
<view class="therapeuticRegimen-item">
<view class="title">用药时间提醒</view>
<view class="reminder-time">
<view class="label">早上</view>
<t-input placeholder="请输入" bindtap="showPickertime" size="small" borderless="{{true}}" style="{{style}}" data-mode="birth" suffixIcon="{{ { name: 'calendar-1', ariaLabel: '通讯录' } }}" />
</view>
<view class="reminder-time">
<view class="label">中午</view>
<t-input placeholder="请输入" bindtap="showPickertime" size="small" borderless="{{true}}" style="{{style}}" data-mode="birth" suffixIcon="{{ { name: 'calendar-1', ariaLabel: '通讯录' } }}" />
</view>
<view class="reminder-time">
<view class="label">晚上</view>
<t-input placeholder="请输入" bindtap="showPickertime" size="small" borderless="{{true}}" style="{{style}}" data-mode="birth" suffixIcon="{{ { name: 'calendar-1', ariaLabel: '通讯录' } }}" />
</view>
</view>
<t-button class="add-btn" theme="primary" content="" block>保存</t-button>
<t-date-time-picker auto-close bind:cancel="hidePicker" bind:change="onPickerChange" cancelBtn="取消" confirmBtn="确认" data-mode="birth" defaultValue="{{personInfo.birth}}" end="{{birthEnd}}" filter="{{birthFilter}}" format="YYYY-MM-DD" mode="date" popup-props="{{ { usingCustomNavbar: true } }}" start="{{birthStart}}" title="选择生日" value="{{personInfo.birth}}" visible="{{birthVisible}}" />
<!-- 时分 -->
<t-date-time-picker
title="选择时间"
visible="{{minuteVisible}}"
mode="{{['null', 'minute']}}"
start="{{start}}"
value="{{minute}}"
format="HH:mm"
bindchange="onConfirm"
bindpick="onColumnChange"
bindcancel="hidePicker"
/>
</view>

View File

@ -6,14 +6,17 @@ Page({
* 页面的初始数据
*/
data: {
article:{}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getList()
const data = JSON.parse(wx.getStorageSync('article'))
this.setData({
article: data
})
},

View File

@ -2,4 +2,11 @@
.rich{
padding: 28rpx;
background-color: #fff;
min-height: 100vh;
.title{
font-size: 32rpx;
font-weight: bold;
margin-bottom: 40rpx;
}
}

View File

@ -1,5 +1,7 @@
<!--pages/article/index.wxml-->
<view class="rich">
<view class="title">
{{article.title}}
</view>
<rich-text nodes="{{article.content}}"></rich-text>
</view>

View File

@ -0,0 +1,92 @@
// pages/articleList/index.js
import request from '~/api/request';
Page({
/**
* 页面的初始数据
*/
data: {
articles:[]
},
// Helper function to strip HTML tags and convert to plain text
stripHtml(html) {
if (!html) return '';
return html.replace(/<[^>]*>/g, '');
},
async getList(){
const res = await request('patient/articles', 'get', { title: '', page: 1, page_size: 10 });
// Convert rich text content to plain text for each article
const articlesWithPlainText = res.list.map(article => ({
...article,
contentText: this.stripHtml(article.content)
}));
this.setData({
articles: articlesWithPlainText
})
},
async preview(e){
console.log(e.currentTarget.dataset.index)
const index = e.currentTarget.dataset.index
await wx.setStorageSync('article',JSON.stringify(this.data.articles[index]));
wx.navigateTo({
url: '/pages/article/index',
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getList()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,6 @@
{
"usingComponents": {
"t-search": "tdesign-miniprogram/search/search"
},
"navigationBarTitleText": "健康教育"
}

View File

@ -0,0 +1,39 @@
/* pages/articleList/index.wxss */
.article-page {
height: 100vh;
padding: 28rpx;
background-color: #fff;
.example-search {
background-color: #fff;
}
.example-search:not(:last-child) {
margin-bottom: 32rpx;
}
.article-item {
background-color: #f3f3f3;
padding: 20rpx;
border-radius: 12rpx;
max-height: 200rpx;
.article-title {
font-weight: bold;
font-size: 32rpx;
margin-bottom: 20rpx;
}
.article-content {
font-size: 28rpx;
font-size: 26rpx;
line-height: 36rpx;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
word-break: break-word;
}
}
}

View File

@ -0,0 +1,14 @@
<!--pages/articleList/index.wxml-->
<view class="article-page">
<scroll-view>
<view class="example-search">
<t-search placeholder="搜索文章" />
</view>
<view class="article-item" wx:for="{{articles}}" wx:key="id" data-index="{{index}}" bindtap="preview">
<view class="article-title">
{{item.title}}
</view>
<view class="article-content">{{item.contentText}}</view>
</view>
</scroll-view>
</view>

View File

@ -1,5 +1,5 @@
import * as echarts from '../../ec-canvas/echarts.min';
import request from '~/api/request';
const app = getApp();
function initChart(canvas, width, height, dpr) {
@ -146,8 +146,55 @@ Page({
ec2: {
onInit: initChart2
},
activeIndex: 0
activeIndex: 0,
sfData:{},
sfListLength: 0,
article:{},
articlesLength: 0
},
// Helper function to strip HTML tags and convert to plain text
stripHtml(html) {
if (!html) return '';
return html.replace(/<[^>]*>/g, '');
},
async getSfList(){
const res = await request('patient/follow_plans', 'get', {
page: 1,
page_size: 10,
type: 1
})
// Calculate days between today and plan_date
const today = new Date()
const planDate = new Date(res.list[0].plan_date)
const diffTime = planDate - today
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24))
this.setData({
sfListLength: res.total,
sfData: {
...res.list[0],
daysUntilPlan: diffDays
}
})
const res2 = await request('patient/articles', 'get', { title: '', page: 1, page_size: 10 });
// Convert rich text content to plain text
const plainTextContent = this.stripHtml(res2.list[0].content);
this.setData({
articlesLength: res2.total,
article: {
...res2.list[0],
contentText: plainTextContent
}
})
},
onLoad(){
this.getSfList()
},
changeChart(e) {
const index = e.currentTarget.dataset.index;
console.log(index);
@ -168,5 +215,16 @@ Page({
wx.navigateTo({
url: '/pages/emergency/index',
})
}
},
toArticle(){
wx.navigateTo({
url: '/pages/articleList/index',
})
},
async toArticleDelit(){
await wx.setStorageSync('article',JSON.stringify(this.data.article));
wx.navigateTo({
url: '/pages/article/index',
})
},
});

View File

@ -9,40 +9,48 @@
// height: calc(100% - @nav-bar-height);
padding: 30rpx;
padding-bottom: 160rpx;
.item-content{
.item-content {
background-color: #fff;
border-radius: 12rpx;
padding: 30rpx;
margin-bottom: 30rpx;
.item-title{
.item-title {
font-size: 32rpx;
font-weight: bold;
color: #323030;
}
.echarts-canvas-container{
.echarts-canvas-container {
width: 100%;
height: 600rpx;
}
.echarts-canvas{
.echarts-canvas {
width: 100%;
height: 100%;
}
.echarts-legend{
.echarts-legend {
display: flex;
margin-bottom: 20rpx;
margin-top: 20rpx;
view{
view {
margin-right: 20rpx;
}
.active{
.active {
color: #0091cc;
text-decoration: underline;
}
}
.item-title{
.item-title {
position: relative;
.item-title-right-text{
.item-title-right-text {
position: absolute;
right: 0;
top: 0;
@ -50,40 +58,48 @@
font-size: 24rpx;
}
}
.item-box{
.item-box {
background-color: #f5f5f5;
border-radius: 12rpx;
padding: 26rpx;
margin-top: 20rpx;
position: relative;
.item-box-title{
.item-box-title {
display: flex;
justify-content: space-between;
box-sizing: border-box;
margin-bottom: 20rpx;
.item-box-title-left{
.item-box-title-left {
font-size: 28rpx;
color: #323030;
}
.item-box-title-right{
.item-box-title-right {
font-size: 24rpx;
color: #949798;
}
}
.drug-name{
.drug-name {
font-size: 30rpx;
color: #323030;
margin-bottom: 8rpx;
}
.drug-usage{
.drug-usage {
font-size: 26rpx;
color: #323030;
margin-bottom: 20rpx;
}
.follow-up-itme{
.follow-up-itme {
font-size: 24rpx;
}
.follow-itme-ed{
.follow-itme-ed {
color: #0091cc;
font-size: 30rpx;
position: absolute;
@ -91,16 +107,27 @@
top: 50%;
transform: translateY(-50%);
}
.article-content {
margin-top: 10rpx;
font-size: 26rpx;
line-height: 36rpx;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
word-break: break-word;
}
}
}
}
}
.emergency-access{
.emergency-access {
position: fixed;
right: 40rpx;
bottom: 220rpx;
@ -113,5 +140,5 @@
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0px 12px 32px 4px rgba(0, 0, 0, .04), 0px 8px 20px rgba(0, 0, 0, .08) ;
box-shadow: 0px 12px 32px 4px rgba(0, 0, 0, .04), 0px 8px 20px rgba(0, 0, 0, .08);
}

View File

@ -44,38 +44,33 @@
<t-button theme="primary" block>打卡</t-button>
</view>
</view>
<view class="item-content">
<view class="item-content" wx:if="{{sfListLength > 0}}">
<view class="item-title">随访提醒
</view>
<view class="item-box">
<view class="drug-name">
术后一个月随访
{{sfData.plan_name}}
</view>
<!-- 药品名字 -->
<view class="follow-up-itme">
随访时间:2025-05-25
随访时间:{{sfData.plan_date}}
</view>
<text class="follow-itme-ed">50天后</text>
<text class="follow-itme-ed">{{sfData.daysUntilPlan}}天后</text>
</view>
</view>
<view class="item-content">
<view class="item-content" wx:if="articlesLength > 0">
<view class="item-title">健康推送
<view class="item-title-right-text">
<view class="item-title-right-text" bind:tap="toArticle">
更多
</view>
</view>
<view class="item-box">
<view class="item-box" bind:tap="toArticleDelit">
<view class="drug-name">
关于配方奶粉的选择
{{article.title}}
</view>
<!-- 药品名字 -->
<view class="follow-up-itme">
关于配方奶粉的选择
含 MCT(中链脂肪)奶粉或粉剂有利于胆闭宝宝脂肪酸及维生素的吸收,改善营养状况。待退黄后根据营养科医生指导,可逐步转回母乳喂养,母乳不足者用普通......
<view class="article-content">
{{article.contentText}}
</view>
</view>
</view>

View File

@ -1,31 +1,45 @@
// pages/clockIn/index.js
import request from '~/api/request';
Page({
/**
* 页面的初始数据
*/
data: {
newTime: ''
dataList: [],
},
async getList(){
const res = await request('patient/follow_plans', 'get', {
page: 1,
page_size: 100,
type: 2
})
// Process the list to check dates
const processedList = res.list.map(item => {
const planDate = new Date(item.plan_date);
const today = new Date();
const diffTime = planDate - today;
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
// If within 7 days and status is 1, update to 2
if (diffDays <= 7 && diffDays >= 0 && item.status === 1) {
return { ...item, status: 3 };
}
return item;
});
this.setData({
dataList: processedList
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const now = new Date()
const year = now.getFullYear()
const month = now.getMonth() + 1
const day = now.getDate()
const hours = now.getHours()
const minutes = now.getMinutes()
const seconds = now.getSeconds()
this.getList()
const formattedTime = `${year}${month.toString().padStart(2, '0')}${day.toString().padStart(2, '0')}`
this.setData({
newTime: formattedTime
})
},
/**

View File

@ -1,14 +1,17 @@
<!--pages/clockIn/index.wxml-->
<view class="clockin">
<view class="clockin-item">
<view class="clockin-item" wx:for="{{dataList}}" wx:key="id">
<view class="item-top">
<text>术后1个月随访</text>
<t-tag class="margin-16" variant="light" theme="success">已完成</t-tag>
<text>{{item.plan_name}}</text>
<t-tag class="margin-16" variant="light" theme="success" wx:if="{{item.status == 2}}">已完成</t-tag>
<t-tag class="margin-16" variant="light" wx:if="{{item.status == 1}}">未开始</t-tag>
<t-tag class="margin-16" variant="light" theme="primary" wx:if="{{item.status == 3}}">待开始</t-tag>
</view>
<view class="dose">随访时间2025年5月20日</view>
<t-button theme="primary" block bindtap="toQuestionnaire">填写随访问卷</t-button>
<view class="dose">随访时间:{{item.plan_date}}</view>
<t-button theme="primary" block bindtap="toQuestionnaire" wx:if="{{item.status == 2}}">填写随访问卷</t-button>
<t-button bindtap="toRegister" theme="primary" block wx:if="{{item.status == 3}}">预约挂号</t-button>
</view>
<view class="clockin-item">
<!-- <view class="clockin-item">
<view class="item-top">
<text>术后2个月随访</text>
<t-tag class="margin-16" variant="light" theme="primary">待开始</t-tag>
@ -36,7 +39,7 @@
<t-tag class="margin-16" variant="light">未开始</t-tag>
</view>
<view class="dose">随访时间2025年5月20日</view>
</view>
</view> -->
<view class="footer-example">
<t-button theme="primary" block bindtap="toQuestionnaire">添加随访</t-button>
</view>

View File

@ -39,7 +39,7 @@ Page({
settingList: [
{ label: '用药方案', path: '/pages/therapeuticRegimen/index', icon: 'service', type: 'text' },
{ label: '健康教育', path: '/pages/article/index', icon: 'setting', type: 'text' },
{ label: '健康教育', path: '/pages/articleList/index', icon: 'setting', type: 'text' },
],
},

View File

@ -3,8 +3,14 @@ import request from '~/api/request';
Page({
data: {
personInfo: {
name: '',
gender: 0,
username: '',
sex: 0,
age: '',
id_number: '',
birthday: '',
operative_date: '',
birth: '',
address: [],
introduction: '',

View File

@ -3,12 +3,26 @@
"miniprogram": {
"list": [
{
"name": "pages/AddTherapeuticRegimen/index",
"pathName": "pages/AddTherapeuticRegimen/index",
"name": "pages/articleList/index",
"pathName": "pages/articleList/index",
"query": "",
"scene": null,
"launchMode": "default"
},
{
"name": "pages/AddTherapeuticRegimen/index",
"pathName": "pages/AddTherapeuticRegimen/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "pages/AddTherapeuticRegimen/index",
"pathName": "pages/AddTherapeuticRegimen/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "pages/therapeuticRegimen/index",
"pathName": "pages/therapeuticRegimen/index",
@ -107,6 +121,7 @@
},
"libVersion": "3.8.5",
"setting": {
"urlCheck": false
"urlCheck": false,
"compileHotReLoad": false
}
}