hh-doctor-sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/apis/api-host-define.js +69 -0
- package/components/apis/consultation-reply-api.js +21 -0
- package/components/apis/dicom-api.js +31 -0
- package/components/apis/family-api.js +20 -0
- package/components/apis/file-upload-api.js +35 -0
- package/components/apis/order-app-api.js +206 -0
- package/components/apis/stat-log-api.js +42 -0
- package/components/apis/video-chat-log-api.js +47 -0
- package/components/apis/video-message-api.js +88 -0
- package/components/consultation/detail/behaviors/chat-cell-base-behaviors.js +29 -0
- package/components/consultation/detail/behaviors/consultation-behaviors.js +60 -0
- package/components/consultation/detail/behaviors/consultation-chat-behaviors.js +321 -0
- package/components/consultation/detail/behaviors/consultation-header-media-behaviors.js +176 -0
- package/components/consultation/detail/behaviors/consultation-header-text-behaviors.js +325 -0
- package/components/consultation/detail/behaviors/consultation-reply-behaviors.js +67 -0
- package/components/consultation/detail/consultation-detail-page.js +219 -0
- package/components/consultation/detail/consultation-detail-page.json +10 -0
- package/components/consultation/detail/consultation-detail-page.wxml +65 -0
- package/components/consultation/detail/consultation-detail-page.wxss +51 -0
- package/components/consultation/detail/widget/case-image-filter.js +47 -0
- package/components/consultation/detail/widget/chat-base-cell/chat-base-cell.js +31 -0
- package/components/consultation/detail/widget/chat-base-cell/chat-base-cell.json +4 -0
- package/components/consultation/detail/widget/chat-base-cell/chat-base-cell.wxml +17 -0
- package/components/consultation/detail/widget/chat-base-cell/chat-base-cell.wxss +9 -0
- package/components/consultation/detail/widget/chat-bottom/chat-bottom.js +100 -0
- package/components/consultation/detail/widget/chat-bottom/chat-bottom.json +4 -0
- package/components/consultation/detail/widget/chat-bottom/chat-bottom.wxml +24 -0
- package/components/consultation/detail/widget/chat-bottom/chat-bottom.wxss +54 -0
- package/components/consultation/detail/widget/chat-bottom/chat-menu-builder.js +131 -0
- package/components/consultation/detail/widget/chat-cell-template/chat-cell-template.wxml +173 -0
- package/components/consultation/detail/widget/chat-cell.wxss +394 -0
- package/components/consultation/detail/widget/detail-media/detail-media.js +47 -0
- package/components/consultation/detail/widget/detail-media/detail-media.json +4 -0
- package/components/consultation/detail/widget/detail-media/detail-media.wxml +12 -0
- package/components/consultation/detail/widget/detail-media/detail-media.wxss +57 -0
- package/components/consultation/detail/widget/detail-text/detail-text.js +31 -0
- package/components/consultation/detail/widget/detail-text/detail-text.json +4 -0
- package/components/consultation/detail/widget/detail-text/detail-text.wxml +6 -0
- package/components/consultation/detail/widget/detail-text/detail-text.wxss +14 -0
- package/components/consultation/evaluate/evaluate-page.js +157 -0
- package/components/consultation/evaluate/evaluate-page.json +3 -0
- package/components/consultation/evaluate/evaluate-page.wxml +42 -0
- package/components/consultation/evaluate/evaluate-page.wxss +103 -0
- package/components/consultation/list/behaviors/consultation-list-base-behaviors.js +144 -0
- package/components/consultation/list/consultation-list-page.js +84 -0
- package/components/consultation/list/consultation-list-page.json +5 -0
- package/components/consultation/list/consultation-list-page.wxml +53 -0
- package/components/consultation/list/consultation-list-page.wxss +105 -0
- package/components/consultation/reply/behaviors/reply-base-behaviors.js +175 -0
- package/components/consultation/reply/consultation-reply-page.js +251 -0
- package/components/consultation/reply/consultation-reply-page.json +6 -0
- package/components/consultation/reply/consultation-reply-page.wxml +103 -0
- package/components/consultation/reply/consultation-reply-page.wxss +169 -0
- package/components/consultation/reply/widget/audio-record-view/audio-record-view.js +144 -0
- package/components/consultation/reply/widget/audio-record-view/audio-record-view.json +4 -0
- package/components/consultation/reply/widget/audio-record-view/audio-record-view.wxml +27 -0
- package/components/consultation/reply/widget/audio-record-view/audio-record-view.wxss +197 -0
- package/components/hh-doctor.js +36 -0
- package/components/hh-navigation.js +87 -0
- package/components/public/app-config.js +13 -0
- package/components/public/behaviors/order-base-behaviors.js +53 -0
- package/components/public/cache-data.js +134 -0
- package/components/public/doctor-loader.js +60 -0
- package/components/public/im-manager.js +135 -0
- package/components/public/pdf-viewer.js +59 -0
- package/components/public/stat-log.js +13 -0
- package/components/static/Agora_Miniapp_SDK_for_WeChat.js +2 -0
- package/components/static/trtc-wx.js +2 -0
- package/components/uikit/css/common.wxss +23 -0
- package/components/uikit/custom-bottom-pop/custom-bottom-pop.js +37 -0
- package/components/uikit/custom-bottom-pop/custom-bottom-pop.json +4 -0
- package/components/uikit/custom-bottom-pop/custom-bottom-pop.wxml +9 -0
- package/components/uikit/custom-bottom-pop/custom-bottom-pop.wxss +79 -0
- package/components/uikit/date-time-picker/date-time-picker.js +115 -0
- package/components/uikit/web-view-page/web-view-page.js +87 -0
- package/components/uikit/web-view-page/web-view-page.json +3 -0
- package/components/uikit/web-view-page/web-view-page.wxml +6 -0
- package/components/uikit/web-view-page/web-view-page.wxss +1 -0
- package/components/utils/checksumUtils.js +56 -0
- package/components/utils/common-utils.js +59 -0
- package/components/utils/dateUtils.js +142 -0
- package/components/utils/eventBus.js +77 -0
- package/components/utils/httpUtils.js +123 -0
- package/components/utils/number-utils.js +48 -0
- package/components/utils/permission-utils.js +164 -0
- package/components/video-chat/agora-rtc/agora-player/agora-player.js +106 -0
- package/components/video-chat/agora-rtc/agora-player/agora-player.json +4 -0
- package/components/video-chat/agora-rtc/agora-player/agora-player.wxml +24 -0
- package/components/video-chat/agora-rtc/agora-player/agora-player.wxss +1 -0
- package/components/video-chat/agora-rtc/agora-pusher/agora-pusher.js +92 -0
- package/components/video-chat/agora-rtc/agora-pusher/agora-pusher.json +4 -0
- package/components/video-chat/agora-rtc/agora-pusher/agora-pusher.wxml +22 -0
- package/components/video-chat/agora-rtc/agora-pusher/agora-pusher.wxss +1 -0
- package/components/video-chat/agora-rtc/agora-rtc.js +391 -0
- package/components/video-chat/agora-rtc/agora-rtc.json +7 -0
- package/components/video-chat/agora-rtc/agora-rtc.wxml +39 -0
- package/components/video-chat/agora-rtc/agora-rtc.wxss +1 -0
- package/components/video-chat/callback/callback.js +39 -0
- package/components/video-chat/callback/callback.json +4 -0
- package/components/video-chat/callback/callback.wxml +29 -0
- package/components/video-chat/callback/callback.wxss +26 -0
- package/components/video-chat/calling/calling.js +75 -0
- package/components/video-chat/calling/calling.json +4 -0
- package/components/video-chat/calling/calling.wxml +32 -0
- package/components/video-chat/calling/calling.wxss +45 -0
- package/components/video-chat/controller/controller.js +86 -0
- package/components/video-chat/controller/controller.json +4 -0
- package/components/video-chat/controller/controller.wxml +73 -0
- package/components/video-chat/controller/controller.wxss +71 -0
- package/components/video-chat/remote-player/remote-player.js +42 -0
- package/components/video-chat/remote-player/remote-player.json +4 -0
- package/components/video-chat/remote-player/remote-player.wxml +37 -0
- package/components/video-chat/remote-player/remote-player.wxss +1 -0
- package/components/video-chat/video-chat.js +297 -0
- package/components/video-chat/video-chat.json +7 -0
- package/components/video-chat/video-chat.wxml +56 -0
- package/components/video-chat/video-chat.wxss +97 -0
- package/components/video-chat-page/behaviors/chat-files-behaviors.js +243 -0
- package/components/video-chat-page/behaviors/chat-log-behaviors.js +90 -0
- package/components/video-chat-page/behaviors/chat-sound-behaviors.js +60 -0
- package/components/video-chat-page/behaviors/video-chat-behaviors.js +524 -0
- package/components/video-chat-page/case-group-view/case-group-view.js +38 -0
- package/components/video-chat-page/case-group-view/case-group-view.json +4 -0
- package/components/video-chat-page/case-group-view/case-group-view.wxml +32 -0
- package/components/video-chat-page/case-group-view/case-group-view.wxss +44 -0
- package/components/video-chat-page/video-chat-defines.js +39 -0
- package/components/video-chat-page/video-chat-page.js +212 -0
- package/components/video-chat-page/video-chat-page.json +14 -0
- package/components/video-chat-page/video-chat-page.wxml +88 -0
- package/components/video-chat-page/video-chat-page.wxss +45 -0
- package/package.json +18 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
const cache = require('../../../public/cache-data')
|
|
2
|
+
const dateUtils = require('../../../utils/dateUtils')
|
|
3
|
+
const pdfViewer = require('../../../public/pdf-viewer')
|
|
4
|
+
const caseImageFilter = require('../widget/case-image-filter')
|
|
5
|
+
const commonUtils = require('../../../utils/common-utils')
|
|
6
|
+
const dateTimePicker = require('../../../uikit/date-time-picker/date-time-picker')
|
|
7
|
+
|
|
8
|
+
const MessageTypes = {
|
|
9
|
+
text: 0,
|
|
10
|
+
voice: 1,
|
|
11
|
+
image: 2,
|
|
12
|
+
video: 3,
|
|
13
|
+
notice: 4,
|
|
14
|
+
tips: 5,
|
|
15
|
+
askType: 6,
|
|
16
|
+
update: 7,
|
|
17
|
+
evaluate: 8,
|
|
18
|
+
dicom: 9,
|
|
19
|
+
linkNotice: 10,
|
|
20
|
+
notify_time: 11,
|
|
21
|
+
notify_end_time: 12,
|
|
22
|
+
pay: 13,
|
|
23
|
+
file: 14,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const MessageTemplates = {
|
|
27
|
+
text: 'textItem',
|
|
28
|
+
sound: 'soundItem',
|
|
29
|
+
image: 'imageItem',
|
|
30
|
+
video: 'videoItem',
|
|
31
|
+
notice: 'textItem',
|
|
32
|
+
tips: 'chatTip',
|
|
33
|
+
askType: 'textItem',
|
|
34
|
+
update: 'updateNotice',
|
|
35
|
+
evaluate: 'Evaluate',
|
|
36
|
+
dicom: 'dicomItem',
|
|
37
|
+
linkNotice: 'textItem',
|
|
38
|
+
notify_time: 'videoTimeItem',
|
|
39
|
+
notify_end_time: 'videoEndTime',
|
|
40
|
+
pay: 'textItem',
|
|
41
|
+
file: 'pdfItem',
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = Behavior({
|
|
45
|
+
|
|
46
|
+
data: {
|
|
47
|
+
messageDatas: [], // 原始信息流数据
|
|
48
|
+
messages: [], // 构建信息流数据
|
|
49
|
+
messageMediaFiles: [], // 图片和视频数据
|
|
50
|
+
scrollTo: null,
|
|
51
|
+
dateTimeArray: null,
|
|
52
|
+
dateTime: null,
|
|
53
|
+
showPreview: false,
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
methods: {
|
|
57
|
+
|
|
58
|
+
needShowEvaluate(isRequest) {
|
|
59
|
+
let order = this.data.order
|
|
60
|
+
let finish = order.state == 2
|
|
61
|
+
let isMDTExpert = order.serviceGroupName === 'MDT' && isRequest
|
|
62
|
+
let isInvite = order.orderService.serviceType === 'Temp' && order.orderService.provideType !== 'video'
|
|
63
|
+
return finish && !isMDTExpert && !isInvite
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
buildMessages() {
|
|
67
|
+
let order = this.data.order
|
|
68
|
+
const orderAskList = order.orderaskList
|
|
69
|
+
const isRequest = cache.isRequest(order.doctorid)
|
|
70
|
+
if (orderAskList && orderAskList.length > 0) {
|
|
71
|
+
const list = orderAskList.map((value, index, array) => {
|
|
72
|
+
return this.createMessageItem(index, value, isRequest)
|
|
73
|
+
}) || []
|
|
74
|
+
if (this.needShowEvaluate(isRequest)) {
|
|
75
|
+
// 添加评价
|
|
76
|
+
list.push(this.createLocalCustomItem(list.length, MessageTypes.evaluate, MessageTemplates.evaluate))
|
|
77
|
+
}
|
|
78
|
+
this.setData({
|
|
79
|
+
messageDatas: orderAskList,
|
|
80
|
+
messages: list,
|
|
81
|
+
isRequest: isRequest,
|
|
82
|
+
}, () => {
|
|
83
|
+
this.setData({
|
|
84
|
+
scrollTo: `message-bottom`
|
|
85
|
+
})
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
createLocalCustomItem(index, type, template) {
|
|
91
|
+
var message = {}
|
|
92
|
+
message.index = index
|
|
93
|
+
message.type = type
|
|
94
|
+
message.template = template
|
|
95
|
+
message.custom = true
|
|
96
|
+
message.feedbackStar = this.data.feedbackStar
|
|
97
|
+
return message
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
createMessageItem(index, data, isRequest) {
|
|
101
|
+
var message = {}
|
|
102
|
+
const isSend = cache.doctorId() == data.doctor.doctorid
|
|
103
|
+
const status = data.status
|
|
104
|
+
const contentType = data.contentType
|
|
105
|
+
const caseImageList = data.caseImageList
|
|
106
|
+
const comments = data.comments
|
|
107
|
+
message.index = index
|
|
108
|
+
message.id = data.id
|
|
109
|
+
message.name = data.doctor.name
|
|
110
|
+
message.isRequest = isRequest
|
|
111
|
+
message.isSend = isSend
|
|
112
|
+
/**
|
|
113
|
+
* 200 supplement
|
|
114
|
+
* 2 reply
|
|
115
|
+
* 3 reject
|
|
116
|
+
* 201 singleReply
|
|
117
|
+
* 203 mdtDiscuss
|
|
118
|
+
* 0 none
|
|
119
|
+
* 4 rejectTime
|
|
120
|
+
* 204 innerUpdate
|
|
121
|
+
* 205 notifyUpdate
|
|
122
|
+
* 206 notice
|
|
123
|
+
* 300 feedback
|
|
124
|
+
* -1 custom
|
|
125
|
+
*/
|
|
126
|
+
message.status = status
|
|
127
|
+
const isRedo = comments == '撤销'
|
|
128
|
+
if (isRedo) {
|
|
129
|
+
message.type = MessageTypes.notice
|
|
130
|
+
if (isSend) {
|
|
131
|
+
message.content = message.status == 200 ? '你撤回了一条消息,请重新提交补充内容' : '你撤回了一条消息,请重新回复'
|
|
132
|
+
} else {
|
|
133
|
+
message.content = `“${message.name}”撤销了一条消息`
|
|
134
|
+
}
|
|
135
|
+
return message
|
|
136
|
+
}
|
|
137
|
+
if (status == 206) {
|
|
138
|
+
message.type = MessageTypes.notice
|
|
139
|
+
message.content = comments
|
|
140
|
+
return message
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if ([204, 205].includes(status)) {
|
|
144
|
+
message.type = MessageTypes.update
|
|
145
|
+
message.content = comments
|
|
146
|
+
message.template = MessageTemplates.update
|
|
147
|
+
message.custom = true
|
|
148
|
+
return message
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (contentType == 'immuno') {
|
|
152
|
+
message.type = MessageTypes.linkNotice
|
|
153
|
+
message.content = `本平台提供上述免疫组化的支持服务,如有需要,<br>请<font color ='#1482F0'>点击此处</font></br>查看相关费用并支付`
|
|
154
|
+
return message
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
message.photo = data.doctor.photourl
|
|
158
|
+
const createtime = dateUtils.format(new Date(data.createtime), 'MM-dd hh:mm')
|
|
159
|
+
message.createtime = createtime
|
|
160
|
+
|
|
161
|
+
if (comments) {
|
|
162
|
+
message.type = MessageTypes.text
|
|
163
|
+
message.content = comments
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (data.contentSound && data.contentSound.length > 0) {
|
|
167
|
+
message.type = MessageTypes.voice
|
|
168
|
+
message.voiceUrl = data.contentSound
|
|
169
|
+
message.template = MessageTemplates.sound
|
|
170
|
+
message.animationValue = 3
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (caseImageList && caseImageList.length > 0) {
|
|
174
|
+
const isVideo = caseImageList[0].imageurl.includes('.mp4')
|
|
175
|
+
message.type = MessageTypes.image
|
|
176
|
+
message.images = caseImageList
|
|
177
|
+
message.isVideo = isVideo
|
|
178
|
+
message.cover = caseImageList[0].smallImage
|
|
179
|
+
message.number = `共${caseImageList.length}${isVideo ? '个' : '张'}`
|
|
180
|
+
message.template = MessageTemplates.image
|
|
181
|
+
|
|
182
|
+
const imageList = caseImageFilter.imageList(caseImageList)
|
|
183
|
+
const messageMediaFiles = this.data.messageMediaFiles.concat(imageList)
|
|
184
|
+
this.setData({
|
|
185
|
+
messageMediaFiles: messageMediaFiles
|
|
186
|
+
})
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (contentType == 'dicom') {
|
|
190
|
+
if (comments && comments.length > 0) {
|
|
191
|
+
message.type = MessageTypes.notice
|
|
192
|
+
message.content = comments
|
|
193
|
+
} else {
|
|
194
|
+
message.type = MessageTypes.dicom
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (contentType == 'videotime') { // 视频时间
|
|
199
|
+
message.type = MessageTypes.notify_time
|
|
200
|
+
message.template = MessageTemplates.notify_time
|
|
201
|
+
if (data.showUpdateProvideTime && isSend) {
|
|
202
|
+
message.canEdit = true
|
|
203
|
+
message.dateTimeArray = this.data.dateTimeArray
|
|
204
|
+
message.dateTime = this.data.dateTime
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (contentType == 'videofinish') {
|
|
209
|
+
message.type = MessageTypes.notify_end_time
|
|
210
|
+
message.template = MessageTemplates.notify_end_time
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (contentType == 'pay') {
|
|
214
|
+
message.type = MessageTypes.pay
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (contentType == 'tips') {
|
|
218
|
+
message.type = MessageTypes.tips
|
|
219
|
+
message.template = MessageTemplates.tips
|
|
220
|
+
message.showButton = this.data.order.hiddene != 1
|
|
221
|
+
message.custom = true
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
if (contentType == 'file') {
|
|
225
|
+
message.type = MessageTypes.file
|
|
226
|
+
message.template = MessageTemplates.file
|
|
227
|
+
if (data.commentsExtends && data.commentsExtends.length > 0) {
|
|
228
|
+
const fileData = JSON.parse(data.commentsExtends)
|
|
229
|
+
if (fileData) {
|
|
230
|
+
const fileSize = `${(fileData.size / 1000).toFixed(2)}M`
|
|
231
|
+
message.file = {
|
|
232
|
+
name: fileData.name,
|
|
233
|
+
size: fileSize
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (!message.type) {
|
|
240
|
+
message.type = MessageTypes.text
|
|
241
|
+
}
|
|
242
|
+
if (!message.template) {
|
|
243
|
+
message.template = MessageTemplates.text
|
|
244
|
+
}
|
|
245
|
+
if (message.type == MessageTypes.text) {
|
|
246
|
+
const array = commonUtils.findLinkFromText(message.content)
|
|
247
|
+
if (array && array.length > 0) {
|
|
248
|
+
message.textArray = array
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return message
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
clickMessageCell(event) {
|
|
255
|
+
const {
|
|
256
|
+
index
|
|
257
|
+
} = event.detail
|
|
258
|
+
const messageItem = this.data.messages[index]
|
|
259
|
+
const type = messageItem.type
|
|
260
|
+
switch (type) {
|
|
261
|
+
case MessageTypes.text:
|
|
262
|
+
break
|
|
263
|
+
case MessageTypes.file:
|
|
264
|
+
const url = messageItem.images[0].imageurl
|
|
265
|
+
pdfViewer.viewPdf(url)
|
|
266
|
+
break
|
|
267
|
+
case MessageTypes.image:
|
|
268
|
+
this.clickMessageImage(messageItem)
|
|
269
|
+
break
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* 点击消息
|
|
275
|
+
* @param {*} messageItem
|
|
276
|
+
*/
|
|
277
|
+
clickMessageImage(messageItem) {
|
|
278
|
+
const imageurl = messageItem.images[0].imageurl
|
|
279
|
+
const find = this.data.messageMediaFiles.findIndex((value, index, array) => {
|
|
280
|
+
return value.url == imageurl
|
|
281
|
+
})
|
|
282
|
+
if (find >= 0) {
|
|
283
|
+
wx.previewMedia({
|
|
284
|
+
current: find,
|
|
285
|
+
sources: this.data.messageMediaFiles,
|
|
286
|
+
})
|
|
287
|
+
} else {
|
|
288
|
+
wx.previewMedia({
|
|
289
|
+
sources: this.data.messageMediaFiles,
|
|
290
|
+
})
|
|
291
|
+
}
|
|
292
|
+
this.setData({
|
|
293
|
+
showPreview: true,
|
|
294
|
+
})
|
|
295
|
+
},
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* 更新时间选择器
|
|
299
|
+
* @param {*} update 是否只更新已选中时间
|
|
300
|
+
*/
|
|
301
|
+
datePickerTime(update) {
|
|
302
|
+
const current = new Date()
|
|
303
|
+
const currentYear = current.getFullYear()
|
|
304
|
+
const currentDate = dateUtils.format(current, 'yyyy-MM-dd hh:mm:ss')
|
|
305
|
+
if (update && this.data.dateTimeArray) {
|
|
306
|
+
const current = dateTimePicker.dateTime(this.data.dateTimeArray, currentDate)
|
|
307
|
+
this.setData({
|
|
308
|
+
dateTime: current
|
|
309
|
+
})
|
|
310
|
+
} else {
|
|
311
|
+
var datas = dateTimePicker.dateTimePicker(currentYear, currentYear + 50, currentDate)
|
|
312
|
+
datas.dateTimeArray.pop()
|
|
313
|
+
datas.dateTime.pop()
|
|
314
|
+
this.setData({
|
|
315
|
+
dateTimeArray: datas.dateTimeArray,
|
|
316
|
+
dateTime: datas.dateTime
|
|
317
|
+
})
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
}
|
|
321
|
+
})
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
const pdfViewer = require('../../../public/pdf-viewer')
|
|
2
|
+
const dicomApi = require('../../../apis/dicom-api')
|
|
3
|
+
const caseImageFilter = require('../widget/case-image-filter')
|
|
4
|
+
const hhNavigation = require('../../../hh-navigation')
|
|
5
|
+
|
|
6
|
+
module.exports = Behavior({
|
|
7
|
+
|
|
8
|
+
data: {
|
|
9
|
+
_mediaFiles: [], // 图片和视频
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
methods: {
|
|
13
|
+
/**
|
|
14
|
+
* 加载DICOM数据
|
|
15
|
+
*/
|
|
16
|
+
loadDicom() {
|
|
17
|
+
wx.statLog.sendStatLog(this.data.orderId, '获取订单中的DICOM数据')
|
|
18
|
+
dicomApi.getDicom(this.data.orderId).then((res) => {
|
|
19
|
+
wx.statLog.sendStatLog(this.data.orderId, '获取订单中的DICOM数据完成')
|
|
20
|
+
if (res.status == 200 && res.data && res.data.list && res.data.list.length > 0) {
|
|
21
|
+
this.setData({
|
|
22
|
+
dicoms: res.data.list
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
}).catch((err) => {
|
|
26
|
+
wx.statLog.sendStatLog(this.data.orderId, `获取订单中的DICOM数据失败(${JSON.stringify(err)})`)
|
|
27
|
+
})
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 构建多媒体文件数据
|
|
32
|
+
* @param {*} index 分组下标
|
|
33
|
+
* @param {*} type 类型 0.图片 1.pdf 3.DICOM 4. 视频
|
|
34
|
+
* @param {*} label 显示标题
|
|
35
|
+
* @param {*} files 文件列表
|
|
36
|
+
*/
|
|
37
|
+
mediaItem(index, type, label, files, icon, showNumber = '点击查看') {
|
|
38
|
+
return {
|
|
39
|
+
index: index,
|
|
40
|
+
type: type,
|
|
41
|
+
label: label,
|
|
42
|
+
files: files,
|
|
43
|
+
icon: icon,
|
|
44
|
+
showNumber: showNumber
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 组织头部媒体数据显示
|
|
50
|
+
*/
|
|
51
|
+
buildMediaFiles() {
|
|
52
|
+
const order = this.data.order
|
|
53
|
+
var groupIndex = 0
|
|
54
|
+
var mediaGroups = []
|
|
55
|
+
order.orderComponent.componentBaseList.forEach((value, index, array) => {
|
|
56
|
+
if (value.type != 'url') {
|
|
57
|
+
const name = value.name
|
|
58
|
+
const type = value.type
|
|
59
|
+
if (value.contentCaseImageList && value.contentCaseImageList.length > 0) {
|
|
60
|
+
const imageList = caseImageFilter.imageList(value.contentCaseImageList)
|
|
61
|
+
const pdfList = caseImageFilter.pdfList(value.contentCaseImageList)
|
|
62
|
+
const imageCount = imageList.length
|
|
63
|
+
if (imageCount > 0) {
|
|
64
|
+
const isVideo = imageList[0].type == 'video'
|
|
65
|
+
const unit = isVideo ? '个' : '张'
|
|
66
|
+
const fileType = isVideo ? 4 : 0
|
|
67
|
+
const showNumber = !['HISINFO', 'METER'].includes(type.toUpperCase()) ? `共${imageCount}${unit}` : '点击查看'
|
|
68
|
+
mediaGroups.push(this.mediaItem(groupIndex, fileType, name, imageList, imageList[0].thumb, showNumber))
|
|
69
|
+
const allImages = this.data._mediaFiles.concat(imageList)
|
|
70
|
+
this.data._mediaFiles = allImages
|
|
71
|
+
groupIndex++
|
|
72
|
+
}
|
|
73
|
+
if (pdfList.length > 0) {
|
|
74
|
+
const showNumber = pdfList.length > 1 ? `共${pdfList.length}个` : '点击查看'
|
|
75
|
+
mediaGroups.push(this.mediaItem(groupIndex, 1, `${name}PDF`, pdfList, 'https://imgs.hh-medic.com/icon/hh_icon_pdf.png', showNumber))
|
|
76
|
+
groupIndex++
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
if (order.patient.patientdirs && order.patient.patientdirs.length > 0) {
|
|
83
|
+
mediaGroups.push(this.mediaItem(groupIndex, 2, 'DICOM', [], 'https://imgs.hh-medic.com/icon/hh_consulation_dicom_icon.png', '点击查看'))
|
|
84
|
+
groupIndex++
|
|
85
|
+
}
|
|
86
|
+
this.setData({
|
|
87
|
+
mediaInfo: mediaGroups
|
|
88
|
+
})
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
pdfData(url) {
|
|
92
|
+
const index = url.indexOf('?')
|
|
93
|
+
if (index >= 0) {
|
|
94
|
+
url = url.substring(0, index)
|
|
95
|
+
}
|
|
96
|
+
const name = url.substring(url.lastIndexOf('/') + 1)
|
|
97
|
+
return {
|
|
98
|
+
url: url,
|
|
99
|
+
name: name
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
clickMedia(event) {
|
|
104
|
+
const {
|
|
105
|
+
index
|
|
106
|
+
} = event.detail
|
|
107
|
+
const media = this.data.mediaInfo[index]
|
|
108
|
+
if ([0, 4].includes(media.type)) { //图片或视频
|
|
109
|
+
const firstPic = media.files[0].url //统一用构建的数据所以不能使用原始数据判断
|
|
110
|
+
const find = this.data._mediaFiles.findIndex((value, index, array) => {
|
|
111
|
+
return value.url == firstPic
|
|
112
|
+
})
|
|
113
|
+
if (find >= 0) {
|
|
114
|
+
wx.previewMedia({
|
|
115
|
+
current: find,
|
|
116
|
+
sources: this.data._mediaFiles,
|
|
117
|
+
})
|
|
118
|
+
} else {
|
|
119
|
+
wx.previewMedia({
|
|
120
|
+
sources: this.data._mediaFiles,
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
this.setData({
|
|
124
|
+
showPreview: true,
|
|
125
|
+
})
|
|
126
|
+
} else if (media.type == 1) { // PDF
|
|
127
|
+
const files = media.files
|
|
128
|
+
pdfViewer.viewPdfs(files)
|
|
129
|
+
} else if (media.type == 2) {
|
|
130
|
+
this.viewDicoms()
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* 存在多个DICOM需要显示列表选择点击后查看单个DICOM
|
|
136
|
+
*/
|
|
137
|
+
viewDicoms() {
|
|
138
|
+
if (this.data.dicoms.length == 0) {
|
|
139
|
+
wx.showToast({
|
|
140
|
+
icon: 'none',
|
|
141
|
+
title: '无DICOM可查看',
|
|
142
|
+
})
|
|
143
|
+
return
|
|
144
|
+
}
|
|
145
|
+
const dicoms = this.data.dicoms
|
|
146
|
+
if (dicoms.length == 1) {
|
|
147
|
+
this.viewDicom(dicoms[0].id)
|
|
148
|
+
} else {
|
|
149
|
+
const items = dicoms.filter((dicom) => {
|
|
150
|
+
return dicom.related == 1
|
|
151
|
+
}).map((file) => {
|
|
152
|
+
return file.name
|
|
153
|
+
})
|
|
154
|
+
wx.showActionSheet({
|
|
155
|
+
itemList: items,
|
|
156
|
+
success: (res) => {
|
|
157
|
+
const id = dicoms[res.tapIndex].id
|
|
158
|
+
this.viewDicom(id)
|
|
159
|
+
},
|
|
160
|
+
fail: function (ers) {
|
|
161
|
+
|
|
162
|
+
}
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* 查看单个DICOM数据
|
|
169
|
+
* @param {*} id dicom的ID
|
|
170
|
+
*/
|
|
171
|
+
viewDicom(id) {
|
|
172
|
+
const url = dicomApi.dicomUrl(id)
|
|
173
|
+
hhNavigation.webPage(url)
|
|
174
|
+
},
|
|
175
|
+
}
|
|
176
|
+
})
|