diff --git a/assets/images/mmp_7/img1.png b/assets/images/mmp_7/img1.png new file mode 100644 index 0000000..e600605 Binary files /dev/null and b/assets/images/mmp_7/img1.png differ diff --git a/assets/images/mmp_7/img2.png b/assets/images/mmp_7/img2.png new file mode 100644 index 0000000..b269881 Binary files /dev/null and b/assets/images/mmp_7/img2.png differ diff --git a/assets/images/mmp_7/img3.png b/assets/images/mmp_7/img3.png new file mode 100644 index 0000000..bd50b54 Binary files /dev/null and b/assets/images/mmp_7/img3.png differ diff --git a/pages/AddTherapeuticRegimen/index.js b/pages/AddTherapeuticRegimen/index.js index db0e468..6cbdb18 100644 --- a/pages/AddTherapeuticRegimen/index.js +++ b/pages/AddTherapeuticRegimen/index.js @@ -11,6 +11,7 @@ Page({ * 页面的初始数据 */ data: { + imageFile: '', detail: [{ "name": "", "dose": "", @@ -58,7 +59,9 @@ Page({ popupProps: { usingCustomNavbar: true, }, - + imageVisible: false, + imageList: [], + imageIndex: 1, formatter(item, index) { if (index === 1) { const label = item.label.slice(0, -1); @@ -283,6 +286,99 @@ Page({ }) }, + //上传文件方法 + async uploadFileToOSS(file, callback) { + + + const policyData = await request('admin/policy_token', 'post') + const res = JSON.parse(policyData.token) + + + const formData = { + key: file.name, //上传文件名称 + policy: res.policy, //表单域 + 'x-oss-signature-version': res.x_oss_signature_version, //指定签名的版本和算法 + 'x-oss-credential': res.x_oss_credential, //指明派生密钥的参数集 + 'x-oss-date': res.x_oss_date, //请求的时间 + 'x-oss-signature': res.signature, //签名认证描述信息 + 'x-oss-security-token': res.security_token, //安全令牌 + success_action_status: "200" //上传成功后响应状态码 + }; + // console.log(filePath) + // return + // 发送请求上传文件 + wx.uploadFile({ + url: 'https://image-fudan.oss-cn-beijing.aliyuncs.com/', + method: 'put', + filePath: file.path, + name: 'file', //固定值为file + formData: formData, + success(res) { + console.log('上传响应:', res); + if (res.statusCode === 200) { + callback(null, 'https://image-fudan.oss-cn-beijing.aliyuncs.com/'+ file.name); // 上传成功 + } else { + console.error('上传失败,状态码:', res.statusCode); + console.error('失败响应:', res); + callback(res); // 上传失败,返回响应 + } + }, + fail(err) { + console.error('上传失败:', err); // 输出错误信息 + wx.showToast({ title: '上传失败,请重试!', icon: 'none' }); + callback(err); // 调用回调处理错误 + } + }); + + }, + handleUpload(e) { + wx.chooseMessageFile({ + count: 1, // 选择一个文件 + type: 'all', // 支持所有类型的文件 + success: (res) => { + wx.showToast({ title: '文件上传中,请稍等!', icon: 'none' }); + console.log('选择的文件:', res.tempFiles); // 输出选择的文件信息 + if (res.tempFiles.length > 0) { + const tempFilePath = res.tempFiles[0]; + console.log('选择的文件路径:', tempFilePath); // 输出文件路径 + this.uploadFileToOSS(tempFilePath, (error, data) => { + if (error) { + wx.showToast({ title: '上传失败!', icon: 'none' }); + console.error('上传失败:', error); // 输出具体的错误信息 + } else { + wx.showToast({ title: '上传成功!', icon: 'success' }); + + this.setData({ + imageFile: data + }) + + console.log('上传成功:', data); // 输出上传成功后的数据 + } + }); + } else { + wx.showToast({ title: '未选择文件!', icon: 'none' }); + } + }, + fail: (err) => { + wx.showToast({ title: '选择文件失败!', icon: 'none' }); + console.error('选择文件失败:', err); // 输出选择文件的错误信息 + } + }); + }, + handleDelete(){ + this.setData({ + imageFile: '' + }); + }, + handleImagePreview(e){ + + this.setData({ + imageList: [this.data.imageFile], + imageIndex: 1, + imageVisible: true + }) + }, + /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/pages/AddTherapeuticRegimen/index.json b/pages/AddTherapeuticRegimen/index.json index 805b883..96d930c 100644 --- a/pages/AddTherapeuticRegimen/index.json +++ b/pages/AddTherapeuticRegimen/index.json @@ -11,7 +11,8 @@ "t-radio-group": "tdesign-miniprogram/radio-group/radio-group", "t-tag": "tdesign-miniprogram/tag/tag", "t-picker": "tdesign-miniprogram/picker/picker", - "t-picker-item": "tdesign-miniprogram/picker-item/picker-item" + "t-picker-item": "tdesign-miniprogram/picker-item/picker-item", + "t-image-viewer": "tdesign-miniprogram/image-viewer/image-viewer" }, "navigationBarTitleText": "用药方案", "styleIsolation": "apply-shared" diff --git a/pages/AddTherapeuticRegimen/index.less b/pages/AddTherapeuticRegimen/index.less index df81610..881dd7b 100644 --- a/pages/AddTherapeuticRegimen/index.less +++ b/pages/AddTherapeuticRegimen/index.less @@ -128,4 +128,48 @@ color: var(--td-brand-color); } } + .report-image{ + width: 140rpx; + height: 140rpx; + background: #F8F8F8; + border-radius: 16rpx; + border: 1rpx solid #EEEEEE; + position: relative; + overflow: hidden; + image{ + width: 100%; + height: 100%; + } + .more{ + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; + border-radius: 16rpx; + background-color: rgba(0, 0, 0, 0.5); + display: flex; + justify-content: center; + align-items: center; + color: #fff; + font-size: 48rpx; + } + .delete-btn{ + position: absolute; + right: 0; + top: 0; + width: 40rpx; + height: 40rpx; + background-color: rgba(0, 0, 0, 0.7); + color: #fff; + display: flex; + justify-content: center; + align-items: center; + border-radius: 0 16rpx 0 16rpx; + z-index: 2; + text{ + font-size: 24rpx; + } + } +} } \ No newline at end of file diff --git a/pages/AddTherapeuticRegimen/index.wxml b/pages/AddTherapeuticRegimen/index.wxml index 8f963e2..abed2bb 100644 --- a/pages/AddTherapeuticRegimen/index.wxml +++ b/pages/AddTherapeuticRegimen/index.wxml @@ -1,10 +1,17 @@ - + 拍照导入 + + + + + + + 用药周期 @@ -120,4 +127,6 @@ > + + \ No newline at end of file diff --git a/pages/followUp copy/index.js b/pages/followUp copy/index.js deleted file mode 100644 index 7aaa2ac..0000000 --- a/pages/followUp copy/index.js +++ /dev/null @@ -1,189 +0,0 @@ -// pages/followUp/index.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - style: 'border: 2rpx solid #efefef;border-radius: 12rpx;', - personInfo: { - name: '', - gender: 0, - birth: '', - address: [], - introduction: '', - yearType: 0, - - // photos: [], - }, - mode: '', - dateVisible: false, - date: new Date('2021-12-23').getTime(), // 支持时间戳传入 - dateText: '', - filter(type, options) { - if (type === 'year') { - return options.sort((a, b) => b.value - a.value); - } - return options; - }, - popupProps: { - usingCustomNavbar: true, - }, - - formatter(item, index) { - if (index === 1) { - const label = item.label.slice(0, -1); - return { - value: item.value, - label: calendarMonth[Number(label) - 1], - }; - } - if (index === 2) { - const [dateValue, weekValue] = item.label.split(' '); - const dateSuffixes = { - 1: 'st', - 2: 'nd', - 3: 'rd', - }; - const weekMap = { - 周一: 'Mon.', - 周二: 'Tues.', - 周三: 'Wed.', - 周四: 'Thurs.', - 周五: 'Fri.', - 周六: 'Sat.', - 周日: 'Sun.', - }; - const label = dateValue.slice(0, -1); - - return { - value: item.value, - label: `${label}${dateSuffixes[label] || 'th'} ${weekMap[weekValue]}`, - }; - } - - return { - value: item.value, - label: item.label.slice(0, -1), - }; - }, - - originFiles: [ - { - url: 'https://tdesign.gtimg.com/mobile/demos/example4.png', - name: 'uploaded1.png', - type: 'image', - removeBtn: true, - }, - { - url: 'https://tdesign.gtimg.com/mobile/demos/example6.png', - name: 'uploaded2.png', - type: 'image', - removeBtn: true, - }, - { - url: 'https://tdesign.gtimg.com/mobile/demos/example5.png', - name: 'uploaded3.png', - type: 'image', - removeBtn: true, - }, - ], - gridConfig: { - column: 1, - width: 160, - height: 160, - }, - config: { - count: 1, - }, - - - }, - showPicker(e) { - const { mode } = e.currentTarget.dataset; - this.setData({ - [`${mode}Visible`]: true, - }); - - - - }, - - handleSuccess(e) { - console.log(e.detail) - const { files } = e.detail; - this.setData({ - originFiles: files, - }); - }, - handleRemove(e) { - console.log(e.detail.file); - const { index } = e.detail; - const { originFiles } = this.data; - originFiles.splice(index, 1); - this.setData({ - originFiles, - }); - }, - handleClick(e) { - console.log(e.detail.file); - }, - - - - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - - } -}) \ No newline at end of file diff --git a/pages/followUp copy/index.json b/pages/followUp copy/index.json deleted file mode 100644 index 6d9dd9c..0000000 --- a/pages/followUp copy/index.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "usingComponents": { - "t-cell": "tdesign-miniprogram/cell/cell", - "t-input": "tdesign-miniprogram/input/input", - "t-date-time-picker": "tdesign-miniprogram/date-time-picker/date-time-picker", - "t-row": "tdesign-miniprogram/row/row", - "t-col": "tdesign-miniprogram/col/col", - "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" - }, - "navigationStyle": "default", - "navigationBarTitleText": "诊断信息录入" -} \ No newline at end of file diff --git a/pages/followUp copy/index.less b/pages/followUp copy/index.less deleted file mode 100644 index ef35ab7..0000000 --- a/pages/followUp copy/index.less +++ /dev/null @@ -1,42 +0,0 @@ -/* pages/followUp/index.wxss */ -.follow-up{ - padding: 28rpx; - padding-bottom: 56rpx; - .follow-item{ - background-color: #fff; - padding: 28rpx; - margin-bottom: 28rpx; - border-radius: 20rpx; - padding-bottom: 20rpx; - } - .custom-label { - display: inline-flex; - } - - .custom-label::after, .input-example__label::after { - content: '*'; - color: red; - font-size: 32rpx; - margin-left: 4rpx; - } - .t-overlay{ - top: 0!important; - } - .input-example { - // background-color: var(--bg-color-demo); - padding: 10rpx 0; - } - - .input-example__label { - color: var(--td-text-color-primary); - font-size: 24rpx; - line-height: 40rpx; - margin: 0 8rpx 16rpx; - } - .box{ - display: flex; - justify-content: space-between; - flex-wrap: wrap; - padding-right: 60rpx; - } -} \ No newline at end of file diff --git a/pages/followUp copy/index.wxml b/pages/followUp copy/index.wxml deleted file mode 100644 index 1b712ac..0000000 --- a/pages/followUp copy/index.wxml +++ /dev/null @@ -1,47 +0,0 @@ - - \ No newline at end of file diff --git a/pages/mmp-7/index.js b/pages/mmp-7/index.js index 7aaa2ac..6c65121 100644 --- a/pages/mmp-7/index.js +++ b/pages/mmp-7/index.js @@ -1,136 +1,121 @@ -// pages/followUp/index.js +import request from '~/api/request' Page({ /** * 页面的初始数据 */ data: { - style: 'border: 2rpx solid #efefef;border-radius: 12rpx;', - personInfo: { - name: '', - gender: 0, - birth: '', - address: [], - introduction: '', - yearType: 0, - - // photos: [], - }, - mode: '', - dateVisible: false, - date: new Date('2021-12-23').getTime(), // 支持时间戳传入 - dateText: '', - filter(type, options) { - if (type === 'year') { - return options.sort((a, b) => b.value - a.value); + form: {}, + imageVisible: false, + imageList: [], + imageIndex: 1, + }, + formKey: '', + + + + +//上传文件方法 +async uploadFileToOSS(file, callback) { + + + const policyData = await request('admin/policy_token', 'post') + const res = JSON.parse(policyData.token) + + + const formData = { + key: file.name, //上传文件名称 + policy: res.policy, //表单域 + 'x-oss-signature-version': res.x_oss_signature_version, //指定签名的版本和算法 + 'x-oss-credential': res.x_oss_credential, //指明派生密钥的参数集 + 'x-oss-date': res.x_oss_date, //请求的时间 + 'x-oss-signature': res.signature, //签名认证描述信息 + 'x-oss-security-token': res.security_token, //安全令牌 + success_action_status: "200" //上传成功后响应状态码 + }; + // console.log(filePath) + // return + // 发送请求上传文件 + wx.uploadFile({ + url: 'https://image-fudan.oss-cn-beijing.aliyuncs.com/', + method: 'put', + filePath: file.path, + name: 'file', //固定值为file + formData: formData, + success(res) { + console.log('上传响应:', res); + if (res.statusCode === 200) { + callback(null, 'https://image-fudan.oss-cn-beijing.aliyuncs.com/'+ file.name); // 上传成功 + } else { + console.error('上传失败,状态码:', res.statusCode); + console.error('失败响应:', res); + callback(res); // 上传失败,返回响应 } - return options; - }, - popupProps: { - usingCustomNavbar: true, }, + fail(err) { + console.error('上传失败:', err); // 输出错误信息 + wx.showToast({ title: '上传失败,请重试!', icon: 'none' }); + callback(err); // 调用回调处理错误 + } + }); + +}, +handleUpload(e) { + const { mode } = e.currentTarget.dataset; - formatter(item, index) { - if (index === 1) { - const label = item.label.slice(0, -1); - return { - value: item.value, - label: calendarMonth[Number(label) - 1], - }; + + wx.chooseMessageFile({ + count: 1, // 选择一个文件 + type: 'all', // 支持所有类型的文件 + success: (res) => { + wx.showToast({ title: '文件上传中,请稍等!', icon: 'none' }); + console.log('选择的文件:', res.tempFiles); // 输出选择的文件信息 + if (res.tempFiles.length > 0) { + const tempFilePath = res.tempFiles[0]; + console.log('选择的文件路径:', tempFilePath); // 输出文件路径 + this.uploadFileToOSS(tempFilePath, (error, data) => { + if (error) { + wx.showToast({ title: '上传失败!', icon: 'none' }); + console.error('上传失败:', error); // 输出具体的错误信息 + } else { + wx.showToast({ title: '上传成功!', icon: 'success' }); + + this.setData({ + [`form.${mode}`]: data + }) + + console.log('上传成功:', data); // 输出上传成功后的数据 + } + }); + } else { + wx.showToast({ title: '未选择文件!', icon: 'none' }); } - if (index === 2) { - const [dateValue, weekValue] = item.label.split(' '); - const dateSuffixes = { - 1: 'st', - 2: 'nd', - 3: 'rd', - }; - const weekMap = { - 周一: 'Mon.', - 周二: 'Tues.', - 周三: 'Wed.', - 周四: 'Thurs.', - 周五: 'Fri.', - 周六: 'Sat.', - 周日: 'Sun.', - }; - const label = dateValue.slice(0, -1); - - return { - value: item.value, - label: `${label}${dateSuffixes[label] || 'th'} ${weekMap[weekValue]}`, - }; - } - - return { - value: item.value, - label: item.label.slice(0, -1), - }; }, + fail: (err) => { + wx.showToast({ title: '选择文件失败!', icon: 'none' }); + console.error('选择文件失败:', err); // 输出选择文件的错误信息 + } + }); +}, - originFiles: [ - { - url: 'https://tdesign.gtimg.com/mobile/demos/example4.png', - name: 'uploaded1.png', - type: 'image', - removeBtn: true, - }, - { - url: 'https://tdesign.gtimg.com/mobile/demos/example6.png', - name: 'uploaded2.png', - type: 'image', - removeBtn: true, - }, - { - url: 'https://tdesign.gtimg.com/mobile/demos/example5.png', - name: 'uploaded3.png', - type: 'image', - removeBtn: true, - }, - ], - gridConfig: { - column: 1, - width: 160, - height: 160, - }, - config: { - count: 1, - }, - - - }, - showPicker(e) { - const { mode } = e.currentTarget.dataset; - this.setData({ - [`${mode}Visible`]: true, - }); - - - - }, - - handleSuccess(e) { - console.log(e.detail) - const { files } = e.detail; - this.setData({ - originFiles: files, - }); - }, - handleRemove(e) { - console.log(e.detail.file); - const { index } = e.detail; - const { originFiles } = this.data; - originFiles.splice(index, 1); - this.setData({ - originFiles, - }); - }, - handleClick(e) { - console.log(e.detail.file); - }, - - +handleDelete(e){ + const { mode } = e.currentTarget.dataset; + this.setData({ + [`form.${mode}`]: '' + }) +}, +handleImagePreview(e){ + const { mode } = e.currentTarget.dataset; + this.setData({ + imageList: [this.data.form[mode]], + imageIndex: 1, + imageVisible: true + }) +}, +async toQuestionnaire(){ + const res = await request('/patient/diagnostic', 'post', this.data.form) +}, /** * 生命周期函数--监听页面加载 */ diff --git a/pages/mmp-7/index.json b/pages/mmp-7/index.json index 6d9dd9c..3850e2f 100644 --- a/pages/mmp-7/index.json +++ b/pages/mmp-7/index.json @@ -6,9 +6,9 @@ "t-row": "tdesign-miniprogram/row/row", "t-col": "tdesign-miniprogram/col/col", "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-image-viewer": "tdesign-miniprogram/image-viewer/image-viewer" }, "navigationStyle": "default", "navigationBarTitleText": "诊断信息录入" diff --git a/pages/mmp-7/index.less b/pages/mmp-7/index.less index ef35ab7..c08d16c 100644 --- a/pages/mmp-7/index.less +++ b/pages/mmp-7/index.less @@ -2,18 +2,23 @@ .follow-up{ padding: 28rpx; padding-bottom: 56rpx; + .user-info{ + border-radius: 24rpx; + margin-bottom: 28rpx; + overflow: hidden; + } .follow-item{ background-color: #fff; padding: 28rpx; margin-bottom: 28rpx; - border-radius: 20rpx; + border-radius: 24rpx; padding-bottom: 20rpx; } .custom-label { display: inline-flex; } - .custom-label::after, .input-example__label::after { + .custom-label::after { content: '*'; color: red; font-size: 32rpx; @@ -32,6 +37,7 @@ font-size: 24rpx; line-height: 40rpx; margin: 0 8rpx 16rpx; + color: #FF5D5D; } .box{ display: flex; @@ -39,4 +45,73 @@ flex-wrap: wrap; padding-right: 60rpx; } + .improt-file{ + width: 196rpx; + height: 196rpx; + background: rgba(0,91,162,0.05); + border-radius: 16rpx; + border: 2rpx dotted rgba(0,91,162,0.2); + + display: flex; + justify-content: center; + align-items: center; + .upload-flow{ + text-align: center; + font-size: 26rpx; + .iconfont{ + font-size: 36rpx; + color: var(--td-brand-color); + } + } + } + .report-image{ + width: 196rpx; + height: 196rpx; + background: #F8F8F8; + border-radius: 16rpx; + border: 1rpx solid #EEEEEE; + position: relative; + overflow: hidden; + image{ + width: 100%; + height: 100%; + } + .more{ + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; + border-radius: 16rpx; + background-color: rgba(0, 0, 0, 0.5); + display: flex; + justify-content: center; + align-items: center; + color: #fff; + font-size: 48rpx; + } + .delete-btn{ + position: absolute; + right: 0; + top: 0; + width: 40rpx; + height: 40rpx; + background-color: rgba(0, 0, 0, 0.7); + color: #fff; + display: flex; + justify-content: center; + align-items: center; + border-radius: 0 16rpx 0 16rpx; + z-index: 2; + text{ + font-size: 24rpx; + } + } +} +.example-image{ + image{ + width: 100%; + height: 196rpx; + } +} } \ No newline at end of file diff --git a/pages/mmp-7/index.wxml b/pages/mmp-7/index.wxml index 1b712ac..04655ff 100644 --- a/pages/mmp-7/index.wxml +++ b/pages/mmp-7/index.wxml @@ -1,6 +1,14 @@ @@ -20,7 +48,27 @@ 请裁剪原始超声图像,使门静脉(cord sign)的左右分支或其潜在区域在画面中最大化填充,如右图所示 - + + + + + + 拍照导入 + + + + + + + + + + + + + + + @@ -33,7 +81,27 @@ 请裁剪原始超声图像,使肝门区(cord sign)的横切面或其潜在区域在画面中最大化填充,如右图所示 - + + + + + + 拍照导入 + + + + + + + + + + + + + + + @@ -42,6 +110,6 @@ 提交 - + \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json index 1c70d98..68eef05 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -2,12 +2,19 @@ "condition": { "miniprogram": { "list": [ + { + "name": "诊断报告", + "pathName": "pages/mmp-7/index", + "query": "", + "launchMode": "default", + "scene": null + }, { "name": "添加随访", "pathName": "pages/followUp/index", "query": "", - "scene": null, - "launchMode": "default" + "launchMode": "default", + "scene": null }, { "name": "pages/home/index",