fix(mp): Phase 1 核心体验修复 — 咨询描述+体征校验+商城+医生端+跳转
- consultation: 添加 description 字段 + 症状描述输入 + 建议填写提醒 - health/index: 使用 validateNum 添加体征范围校验(血压/心率/血糖/体重) - mall: 隐藏未实现的积分任务空壳入口 - pkg-doctor-core: 工作台加载失败添加重试按钮和错误状态 - index: 医护人员跳转返回 null 替代 Loading 避免无用渲染
This commit is contained in:
@@ -5,6 +5,7 @@ import { safeNavigateTo } from '@/utils/navigate';
|
||||
import { useAuthStore } from '../../stores/auth';
|
||||
import { useElderClass } from '../../hooks/useElderClass';
|
||||
import { findThreshold, inputVitalSign, type HealthThreshold } from '../../services/health';
|
||||
import { validateNum } from '../../utils/validate';
|
||||
import Loading from '../../components/Loading';
|
||||
import ErrorState from '../../components/ErrorState';
|
||||
import GuestGuard from '../../components/GuestGuard';
|
||||
@@ -113,6 +114,10 @@ export default function Health() {
|
||||
const sys = parseFloat(systolic);
|
||||
const dia = parseFloat(diastolic);
|
||||
if (!sys || !dia) { Taro.showToast({ title: '请填写完整', icon: 'none' }); return; }
|
||||
const sysErr = validateNum(sys, '收缩压', { min: 60, max: 250 });
|
||||
if (sysErr) { Taro.showToast({ title: sysErr, icon: 'none' }); return; }
|
||||
const diaErr = validateNum(dia, '舒张压', { min: 40, max: 150 });
|
||||
if (diaErr) { Taro.showToast({ title: diaErr, icon: 'none' }); return; }
|
||||
await inputVitalSign(patientId, {
|
||||
indicator_type: 'blood_pressure',
|
||||
value: sys,
|
||||
@@ -125,6 +130,8 @@ export default function Health() {
|
||||
case 'heart_rate': {
|
||||
const val = parseFloat(heartRateVal);
|
||||
if (!val) { Taro.showToast({ title: '请填写心率', icon: 'none' }); return; }
|
||||
const err = validateNum(val, '心率', { min: 30, max: 220 });
|
||||
if (err) { Taro.showToast({ title: err, icon: 'none' }); return; }
|
||||
await inputVitalSign(patientId, { indicator_type: 'heart_rate', value: val });
|
||||
setHeartRateVal('');
|
||||
break;
|
||||
@@ -132,6 +139,8 @@ export default function Health() {
|
||||
case 'blood_sugar': {
|
||||
const val = parseFloat(sugarVal);
|
||||
if (!val) { Taro.showToast({ title: '请填写血糖值', icon: 'none' }); return; }
|
||||
const err = validateNum(val, '血糖', { min: 1.0, max: 33.3 });
|
||||
if (err) { Taro.showToast({ title: err, icon: 'none' }); return; }
|
||||
const bsType = sugarPeriod === 'fasting' ? 'blood_sugar_fasting' : 'blood_sugar_postprandial';
|
||||
await inputVitalSign(patientId, { indicator_type: bsType, value: val });
|
||||
setSugarVal('');
|
||||
@@ -140,6 +149,8 @@ export default function Health() {
|
||||
case 'weight': {
|
||||
const val = parseFloat(weightVal);
|
||||
if (!val) { Taro.showToast({ title: '请填写体重', icon: 'none' }); return; }
|
||||
const err = validateNum(val, '体重', { min: 20, max: 300 });
|
||||
if (err) { Taro.showToast({ title: err, icon: 'none' }); return; }
|
||||
await inputVitalSign(patientId, { indicator_type: 'weight', value: val });
|
||||
setWeightVal('');
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user