Compare commits

..

2 Commits

Author SHA1 Message Date
左哥
1e62c57452 sss 2025-07-10 22:13:21 +08:00
左哥
67229cbd61 sdsd 2025-07-10 22:11:05 +08:00
10 changed files with 112 additions and 41 deletions

View File

@ -36,6 +36,10 @@ function request(url, method = 'GET', data = {}) {
} }
reject(res.data); reject(res.data);
} }
wx.showToast({
title: res.data.message,
icon: 'none'
});
reject(res.data); reject(res.data);
} else { } else {
resolve(res.data); resolve(res.data);

View File

@ -303,10 +303,11 @@ Page({
const policyData = await request('admin/policy_token', 'post') const policyData = await request('admin/policy_token', 'post')
const res = JSON.parse(policyData.token) const res = JSON.parse(policyData.token)
const fileNameWithExt = file.path.split('/').pop(); // hello.png
const fileName = fileNameWithExt.split('.').slice(0, -1).join('.'); // hello
const formData = { const formData = {
key: 'upload_file/' + file.name, //上传文件名称 key: 'upload_file/' + fileName, //上传文件名称
policy: res.policy, //表单域 policy: res.policy, //表单域
'x-oss-signature-version': res.x_oss_signature_version, //指定签名的版本和算法 'x-oss-signature-version': res.x_oss_signature_version, //指定签名的版本和算法
'x-oss-credential': res.x_oss_credential, //指明派生密钥的参数集 'x-oss-credential': res.x_oss_credential, //指明派生密钥的参数集
@ -327,7 +328,7 @@ Page({
success(res) { success(res) {
console.log('上传响应:', res); console.log('上传响应:', res);
if (res.statusCode === 200) { if (res.statusCode === 200) {
callback(null, 'https://image-fudan.oss-cn-beijing.aliyuncs.com/upload_file/'+ file.name); // 上传成功 callback(null, 'https://image-fudan.oss-cn-beijing.aliyuncs.com/upload_file/'+ fileName); // 上传成功
} else { } else {
console.error('上传失败,状态码:', res.statusCode); console.error('上传失败,状态码:', res.statusCode);
console.error('失败响应:', res); console.error('失败响应:', res);
@ -376,7 +377,7 @@ Page({
} }
}); });
}, },
handleDelete(){ handleDelete(e){
this.setData({ this.setData({
imageFile: '' imageFile: ''
}); });

View File

@ -225,7 +225,7 @@ Page({
data.nutritional_indicator_image = data.nutritional_indicator_image.length > 0 ? data.nutritional_indicator_image.join(',') : '' data.nutritional_indicator_image = data.nutritional_indicator_image.length > 0 ? data.nutritional_indicator_image.join(',') : ''
data.is_have_cyst = data.is_have_cyst ? Number(data.is_have_cyst) : 0 data.is_have_cyst = data.is_have_cyst ? Number(data.is_have_cyst) : 0
data.is_have_ascites = data.is_have_ascites ? Number(data.is_have_ascites) : 0 data.is_have_ascites = data.is_have_ascites ? Number(data.is_have_ascites) : 0
await request('patient/follow_questionnaire', 'post',{planId: this.planId, ...data}) await request('patient/follow_questionnaire', 'post',{plan_id: Number(this.planId), ...data})
wx.showToast({ wx.showToast({
title: '提交成功', title: '提交成功',
icon: 'success', icon: 'success',
@ -250,9 +250,11 @@ Page({
const policyData = await request('admin/policy_token', 'post') const policyData = await request('admin/policy_token', 'post')
const res = JSON.parse(policyData.token) const res = JSON.parse(policyData.token)
const fileNameWithExt = file.path.split('/').pop(); // hello.png
const fileName = fileNameWithExt.split('.').slice(0, -1).join('.'); // hello
const formData = { const formData = {
key: 'upload_file/' + file.name, //上传文件名称 key: 'upload_file/' + fileName, //上传文件名称
policy: res.policy, //表单域 policy: res.policy, //表单域
'x-oss-signature-version': res.x_oss_signature_version, //指定签名的版本和算法 'x-oss-signature-version': res.x_oss_signature_version, //指定签名的版本和算法
'x-oss-credential': res.x_oss_credential, //指明派生密钥的参数集 'x-oss-credential': res.x_oss_credential, //指明派生密钥的参数集
@ -273,7 +275,7 @@ Page({
success(res) { success(res) {
console.log('上传响应:', res); console.log('上传响应:', res);
if (res.statusCode === 200) { if (res.statusCode === 200) {
callback(null, 'https://image-fudan.oss-cn-beijing.aliyuncs.com/upload_file/'+ file.name); // 上传成功 callback(null, 'https://image-fudan.oss-cn-beijing.aliyuncs.com/upload_file/'+ fileName); // 上传成功
} else { } else {
console.error('上传失败,状态码:', res.statusCode); console.error('上传失败,状态码:', res.statusCode);
console.error('失败响应:', res); console.error('失败响应:', res);
@ -289,6 +291,11 @@ Page({
}, },
handleUpload(e) { handleUpload(e) {
const { mode } = e.currentTarget.dataset;
if(this.data.form[mode].length >= 9){
wx.showToast({ title: '最多上传9张图片!', icon: 'none' });
return
}
wx.chooseImage({ wx.chooseImage({
count: 1, // 选择一个文件 count: 1, // 选择一个文件
type: 'all', // 支持所有类型的文件 type: 'all', // 支持所有类型的文件
@ -341,7 +348,7 @@ Page({
imageVisible: false imageVisible: false
}) })
}, },
handleDelete(){ handleDelete(e){
const { mode, index } = e.currentTarget.dataset; const { mode, index } = e.currentTarget.dataset;
let arr = this.data.form[mode] let arr = this.data.form[mode]
arr.splice(index, 1) arr.splice(index, 1)
@ -368,10 +375,28 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
console.log(options)
this.planId = options.planId this.planId = options.planId
this.setData({
['form.follow_name']: options.name,
['form.follow_date']: options.time
})
this.getDetail()
}, },
async getDetail(){
const res = await request('patient/questionnaire_info', 'post',{patient_id : 0, questionnaire_id: Number(this.planId)})
const data = res.data
data.liver_function_image = data.liver_function_image ? data.liver_function_image.split(',') : []
data.b_mode_image = data.b_mode_image ? data.b_mode_image.split(',') : []
data.blood_routine_image = data.blood_routine_image ? data.blood_routine_image.split(',') : []
data.coagulation_function_image = data.coagulation_function_image ? data.coagulation_function_image.split(',') : []
data.mdt_image = data.mdt_image ? data.mdt_image.split(',') : []
data.nutritional_indicator_image = data.nutritional_indicator_image ? data.nutritional_indicator_image.split(',') : []
this.setData({
form: data
})
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */

View File

@ -46,7 +46,7 @@
</view> </view>
<view class="input-example"> <view class="input-example">
<view class="">头围cm</view> <view class="input-example__label">头围cm</view>
<t-input placeholder="请输入" bind:change="onInput" value="{{form.head_circumference}}" data-key="head_circumference" borderless="{{true}}" style="{{style}}" <t-input placeholder="请输入" bind:change="onInput" value="{{form.head_circumference}}" data-key="head_circumference" borderless="{{true}}" style="{{style}}"
type="digit" /> type="digit" />
</view> </view>

View File

@ -23,7 +23,7 @@ Page({
async getCode(){ async getCode(){
if (!this.data.phoneNumber) { if (!this.data.phoneNumber) {
wx.showToast({ wx.showToast({
title: '请输入手机号', title: '手机号码不能为空',
icon: 'none' icon: 'none'
}); });
return; return;
@ -31,7 +31,7 @@ Page({
// 验证手机号格式 // 验证手机号格式
if (!/^1[3-9]\d{9}$/.test(this.data.phoneNumber)) { if (!/^1[3-9]\d{9}$/.test(this.data.phoneNumber)) {
wx.showToast({ wx.showToast({
title: '请输入正确的手机号', title: '手机号码格式不正确',
icon: 'none' icon: 'none'
}); });
return; return;
@ -79,7 +79,7 @@ Page({
// 验证手机号 // 验证手机号
if (!this.data.phoneNumber) { if (!this.data.phoneNumber) {
wx.showToast({ wx.showToast({
title: '请输入手机号', title: '手机号码不能为空',
icon: 'none' icon: 'none'
}); });
return; return;
@ -87,7 +87,7 @@ Page({
// 验证手机号格式 // 验证手机号格式
if (!/^1[3-9]\d{9}$/.test(this.data.phoneNumber)) { if (!/^1[3-9]\d{9}$/.test(this.data.phoneNumber)) {
wx.showToast({ wx.showToast({
title: '请输入正确的手机号', title: '手机号码格式不正确',
icon: 'none' icon: 'none'
}); });
return; return;
@ -95,24 +95,28 @@ Page({
// 验证验证码 // 验证验证码
if (!this.data.code) { if (!this.data.code) {
wx.showToast({ wx.showToast({
title: '请输入验证码', title: '验证码不能为空',
icon: 'none' icon: 'none'
}); });
return; return;
} }
// 验证验证码格式假设验证码为6位数字 // 验证验证码格式假设验证码为6位数字
if (!/^\d{6}$/.test(this.data.code)) { // if (!/^\d{6}$/.test(this.data.code)) {
wx.showToast({ // wx.showToast({
title: '请输入6位数字验证码', // title: '请输入6位数字验证码',
icon: 'none' // icon: 'none'
}); // });
return; // return;
} // }
const res = await request('patient/code_login', 'post', { const res = await request('patient/code_login', 'post', {
code: this.data.code, code: this.data.code,
mobile: this.data.phoneNumber mobile: this.data.phoneNumber
}); });
wx.showToast({
title: '登录成功',
icon: 'success'
});
await wx.setStorageSync('access_token', res.token); await wx.setStorageSync('access_token', res.token);
if (res.is_personal_information_complete) { if (res.is_personal_information_complete) {
wx.switchTab({ wx.switchTab({

View File

@ -101,9 +101,9 @@ Page({
}, },
toQuestionnaire(e) { toQuestionnaire(e) {
const id = e.currentTarget.dataset.id const { id, time, name } = e.currentTarget.dataset
wx.navigateTo({ wx.navigateTo({
url: '/pages/followUp/index?planId='+id, url: `/pages/followUp/index?planId=${id}&name=${name}&time=${time}` ,
}) })
}, },
toRegister() { toRegister() {

View File

@ -16,7 +16,7 @@
</view> </view>
<view class="dose">{{item.plan_name}}</view> <view class="dose">{{item.plan_name}}</view>
<t-button theme="primary" block bindtap="toQuestionnaire" data-id="{{item.id}}" wx:if="{{item.status == 2}}">填写随访问卷</t-button> <t-button theme="primary" block bindtap="toQuestionnaire" data-id="{{item.id}}" data-time="{{item.plan_date}}" data-name="{{item.plan_name}}" wx:if="{{item.status == 2}}">填写随访问卷</t-button>
<t-button bindtap="toRegister" theme="primary" block wx:if="{{item.status == 3}}">预约挂号</t-button> <t-button bindtap="toRegister" theme="primary" block wx:if="{{item.status == 3}}">预约挂号</t-button>
</view> </view>

View File

@ -38,10 +38,11 @@ async uploadFileToOSS(file, callback) {
const policyData = await request('admin/policy_token', 'post') const policyData = await request('admin/policy_token', 'post')
const res = JSON.parse(policyData.token) const res = JSON.parse(policyData.token)
const fileNameWithExt = file.path.split('/').pop(); // hello.png
const fileName = fileNameWithExt.split('.').slice(0, -1).join('.'); // hello
const formData = { const formData = {
key: 'upload_file/' + file.name, //上传文件名称 key: 'upload_file/' + fileName, //上传文件名称
policy: res.policy, //表单域 policy: res.policy, //表单域
'x-oss-signature-version': res.x_oss_signature_version, //指定签名的版本和算法 'x-oss-signature-version': res.x_oss_signature_version, //指定签名的版本和算法
'x-oss-credential': res.x_oss_credential, //指明派生密钥的参数集 'x-oss-credential': res.x_oss_credential, //指明派生密钥的参数集
@ -62,7 +63,7 @@ async uploadFileToOSS(file, callback) {
success(res) { success(res) {
console.log('上传响应:', res); console.log('上传响应:', res);
if (res.statusCode === 200) { if (res.statusCode === 200) {
callback(null, 'https://image-fudan.oss-cn-beijing.aliyuncs.com/upload_file/'+ file.name); // 上传成功 callback(null, 'https://image-fudan.oss-cn-beijing.aliyuncs.com/upload_file/'+ fileName); // 上传成功
} else { } else {
console.error('上传失败,状态码:', res.statusCode); console.error('上传失败,状态码:', res.statusCode);
console.error('失败响应:', res); console.error('失败响应:', res);

View File

@ -237,6 +237,17 @@ Page({
years--; years--;
months += 12; months += 12;
} }
if (years <= 0 && months <= 0) {
// 小于一个月,显示几周
const diffTime = today - birthDate;
const diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24));
if (diffDays < 7) {
return `${diffDays}`;
} else {
const weeks = Math.floor(diffDays / 7);
return `${weeks}`;
}
}
if (years <= 0) { if (years <= 0) {
return `${months}个月`; return `${months}个月`;
} }
@ -251,11 +262,13 @@ Page({
if (mode == 'birth') { if (mode == 'birth') {
this.setData({ this.setData({
['personInfo.birthday']: value, ['personInfo.birthday']: value,
['personInfo.age']: this.getAgeByBirthday(value) ['personInfo.age']: this.getAgeByBirthday(value),
['errorStatus.birthday']: false
}) })
} else { } else {
this.setData({ this.setData({
['personInfo.operative_date']: value ['personInfo.operative_date']: value,
['errorStatus.operative_date']: false
}) })
} }
@ -272,7 +285,11 @@ Page({
onNameChange(e) { onNameChange(e) {
this.personInfoFieldChange('username', e); this.personInfoFieldChange('username', e);
if (this.data.errorStatus.name) { const value = e.detail.value;
// Validate name length (2-20)
if (value.length < 2 || value.length > 20) {
this.setData({ 'errorStatus.name': true });
} else if (this.data.errorStatus.name) {
this.setData({ 'errorStatus.name': false }); this.setData({ 'errorStatus.name': false });
} }
}, },
@ -324,7 +341,8 @@ Page({
async onSaveInfo() { async onSaveInfo() {
let obj = this.data.personInfo; let obj = this.data.personInfo;
let errorStatus = {}; let errorStatus = {};
errorStatus.name = !obj.username; // Name must be 2-20 characters
errorStatus.name = !obj.username || obj.username.length < 2 || obj.username.length > 20;
errorStatus.gender = !obj.sex; errorStatus.gender = !obj.sex;
errorStatus.id = obj.id_number ? !/^[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/.test(obj.id_number) : false; errorStatus.id = obj.id_number ? !/^[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/.test(obj.id_number) : false;
errorStatus.birthday = !obj.birthday; errorStatus.birthday = !obj.birthday;
@ -334,9 +352,10 @@ Page({
errorStatus.parity_number = !obj.parity_number; errorStatus.parity_number = !obj.parity_number;
errorStatus.birth_number = !obj.birth_number; errorStatus.birth_number = !obj.birth_number;
errorStatus.conception_type = !obj.conception_type; errorStatus.conception_type = !obj.conception_type;
errorStatus.gestational_week = !/^\d+(\.\d+)?$/.test(obj.gestational_week); errorStatus.gestational_week = !/^\d+(\.\d+)?$/.test(obj.gestational_week) || Number(obj.gestational_week) <= 0;
errorStatus.prenatal_check_type = !obj.prenatal_check_type; errorStatus.prenatal_check_type = !obj.prenatal_check_type;
errorStatus.delivery_type = !obj.delivery_type; errorStatus.delivery_type = !obj.delivery_type;
errorStatus.prenatal_check_remark = !obj.prenatal_check_remark;
this.setData({ errorStatus }); this.setData({ errorStatus });
if (Object.values(errorStatus).some(v => v)) { if (Object.values(errorStatus).some(v => v)) {
return; return;
@ -377,15 +396,22 @@ Page({
} }
}, },
onWeightInput(e) { onWeightInput(e) {
const isNumber = /^\d+(\.\d+)?$/.test(e.detail.value); // const isNumber = /^\d+(\.\d+)?$/.test(e.detail.value);
if (this.data.errorStatus.birth_weight) { // if (this.data.errorStatus.birth_weight) {
// this.setData({ 'errorStatus.birth_weight': false });
// }
if(!e.detail.value || e.detail.value == 0){
this.setData({ 'errorStatus.birth_weight': true });
} else {
this.setData({ 'errorStatus.birth_weight': false }); this.setData({ 'errorStatus.birth_weight': false });
} }
this.personInfoFieldChange('birth_weight', e); this.personInfoFieldChange('birth_weight', e);
}, },
onWeekInput(e) { onWeekInput(e) {
const isNumber = /^\d+(\.\d+)?$/.test(e.detail.value); console.log(e.detail.value == true)
if (this.data.errorStatus.gestational_week) { if(!e.detail.value || e.detail.value == 0){
this.setData({ 'errorStatus.gestational_week': true });
} else {
this.setData({ 'errorStatus.gestational_week': false }); this.setData({ 'errorStatus.gestational_week': false });
} }
this.personInfoFieldChange('gestational_week', e); this.personInfoFieldChange('gestational_week', e);
@ -408,7 +434,16 @@ Page({
label label
} = e.detail; } = e.detail;
this.setData({ this.setData({
[`personInfo.${modeText}`]: value[0] [`personInfo.${modeText}`]: value[0],
[`errorStatus.${modeText}`]: false
}) })
},
onPrenatalCheckRemarkChange(e) {
this.setData({
['personInfo.prenatal_check_remark']: e.detail.value,
['errorStatus.prenatal_check_remark']: false
})
}, },
}); });

View File

@ -3,7 +3,7 @@
<t-cell class="info-edit__cell" required title="姓名" bordered="{{false}}"> <t-cell class="info-edit__cell" required title="姓名" bordered="{{false}}">
<t-input bind:change="onNameChange" align="right" borderless placeholder="请输入患者姓名" slot="note" value="{{personInfo.username}}"/> <t-input bind:change="onNameChange" align="right" borderless placeholder="请输入患者姓名" slot="note" value="{{personInfo.username}}"/>
</t-cell> </t-cell>
<view class="info-edit__tips" wx:if="{{errorStatus.name}}">请输入患者姓名</view> <view class="info-edit__tips" wx:if="{{errorStatus.name}}">姓名字数在2至20之间</view>
</view> </view>
<view class="info-item"> <view class="info-item">
<t-cell class="info-edit__cell" required title="性别" bordered="{{false}}"> <t-cell class="info-edit__cell" required title="性别" bordered="{{false}}">
@ -39,7 +39,7 @@
<t-cell required arrow bind:click="showPicker" data-mode="operative" title="胆道闭锁手术时间" bordered="{{false}}"> <t-cell required arrow bind:click="showPicker" data-mode="operative" title="胆道闭锁手术时间" bordered="{{false}}">
<t-input align="right" borderless placeholder="请选择" readonly slot="note" value="{{personInfo.operative_date}}" /> <t-input align="right" borderless placeholder="请选择" readonly slot="note" value="{{personInfo.operative_date}}" />
</t-cell> </t-cell>
<view class="info-edit__tips" wx:if="{{errorStatus.operative_date}}">请选择胆道闭锁手术时间</view> <view class="info-edit__tips" wx:if="{{errorStatus.operative_date}}">请选择胆道闭锁手术时间</view>
</view> </view>
<view class="info-item"> <view class="info-item">
<t-cell title="胎次" required arrow bordered="{{false}}" bind:click="showSelect" data-mode="parity_number" data-list="{{parity_numberList}}" > <t-cell title="胎次" required arrow bordered="{{false}}" bind:click="showSelect" data-mode="parity_number" data-list="{{parity_numberList}}" >
@ -69,8 +69,9 @@
<t-cell title="产检是否有异常(如有,请填写)" bordered="{{false}}" required arrow bind:click="showSelect" data-mode="prenatal_check_type" data-list="{{prenatal_checkList}}" > <t-cell title="产检是否有异常(如有,请填写)" bordered="{{false}}" required arrow bind:click="showSelect" data-mode="prenatal_check_type" data-list="{{prenatal_checkList}}" >
<t-input align="right" borderless placeholder="请选择" readonly slot="note" value="{{prenatal_checkList[personInfo.prenatal_check_type - 1].label}}" /> <t-input align="right" borderless placeholder="请选择" readonly slot="note" value="{{prenatal_checkList[personInfo.prenatal_check_type - 1].label}}" />
</t-cell> </t-cell>
<t-textarea t-class="external-class" wx:if="{{personInfo.prenatal_check_type == 1}}" placeholder="请输入异常描述" disableDefaultPadding="{{true}}" value="{{personInfo.prenatal_check_remark}}" /> <t-textarea bind:change="onPrenatalCheckRemarkChange" t-class="external-class" wx:if="{{personInfo.prenatal_check_type == 1}}" placeholder="请输入异常描述" disableDefaultPadding="{{true}}" value="{{personInfo.prenatal_check_remark}}" />
<view class="info-edit__tips" wx:if="{{errorStatus.prenatal_check_type}}">请选择产检是否有异常</view> <view class="info-edit__tips" wx:if="{{errorStatus.prenatal_check_type}}">请选择产检是否有异常</view>
<view class="info-edit__tips" wx:if="{{personInfo.prenatal_check_type == 1 && errorStatus.prenatal_check_remark}}">请输入异常描述</view>
</view> </view>
<view class="info-item"> <view class="info-item">
<t-cell title="分娩方式" required arrow bordered="{{false}}" bind:click="showSelect" data-mode="delivery_type" data-list="{{deliveryList}}" > <t-cell title="分娩方式" required arrow bordered="{{false}}" bind:click="showSelect" data-mode="delivery_type" data-list="{{deliveryList}}" >