fix(miniprogram): 审计修复 — P0/P1 共 16 个问题
P0 功能阻断: - 修复 login→bindPhone openid 状态传递断裂 - 首页健康卡片对接 useHealthStore 真实数据 - 血压录入改为收缩压/舒张压双输入 - 快捷服务路径修正(报告→/pages/report、随访→/pages/followup) P1 类型安全 + 组件: - 替换所有 <input>/<image>/<textarea> 为 Taro 组件 - service 层 any 类型全部替换(Doctor/DoctorSchedule/IndicatorDetail/FollowUpContent/PatientUpdateInput) - 预约详情数据传递简化为纯 Storage 缓存 - Article 接口添加 author 字段
This commit is contained in:
@@ -17,27 +17,46 @@ const INDICATORS = [
|
||||
export default function HealthInput() {
|
||||
const [indicatorIdx, setIndicatorIdx] = useState(0);
|
||||
const [value, setValue] = useState('');
|
||||
const [systolic, setSystolic] = useState('');
|
||||
const [diastolic, setDiastolic] = useState('');
|
||||
const [note, setNote] = useState('');
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
const { currentPatient } = useAuthStore();
|
||||
|
||||
const handleSubmit = async () => {
|
||||
if (!value) {
|
||||
Taro.showToast({ title: '请输入数值', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!currentPatient) {
|
||||
Taro.showToast({ title: '请先选择就诊人', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
const currentIndicator = INDICATORS[indicatorIdx].value;
|
||||
|
||||
setSubmitting(true);
|
||||
try {
|
||||
await inputVitalSign(currentPatient.id, {
|
||||
indicator_type: INDICATORS[indicatorIdx].value,
|
||||
value: parseFloat(value),
|
||||
note: note || undefined,
|
||||
});
|
||||
if (currentIndicator === 'blood_pressure') {
|
||||
if (!systolic || !diastolic) {
|
||||
Taro.showToast({ title: '请输入收缩压和舒张压', icon: 'none' });
|
||||
setSubmitting(false);
|
||||
return;
|
||||
}
|
||||
await inputVitalSign(currentPatient.id, {
|
||||
indicator_type: 'blood_pressure',
|
||||
value: parseFloat(systolic),
|
||||
extra: { systolic: parseFloat(systolic), diastolic: parseFloat(diastolic) },
|
||||
note: note || undefined,
|
||||
});
|
||||
} else {
|
||||
if (!value) {
|
||||
Taro.showToast({ title: '请输入数值', icon: 'none' });
|
||||
setSubmitting(false);
|
||||
return;
|
||||
}
|
||||
await inputVitalSign(currentPatient.id, {
|
||||
indicator_type: currentIndicator,
|
||||
value: parseFloat(value),
|
||||
note: note || undefined,
|
||||
});
|
||||
}
|
||||
Taro.showToast({ title: '录入成功', icon: 'success' });
|
||||
setTimeout(() => Taro.navigateBack(), 1000);
|
||||
} catch (e: any) {
|
||||
@@ -64,16 +83,41 @@ export default function HealthInput() {
|
||||
</Picker>
|
||||
</View>
|
||||
|
||||
<View className='input-section'>
|
||||
<Text className='input-label'>数值</Text>
|
||||
<Input
|
||||
type='digit'
|
||||
className='input-field'
|
||||
placeholder='请输入数值'
|
||||
value={value}
|
||||
onInput={(e) => setValue(e.detail.value)}
|
||||
/>
|
||||
</View>
|
||||
{INDICATORS[indicatorIdx].value === 'blood_pressure' ? (
|
||||
<>
|
||||
<View className='input-section'>
|
||||
<Text className='input-label'>收缩压</Text>
|
||||
<Input
|
||||
type='digit'
|
||||
className='input-field'
|
||||
placeholder='如 120'
|
||||
value={systolic}
|
||||
onInput={(e) => setSystolic(e.detail.value)}
|
||||
/>
|
||||
</View>
|
||||
<View className='input-section'>
|
||||
<Text className='input-label'>舒张压</Text>
|
||||
<Input
|
||||
type='digit'
|
||||
className='input-field'
|
||||
placeholder='如 80'
|
||||
value={diastolic}
|
||||
onInput={(e) => setDiastolic(e.detail.value)}
|
||||
/>
|
||||
</View>
|
||||
</>
|
||||
) : (
|
||||
<View className='input-section'>
|
||||
<Text className='input-label'>数值</Text>
|
||||
<Input
|
||||
type='digit'
|
||||
className='input-field'
|
||||
placeholder='请输入数值'
|
||||
value={value}
|
||||
onInput={(e) => setValue(e.detail.value)}
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
|
||||
<View className='input-section'>
|
||||
<Text className='input-label'>备注(可选)</Text>
|
||||
|
||||
Reference in New Issue
Block a user