|
|
@@ -6,31 +6,8 @@
|
|
|
<text class="tip-text">{{ tipText }}</text>
|
|
|
</view>
|
|
|
|
|
|
- <!-- 报告类型 -->
|
|
|
- <view class="form-section type-section">
|
|
|
- <text class="form-label">请选择报告类型</text>
|
|
|
- <view class="type-methods">
|
|
|
- <view
|
|
|
- class="type-card type-gut"
|
|
|
- :class="{ 'type-card-active': reportKind === 'gut' }"
|
|
|
- @click="selectKind('gut')">
|
|
|
- <text class="type-card-icon">🦠</text>
|
|
|
- <text class="type-card-title">菌群检测报告</text>
|
|
|
- <text class="type-card-desc">肠道菌群 PDF,自动解析菌群指标</text>
|
|
|
- </view>
|
|
|
- <view
|
|
|
- class="type-card type-a2"
|
|
|
- :class="{ 'type-card-active': reportKind === 'a2' }"
|
|
|
- @click="selectKind('a2')">
|
|
|
- <text class="type-card-icon">🧠</text>
|
|
|
- <text class="type-card-title">素质测评 A2</text>
|
|
|
- <text class="type-card-desc">核心素养 PDF,解析大五人格等维度</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
-
|
|
|
- <!-- A2 需指定成员 -->
|
|
|
- <view class="form-section" v-if="reportKind === 'a2'">
|
|
|
+ <!-- 成员归属(统一上传:后台按指纹自动识别报告类型,需指定成员以正确归属) -->
|
|
|
+ <view class="form-section">
|
|
|
<view class="member-box">
|
|
|
<text class="form-label">报告属于哪位成员</text>
|
|
|
<view class="member-list" v-if="familyMembers.length > 0">
|
|
|
@@ -55,12 +32,12 @@
|
|
|
<view class="upload-card card-chat" @click="pickFromChat">
|
|
|
<view class="upload-card-icon">💬</view>
|
|
|
<text class="upload-card-title">从聊天选取</text>
|
|
|
- <text class="upload-card-desc">{{ reportKind === 'a2' ? '微信聊天中的 A2 PDF' : '微信聊天中的 PDF/图片' }}</text>
|
|
|
+ <text class="upload-card-desc">微信聊天中的 PDF / 图片报告</text>
|
|
|
</view>
|
|
|
<view class="upload-card card-photo" @click="takePhoto">
|
|
|
<view class="upload-card-icon">📷</view>
|
|
|
<text class="upload-card-title">拍照上传</text>
|
|
|
- <text class="upload-card-desc">{{ reportKind === 'a2' ? 'A2 仅支持 PDF 文件' : '拍摄纸质报告或舌象' }}</text>
|
|
|
+ <text class="upload-card-desc">拍摄纸质报告(PDF 报告更佳)</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
@@ -150,9 +127,9 @@
|
|
|
</view>
|
|
|
<view class="guide-tips">
|
|
|
<text class="guide-tips-title">温馨提示</text>
|
|
|
- <text class="guide-tips-item">· 请先选择报告类型,再从聊天选取文件</text>
|
|
|
- <text class="guide-tips-item">· 素质测评 A2 仅支持 PDF,需指定家庭成员</text>
|
|
|
- <text class="guide-tips-item">· 请确保报告清晰完整,以便准确解析</text>
|
|
|
+ <text class="guide-tips-item">· 上传后无需选择类型,后台自动识别报告种类并解析</text>
|
|
|
+ <text class="guide-tips-item">· 请先选择报告归属成员,再上传文件</text>
|
|
|
+ <text class="guide-tips-item">· 请确认报告清晰完整,以便准确解析</text>
|
|
|
<text class="guide-tips-item">· 确认入库后将自动生成成长方案,可再分解为每日任务</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -160,7 +137,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { uploadReportOnly, getReportCollectStatus, danParsePreview, danConfirmReport, getFamilyMemberList } from '../../utils/api.js'
|
|
|
+import { uploadReportOnly, getReportCollectStatus, getFamilyMemberList } from '../../utils/api.js'
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
@@ -182,18 +159,12 @@ export default {
|
|
|
},
|
|
|
computed: {
|
|
|
tipText: function() {
|
|
|
- if (this.reportKind === 'a2') {
|
|
|
- return '已选择素质测评 A2,请指定成员后上传核心素养 PDF'
|
|
|
- }
|
|
|
- if (this.reportKind === 'gut') {
|
|
|
- return '已选择菌群检测报告,上传后后台自动解析菌群指标'
|
|
|
- }
|
|
|
- return '请先选择报告类型:菌群检测,或素质测评 A2'
|
|
|
+ return '上传报告后由系统自动识别类型并解析:菌群检测、素质测评 A2、体检报告等'
|
|
|
}
|
|
|
},
|
|
|
onLoad: function(options) {
|
|
|
this.memberId = options.memberId ? parseInt(options.memberId) : null
|
|
|
- if (options.type === 'a2' || options.reportKind === 'a2') {
|
|
|
+if (options.type === 'a2' || options.reportKind === 'a2') {
|
|
|
this.reportKind = 'a2'
|
|
|
} else if (options.type === 'gut' || options.reportKind === 'gut') {
|
|
|
this.reportKind = 'gut'
|
|
|
@@ -207,9 +178,6 @@ export default {
|
|
|
this.stopCollectPolling()
|
|
|
},
|
|
|
methods: {
|
|
|
- selectKind: function(kind) {
|
|
|
- this.reportKind = kind
|
|
|
- },
|
|
|
resolveMemberId: function(member) {
|
|
|
if (!member) return null
|
|
|
var raw = member.id || member.userId
|
|
|
@@ -258,14 +226,7 @@ export default {
|
|
|
self.familyMembers = []
|
|
|
})
|
|
|
},
|
|
|
- ensureTypeSelected: function() {
|
|
|
- if (this.reportKind === 'gut' || this.reportKind === 'a2') {
|
|
|
- return true
|
|
|
- }
|
|
|
- uni.showToast({ title: '请先选择报告类型', icon: 'none' })
|
|
|
- return false
|
|
|
- },
|
|
|
- ensureA2Member: function() {
|
|
|
+ ensureMember: function() {
|
|
|
if (this.memberId) return true
|
|
|
uni.showToast({ title: '请先选择报告所属成员', icon: 'none' })
|
|
|
return false
|
|
|
@@ -294,13 +255,8 @@ export default {
|
|
|
},
|
|
|
pickFromChat: function() {
|
|
|
var self = this
|
|
|
- if (!this.ensureTypeSelected()) return
|
|
|
- if (this.reportKind === 'a2' && !this.ensureA2Member()) return
|
|
|
+ if (!this.ensureMember()) return
|
|
|
this.ensureAgreed(function() {
|
|
|
- if (self.reportKind === 'a2') {
|
|
|
- self.chooseChatFile('file', '聊天文件')
|
|
|
- return
|
|
|
- }
|
|
|
// type='all' 的选择器默认停留在图片 tab,用户难以发现可切换选文件。
|
|
|
// 改为先弹 actionSheet 让用户明确选择图片或文件,分别走对应 type。
|
|
|
uni.showActionSheet({
|
|
|
@@ -336,11 +292,7 @@ export default {
|
|
|
},
|
|
|
takePhoto: function() {
|
|
|
var self = this
|
|
|
- if (!this.ensureTypeSelected()) return
|
|
|
- if (this.reportKind === 'a2') {
|
|
|
- uni.showToast({ title: '素质测评 A2 请上传 PDF 文件', icon: 'none' })
|
|
|
- return
|
|
|
- }
|
|
|
+ if (!this.ensureMember()) return
|
|
|
this.ensureAgreed(function() {
|
|
|
uni.chooseImage({
|
|
|
count: 1,
|
|
|
@@ -355,17 +307,13 @@ export default {
|
|
|
},
|
|
|
uploadReport: function(filePath, fileName) {
|
|
|
if (!filePath) return
|
|
|
- if (this.reportKind === 'a2') {
|
|
|
- this.uploadA2Report(filePath, fileName)
|
|
|
- return
|
|
|
- }
|
|
|
var self = this
|
|
|
self.uploading = true
|
|
|
self.uploadingText = '正在上传文件...'
|
|
|
uni.showLoading({ title: '上传中...' })
|
|
|
|
|
|
- // 菌群检测:走健康报告异步采集
|
|
|
- uploadReportOnly(filePath, self.uploadType).then(function(res) {
|
|
|
+// 统一上传:舌诊照片(uploadType=tongue)走舌诊专用流程;其余 type=auto,后台指纹判定后走对应采集管道(dan_a2 → DAN入库 / 其余 → 健康报告)
|
|
|
+ uploadReportOnly(filePath, self.uploadType || 'auto', self.memberId).then(function(res) {
|
|
|
uni.hideLoading()
|
|
|
self.uploading = false
|
|
|
var data = res.data || {}
|
|
|
@@ -417,58 +365,6 @@ export default {
|
|
|
uni.showToast({ title: msg, icon: 'none' })
|
|
|
})
|
|
|
},
|
|
|
- uploadA2Report: function(filePath, fileName) {
|
|
|
- if (!this.ensureA2Member()) return
|
|
|
- var name = (fileName || '').toLowerCase()
|
|
|
- if (name && name.indexOf('.pdf') < 0 && name !== '聊天文件') {
|
|
|
- uni.showToast({ title: '素质测评 A2 仅支持 PDF', icon: 'none' })
|
|
|
- return
|
|
|
- }
|
|
|
- var self = this
|
|
|
- self.uploading = true
|
|
|
- self.uploadingText = '正在解析 A2 报告...'
|
|
|
- uni.showLoading({ title: '解析中...' })
|
|
|
- danParsePreview(filePath, 'mind', self.memberId).then(function(res) {
|
|
|
- var data = (res && res.data) || {}
|
|
|
- var uploadId = data.uploadId || data.draftId
|
|
|
- if (!uploadId) {
|
|
|
- uni.hideLoading()
|
|
|
- self.uploading = false
|
|
|
- uni.showToast({ title: (res && res.message) || 'A2 解析失败', icon: 'none' })
|
|
|
- return
|
|
|
- }
|
|
|
- var extra = {}
|
|
|
- try {
|
|
|
- extra = typeof data.extraJson === 'string' ? JSON.parse(data.extraJson) : (data.extraJson || {})
|
|
|
- } catch (e) {
|
|
|
- extra = {}
|
|
|
- }
|
|
|
- var childName = extra.name || ''
|
|
|
- var assessmentDate = extra.reportDate || ''
|
|
|
- if (assessmentDate && assessmentDate.length >= 10) {
|
|
|
- assessmentDate = assessmentDate.substring(0, 10)
|
|
|
- }
|
|
|
- return danConfirmReport({
|
|
|
- draftId: uploadId,
|
|
|
- childName: childName,
|
|
|
- assessmentDate: assessmentDate
|
|
|
- }).then(function(confirmRes) {
|
|
|
- uni.hideLoading()
|
|
|
- self.uploading = false
|
|
|
- var confirmData = (confirmRes && confirmRes.data) || {}
|
|
|
- var reportId = confirmData.uploadId || uploadId
|
|
|
- uni.showToast({ title: 'A2 报告已入库', icon: 'success' })
|
|
|
- setTimeout(function() {
|
|
|
- uni.redirectTo({ url: '/pages/dan-assessment/report-result?reportId=' + reportId })
|
|
|
- }, 600)
|
|
|
- })
|
|
|
- }).catch(function(err) {
|
|
|
- uni.hideLoading()
|
|
|
- self.uploading = false
|
|
|
- var msg = (err && err.message) || 'A2 解析失败,请重试'
|
|
|
- uni.showToast({ title: msg, icon: 'none', duration: 3000 })
|
|
|
- })
|
|
|
- },
|
|
|
stopCollectPolling: function() {
|
|
|
if (this.collectTimer) {
|
|
|
clearInterval(this.collectTimer)
|
|
|
@@ -504,8 +400,10 @@ export default {
|
|
|
var reportType = data.reportType || 'gut_flora'
|
|
|
setTimeout(function() {
|
|
|
if (reportId) {
|
|
|
- // 统一跳转到健康报告详情页(后端指纹识别后统一入库到 health_report 表)
|
|
|
- if (reportType === 'gut_flora') {
|
|
|
+ // 后端指纹识别后统一入库:dan_a2 → DAN 报告页,其余 → 健康报告详情页
|
|
|
+ if (reportType === 'dan_a2') {
|
|
|
+ uni.redirectTo({ url: '/pages/dan-assessment/report-result?reportId=' + reportId })
|
|
|
+ } else if (reportType === 'gut_flora') {
|
|
|
uni.redirectTo({ url: '/pages/health/gut-flora-detail?reportId=' + reportId })
|
|
|
} else {
|
|
|
uni.redirectTo({ url: '/pages/health/report-detail?reportType=' + reportType + '&reportId=' + reportId })
|
|
|
@@ -577,51 +475,6 @@ export default {
|
|
|
.form-section {
|
|
|
margin: 0 30rpx;
|
|
|
}
|
|
|
-.type-section {
|
|
|
- margin-bottom: 20rpx;
|
|
|
-}
|
|
|
-.type-methods {
|
|
|
- display: flex;
|
|
|
- flex-direction: row;
|
|
|
- gap: 16rpx;
|
|
|
-}
|
|
|
-.type-card {
|
|
|
- flex: 1;
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- align-items: flex-start;
|
|
|
- padding: 24rpx 20rpx;
|
|
|
- border-radius: 16rpx;
|
|
|
- background: #fff;
|
|
|
- border: 2rpx solid #E2E8F0;
|
|
|
-}
|
|
|
-.type-card-active {
|
|
|
- border-color: #5B9BD5;
|
|
|
- background: #F0F7FF;
|
|
|
-}
|
|
|
-.type-gut.type-card-active {
|
|
|
- border-color: #22C55E;
|
|
|
- background: #F0FDF4;
|
|
|
-}
|
|
|
-.type-a2.type-card-active {
|
|
|
- border-color: #8B5CF6;
|
|
|
- background: #F5F3FF;
|
|
|
-}
|
|
|
-.type-card-icon {
|
|
|
- font-size: 40rpx;
|
|
|
- margin-bottom: 10rpx;
|
|
|
-}
|
|
|
-.type-card-title {
|
|
|
- font-size: 26rpx;
|
|
|
- font-weight: 600;
|
|
|
- color: #1E293B;
|
|
|
- margin-bottom: 6rpx;
|
|
|
-}
|
|
|
-.type-card-desc {
|
|
|
- font-size: 20rpx;
|
|
|
- color: #94A3B8;
|
|
|
- line-height: 1.5;
|
|
|
-}
|
|
|
.member-box {
|
|
|
background: #fff;
|
|
|
border-radius: 16rpx;
|