hh-doctor-sdk 0.4.1 → 0.4.3

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.
@@ -48,7 +48,7 @@ module.exports = Behavior({
48
48
  data: {
49
49
  messageDatas: [], // 原始信息流数据
50
50
  messages: [], // 构建信息流数据
51
- messageMediaFiles: [], // 图片和视频数据
51
+ // messageMediaFiles: [], // 图片和视频数据
52
52
  scrollTo: null,
53
53
  dateTimeArray: null,
54
54
  dateTime: null,
@@ -180,18 +180,18 @@ module.exports = Behavior({
180
180
 
181
181
  if (caseImageList && caseImageList.length > 0) {
182
182
  const isVideo = caseImageList[0].imageurl.includes('.mp4')
183
- message.type = MessageTypes.image
183
+ message.type = isVideo ? MessageTypes.video : MessageTypes.image
184
184
  message.images = caseImageList
185
185
  message.isVideo = isVideo
186
186
  message.cover = isVideo ? caseImageList[0].imageurl + '?x-oss-process=video/snapshot,t_0,f_jpg' : caseImageList[0].smallImage
187
187
  message.number = `共${caseImageList.length}${isVideo ? '个' : '张'}`
188
188
  message.template = MessageTemplates.image
189
189
 
190
- const imageList = caseImageFilter.imageList(caseImageList)
191
- const messageMediaFiles = this.data.messageMediaFiles.concat(imageList)
192
- this.setData({
193
- messageMediaFiles: messageMediaFiles
194
- })
190
+ // const imageList = caseImageFilter.imageList(caseImageList)
191
+ // const messageMediaFiles = this.data.messageMediaFiles.concat(imageList)
192
+ // this.setData({
193
+ // messageMediaFiles: messageMediaFiles
194
+ // })
195
195
  }
196
196
 
197
197
  if (contentType == 'dicom') {
@@ -279,6 +279,9 @@ module.exports = Behavior({
279
279
  case MessageTypes.image:
280
280
  this.clickMessageImage(messageItem)
281
281
  break
282
+ case MessageTypes.video:
283
+ this.clickMessageImage(messageItem, true)
284
+ break
282
285
  }
283
286
  },
284
287
 
@@ -286,20 +289,25 @@ module.exports = Behavior({
286
289
  * 点击消息
287
290
  * @param {*} messageItem
288
291
  */
289
- clickMessageImage(messageItem) {
290
- const imageurl = messageItem.images[0].imageurl
291
- const find = this.data.messageMediaFiles.findIndex((value, index, array) => {
292
- return value.url == imageurl
293
- })
294
-
295
- if (deviceUtils.isPC()) {
296
- hhNavigation.mediaPreview(this.data.messageMediaFiles, find)
292
+ clickMessageImage(messageItem, isVideo = false) {
293
+ if (isVideo) {
294
+ const videoList = caseImageFilter.videoList(messageItem.images)
295
+ if (deviceUtils.isPC()) {
296
+ hhNavigation.mediaPreview(videoList, 0)
297
+ } else {
298
+ wx.previewMedia({
299
+ sources: videoList,
300
+ })
301
+ }
297
302
  } else {
298
- wx.previewMedia({
299
- current: find >= 0 ? find : 0,
300
- sources: this.data.messageMediaFiles,
303
+ let urls = messageItem.images.map(image => {
304
+ return image.imageurl
305
+ })
306
+ wx.previewImage({
307
+ urls: urls,
301
308
  })
302
309
  }
310
+
303
311
  this.setData({
304
312
  showPreview: true,
305
313
  })
@@ -1,5 +1,4 @@
1
1
  const pdfViewer = require('../../../public/pdf-viewer')
2
- const dicomApi = require('../../../apis/dicom-api')
3
2
  const caseImageFilter = require('../widget/case-image-filter')
4
3
  const hhNavigation = require('../../../hh-navigation')
5
4
  const deviceUtil = require('../../../utils/device-utils')
@@ -42,19 +41,29 @@ module.exports = Behavior({
42
41
  const type = value.type
43
42
  if (value.contentCaseImageList && value.contentCaseImageList.length > 0) {
44
43
  const imageList = caseImageFilter.imageList(value.contentCaseImageList)
44
+ const videoList = caseImageFilter.videoList(value.contentCaseImageList)
45
45
  const pdfList = caseImageFilter.pdfList(value.contentCaseImageList)
46
- const imageCount = imageList.length
47
- if (imageCount > 0) {
48
- const isVideo = imageList[0].type == 'video'
49
- const unit = isVideo ? '个' : '张'
50
- const fileType = isVideo ? 4 : 0
51
- let thumb = isVideo ? imageList[0].url + '?x-oss-process=video/snapshot,t_0,f_jpg' : imageList[0].thumb
52
- const showNumber = !['HISINFO', 'METER'].includes(type.toUpperCase()) ? `共${imageCount}${unit}` : '点击查看'
53
- mediaGroups.push(this.mediaItem(groupIndex, fileType, name, imageList, thumb, showNumber))
54
- const allImages = this.data._mediaFiles.concat(imageList)
55
- this.data._mediaFiles = allImages
46
+
47
+ const imageGroupList = caseImageFilter.mediaGroupList(imageList)
48
+ imageGroupList.forEach(imagesInGroup => {
49
+ const unit = '张'
50
+ const fileType = 0
51
+ let thumb = imagesInGroup[0].thumb
52
+ const showNumber = !['HISINFO', 'METER'].includes(type.toUpperCase()) ? `共${imagesInGroup.length}${unit}` : '点击查看'
53
+ mediaGroups.push(this.mediaItem(groupIndex, fileType, name, imagesInGroup, thumb, showNumber))
56
54
  groupIndex++
57
- }
55
+ });
56
+
57
+ const videoGroupList = caseImageFilter.mediaGroupList(videoList)
58
+ videoGroupList.forEach(videosInGroup => {
59
+ const unit = '个'
60
+ const fileType = 4
61
+ let thumb = videosInGroup[0].url + '?x-oss-process=video/snapshot,t_0,f_jpg'
62
+ const showNumber = !['HISINFO', 'METER'].includes(type.toUpperCase()) ? `共${videosInGroup.length}${unit}` : '点击查看'
63
+ mediaGroups.push(this.mediaItem(groupIndex, fileType, name, videosInGroup, thumb, showNumber))
64
+ groupIndex++
65
+ });
66
+
58
67
  if (pdfList.length > 0) {
59
68
  const showNumber = pdfList.length > 1 ? `共${pdfList.length}个` : '点击查看'
60
69
  mediaGroups.push(this.mediaItem(groupIndex, 1, `${name}PDF`, pdfList, 'https://imgs.hh-medic.com/icon/hh_icon_pdf.png', showNumber))
@@ -111,34 +120,46 @@ module.exports = Behavior({
111
120
  showPreview: true,
112
121
  })
113
122
  const media = this.data.mediaInfo[index]
114
- if ([0, 4].includes(media.type)) { //图片或视频
115
- const firstPic = media.files[0].url //统一用构建的数据所以不能使用原始数据判断
116
- const find = this.data._mediaFiles.findIndex((value, index, array) => {
117
- return value.url == firstPic
118
- })
119
-
120
- if (deviceUtil.isPC()) {
121
- hhNavigation.mediaPreview(this.data._mediaFiles, find)
122
- } else {
123
- wx.previewMedia({
124
- current: find >= 0 ? find : 0,
125
- sources: this.data._mediaFiles,
123
+ switch (media.type) {
124
+ case 0: // 图片
125
+ const images = media.files.map((value) => {
126
+ return value.url
126
127
  })
127
- }
128
- } else if (media.type == 1) { // PDF
129
- const files = media.files
130
- pdfViewer.viewPdfs(files)
131
- } else if (media.type == 2) { // dicom
132
- hhNavigation.pathology(this.data.orderId, null, null, true)
133
- } else if (media.type == 5) {
134
- if (media.files && media.files.length > 0) {
135
- const url = media.files[0].url
136
- // hhNavigation.webPage(url)
137
- hhNavigation.copyUrl(url)
138
- }
139
- } else if (media.type == 6) { // 病理
140
- let hospitalId = this.data.order.doctor.hospitalid
141
- hhNavigation.pathology(this.data.orderId, hospitalId, null, false)
128
+ wx.previewImage({
129
+ urls: images,
130
+ })
131
+ break
132
+ case 1: // PDF
133
+ const files = media.files
134
+ pdfViewer.viewPdfs(files)
135
+ break
136
+ case 2: // DICOM
137
+ hhNavigation.pathology(this.data.orderId, null, null, true)
138
+ break
139
+ case 4: // 视频
140
+ if (deviceUtil.isPC()) {
141
+ hhNavigation.mediaPreview(media.files, 0)
142
+ } else {
143
+ wx.previewMedia({
144
+ current: 0,
145
+ sources: media.files,
146
+ fail: (err) => {
147
+ console.error(err)
148
+ }
149
+ })
150
+ }
151
+ break
152
+ case 5: // URL
153
+ if (media.files && media.files.length > 0) {
154
+ const url = media.files[0].url
155
+ // hhNavigation.webPage(url)
156
+ hhNavigation.copyUrl(url)
157
+ }
158
+ break
159
+ case 6: // 病理
160
+ let hospitalId = this.data.order.doctor.hospitalid
161
+ hhNavigation.pathology(this.data.orderId, hospitalId, null, false)
162
+ break
142
163
  }
143
164
  },
144
165
  }
@@ -1,15 +1,22 @@
1
+ /**
2
+ * 获取媒体数据中的图片数据列表,单条数据格式如下:
3
+ *
4
+ * { type: 'image', url: 图片原始地址, thumb: 缩略图地址 }
5
+ *
6
+ * @param {*} caseImageList 媒体数据原始列表
7
+ */
1
8
  function imageList(caseImageList) {
2
9
  const images = caseImageList.filter((value, index, array) => {
3
10
  if (value.s3key && value.s3key.length > 0) {
4
- return !value.s3key.endsWith('.pdf')
11
+ return !value.s3key.endsWith('.pdf') && !value.s3key.endsWith('.mp4')
5
12
  }
6
- return value.url && !value.url.includes('.pdf')
13
+ return value.imageurl && !value.imageurl.includes('.pdf') && !value.url.includes('.mp4')
7
14
  })
8
15
 
9
16
  const imageDataList = images.map((value, index, array) => {
10
17
  const imageurl = value.imageurl
11
18
  return {
12
- type: imageurl.includes('.mp4') ? 'video' : 'image',
19
+ type: 'image',
13
20
  url: imageurl,
14
21
  thumb: value.smallImage
15
22
  }
@@ -17,12 +24,45 @@ function imageList(caseImageList) {
17
24
  return imageDataList
18
25
  }
19
26
 
27
+ /**
28
+ * 获取媒体数据中的视频数据列表,单条数据格式如下:
29
+ *
30
+ * { type: 'video', url: 视频原始地址, thumb: 缩略图地址 }
31
+ *
32
+ * @param {*} caseImageList 媒体数据原始列表
33
+ */
34
+ function videoList(caseImageList) {
35
+ const videos = caseImageList.filter((value, index, array) => {
36
+ if (value.s3key && value.s3key.length > 0) {
37
+ return value.s3key.endsWith('.mp4')
38
+ }
39
+ return value.imageurl && value.imageurl.includes('.mp4')
40
+ })
41
+
42
+ const imageDataList = videos.map((value, index, array) => {
43
+ const imageurl = value.imageurl
44
+ return {
45
+ type: 'video',
46
+ url: imageurl,
47
+ thumb: imageurl + '?x-oss-process=video/snapshot,t_0,f_jpg'
48
+ }
49
+ })
50
+ return imageDataList
51
+ }
52
+
53
+ /**
54
+ * 获取媒体数据中的PDF数据列表,单条数据格式如下:
55
+ *
56
+ * { url: PDF原始地址, name: 文件描述(名字) }
57
+ *
58
+ * @param {*} caseImageList 媒体数据原始列表
59
+ */
20
60
  function pdfList(caseImageList) {
21
61
  const pdfs = caseImageList.filter((value, index, array) => {
22
62
  if (value.s3key && value.s3key.length > 0) {
23
63
  return value.s3key.endsWith('.pdf')
24
64
  }
25
- return value.url && value.url.includes('.pdf')
65
+ return value.imageurl && value.imageurl.includes('.pdf')
26
66
  })
27
67
  return pdfs.map((value, index, arary) => {
28
68
  return pdfData(value.imageurl, value.imagedesc)
@@ -34,14 +74,35 @@ function pdfData(url, imagedesc) {
34
74
  if (index >= 0) {
35
75
  url = url.substring(0, index)
36
76
  }
37
- // const name = url.substring(url.lastIndexOf('/') + 1)
38
77
  return {
39
78
  url: url,
40
- name: imagedesc
79
+ name: imagedesc,
80
+ thumb: 'https://imgs.hh-medic.com/icon/hh_icon_pdf.png',
81
+ type: 'pdf'
82
+ }
83
+ }
84
+
85
+ /**
86
+ * 将媒体资料按照50条数据为上限数量进行分组
87
+ * @param {*} mediaList 媒体数据列表
88
+ */
89
+ function mediaGroupList(mediaList) {
90
+ const mediaLength = mediaList.length
91
+ let mediaGroups = []
92
+ let groupSize = Math.floor(mediaLength / 50)
93
+ if (mediaLength % 50 > 0) {
94
+ groupSize += 1
95
+ }
96
+ for (let index = 0; index < groupSize; index++) {
97
+ const imagesInGroup = mediaList.slice(index * 50, (index + 1) * 50)
98
+ mediaGroups.push(imagesInGroup)
41
99
  }
100
+ return mediaGroups
42
101
  }
43
102
 
44
103
  module.exports = {
45
104
  imageList,
46
- pdfList
105
+ videoList,
106
+ pdfList,
107
+ mediaGroupList
47
108
  }
@@ -57,10 +57,13 @@ scroll-view ::-webkit-scrollbar {
57
57
  width: 100%;
58
58
  display: flex;
59
59
  flex-direction: row;
60
- margin-left: 30rpx;
60
+ overflow-x: auto;
61
+ white-space: nowrap;
62
+ padding: 0 30rpx;
61
63
  }
62
64
 
63
65
  .order-media-item {
66
+ display: inline-block;
64
67
  color: #0592f5;
65
68
  font-size: 30rpx;
66
69
  }
@@ -23,13 +23,12 @@ module.exports = Behavior({
23
23
  // title: '加载订单数据...',
24
24
  // mask: true,
25
25
  // })
26
- wx.statLog.sendStatLog(null, '开始获取订单详情数据')
27
26
  const orderId = this.data.orderId
27
+ wx.statLog.sendStatLog(orderId, '开始获取订单详情数据')
28
28
  api.getOrderDetail(orderId).then((res) => {
29
- wx.statLog.sendStatLog(null, '获取订单详情数据完成')
29
+ wx.statLog.sendStatLog(orderId, '获取订单详情数据完成')
30
30
  // wx.hideLoading()
31
31
  const order = res.data.order
32
- console.error(`order info ==> ${JSON.stringify(order)}`)
33
32
  const feedbackStar = res.data.feedbackStar
34
33
  let notifySetVideoTime = false
35
34
  if (order && order.orderService && order.orderService.provideType === 'video') {
@@ -47,7 +46,7 @@ module.exports = Behavior({
47
46
  }
48
47
  })
49
48
  }).catch((e) => {
50
- wx.statLog.sendStatLog(null, `获取订单数据出错${JSON.stringify(e)}`)
49
+ wx.statLog.sendStatLog(orderId, `获取订单数据出错${JSON.stringify(e)}`)
51
50
  wx.hideLoading()
52
51
  wx.showToast({
53
52
  title: '加载订单出错',
@@ -71,5 +71,12 @@ Page({
71
71
  */
72
72
  onShareAppMessage() {
73
73
 
74
+ },
75
+
76
+ handleSwiper(e) {
77
+ let current = e.detail.current
78
+ this.setData({
79
+ indexCurrent: current
80
+ })
74
81
  }
75
82
  })
@@ -3,10 +3,9 @@
3
3
  position: relative;
4
4
  }
5
5
  .slide-image {
6
- width: 100%;
7
- display: inline-block;
8
6
  width: 100%;
9
7
  height: 100%;
8
+ display: inline-block;
10
9
  }
11
10
  .JSSwiper {
12
11
  position: absolute;
@@ -89,7 +89,7 @@ Component({
89
89
  await this.client.unpublish()
90
90
  await this.client.leave()
91
91
  // await this.client.destory()
92
- wx.statLog.sendStatLog(null, '(声网)本人离开房间')
92
+ wx.statLog.sendStatLog(this.properties.orderId, '(声网)本人离开房间')
93
93
  this.triggerEvent("directHangup")
94
94
  },
95
95
 
@@ -102,7 +102,7 @@ Component({
102
102
  this.addMedia(0, uuid, url, {
103
103
  key: ts
104
104
  })
105
- wx.statLog.sendStatLog(null, '(声网)本人加入房间')
105
+ wx.statLog.sendStatLog(this.properties.orderId, '(声网)本人加入房间')
106
106
  this.triggerEvent('sendLog', logApi.logTypes.connect)
107
107
  this.triggerEvent('sendCallMessage')
108
108
  },
@@ -145,7 +145,7 @@ Component({
145
145
  }
146
146
  }
147
147
  }
148
- wx.statLog.sendStatLog(null, `(声网)${uid}加入房间`)
148
+ wx.statLog.sendStatLog(this.properties.orderId, `(声网)${uid}加入房间`)
149
149
  if (!matchItem) {
150
150
  this.addMedia(1, uid, url, {
151
151
  key: ts,
@@ -161,7 +161,7 @@ Component({
161
161
 
162
162
  this.client.on("stream-removed", e => {
163
163
  let uid = e.uid;
164
- wx.statLog.sendStatLog(null, `(声网)${uid}离开房间`)
164
+ wx.statLog.sendStatLog(this.properties.orderId, `(声网)${uid}离开房间`)
165
165
  this.removeMedia(uid)
166
166
  })
167
167
 
@@ -169,7 +169,7 @@ Component({
169
169
  let errObj = err || {};
170
170
  let code = errObj.code || 0;
171
171
  let reason = errObj.reason || "";
172
- wx.statLog.sendStatLog(null, `(声网)发生错误(${code} -> ${reason})`)
172
+ wx.statLog.sendStatLog(this.properties.orderId, `(声网)发生错误(${code} -> ${reason})`)
173
173
  if (code === 501 || code === 904) {
174
174
  this.reconnect()
175
175
  }
@@ -193,7 +193,7 @@ Component({
193
193
 
194
194
  this.client.on("mute-video", (e) => {
195
195
  const uuid = e.uid
196
- wx.statLog.sendStatLog(null, `(声网)远端用户切换为音频(${uuid})`)
196
+ wx.statLog.sendStatLog(this.properties.orderId, `(声网)远端用户切换为音频(${uuid})`)
197
197
  this.triggerEvent('updateUserAudioStatus', {
198
198
  userId: uuid,
199
199
  audio: true
@@ -202,7 +202,7 @@ Component({
202
202
 
203
203
  this.client.on("unmute-video", (e) => {
204
204
  const uuid = e.uid
205
- wx.statLog.sendStatLog(null, `(声网)远端用户切换为视频(${uuid})`)
205
+ wx.statLog.sendStatLog(this.properties.orderId, `(声网)远端用户切换为视频(${uuid})`)
206
206
  this.triggerEvent('updateUserAudioStatus', {
207
207
  userId: uuid,
208
208
  audio: false
@@ -408,7 +408,7 @@ Component({
408
408
  }
409
409
  },
410
410
  switchAudioVideo(toAudio) {
411
- wx.statLog.sendStatLog(null, `(声网)切换为${toAudio ? '音频' : '视频'}`)
411
+ wx.statLog.sendStatLog(this.properties.orderId, `(声网)切换为${toAudio ? '音频' : '视频'}`)
412
412
  if (toAudio) {
413
413
  this.client.muteLocal('video')
414
414
  } else {
@@ -5,6 +5,10 @@ const cache = require('../public/cache-data')
5
5
 
6
6
  Component({
7
7
  properties: {
8
+ orderId: {
9
+ type: String,
10
+ value: null
11
+ },
8
12
  callback: {
9
13
  type: Boolean,
10
14
  value: false
@@ -114,14 +118,14 @@ Component({
114
118
  const TRTC_EVENT = this.TRTC.EVENT
115
119
  // 初始化事件订阅
116
120
  this.TRTC.on(TRTC_EVENT.LOCAL_JOIN, (event) => {
117
- wx.statLog.sendStatLog(null, '本人加入房间')
121
+ wx.statLog.sendStatLog(this.properties.orderId, '本人加入房间')
118
122
  this.triggerEvent('sendLog', logApi.logTypes.connect)
119
123
  if (!this.properties.callback) {
120
124
  this.triggerEvent('sendCallMessage')
121
125
  }
122
126
  })
123
127
  this.TRTC.on(TRTC_EVENT.LOCAL_LEAVE, (event) => {
124
- wx.statLog.sendStatLog(null, '本人离开房间')
128
+ wx.statLog.sendStatLog(this.properties.orderId, '本人离开房间')
125
129
  this.triggerEvent("directHangup")
126
130
  })
127
131
  this.TRTC.on(TRTC_EVENT.ERROR, (event) => {
@@ -133,7 +137,7 @@ Component({
133
137
  const {
134
138
  userID
135
139
  } = event.data
136
- wx.statLog.sendStatLog(null, `${userID}加入房间`)
140
+ wx.statLog.sendStatLog(this.properties.orderId, `${userID}加入房间`)
137
141
  this.triggerEvent('updateVideoState', 'chatting')
138
142
  this.triggerEvent('remoteUserJoin', `${userID}`)
139
143
  }
@@ -144,7 +148,7 @@ Component({
144
148
  userID,
145
149
  playerList
146
150
  } = event.data
147
- wx.statLog.sendStatLog(null, `${userID}离开房间`)
151
+ wx.statLog.sendStatLog(this.properties.orderId, `${userID}离开房间`)
148
152
  this.triggerEvent('remoteUserLeave', `${userID}`)
149
153
  this._updatePlayerList(playerList)
150
154
  })
@@ -153,7 +157,7 @@ Component({
153
157
  const {
154
158
  player
155
159
  } = event.data
156
- wx.statLog.sendStatLog(null, `${player.userID}远端用户开始推送视频`)
160
+ wx.statLog.sendStatLog(this.properties.orderId, `${player.userID}远端用户开始推送视频`)
157
161
  this.triggerEvent('updateUserAudioStatus', {
158
162
  userId: player.userID,
159
163
  audio: false
@@ -168,7 +172,7 @@ Component({
168
172
  const {
169
173
  player
170
174
  } = event.data
171
- wx.statLog.sendStatLog(null, `${player.userID}远端用户停止推送视频`)
175
+ wx.statLog.sendStatLog(this.properties.orderId, `${player.userID}远端用户停止推送视频`)
172
176
  this.triggerEvent('updateUserAudioStatus', {
173
177
  userId: player.userID,
174
178
  audio: true
@@ -183,7 +187,7 @@ Component({
183
187
  const {
184
188
  player
185
189
  } = event.data
186
- wx.statLog.sendStatLog(null, `${player.userID}远端用户开始推送音频`)
190
+ wx.statLog.sendStatLog(this.properties.orderId, `${player.userID}远端用户开始推送音频`)
187
191
  this.setPlayerAttributesHandler(player, {
188
192
  muteAudio: false
189
193
  })
@@ -194,7 +198,7 @@ Component({
194
198
  const {
195
199
  player
196
200
  } = event.data
197
- wx.statLog.sendStatLog(null, `${player.userID}远端用户停止推送音频`)
201
+ wx.statLog.sendStatLog(this.properties.orderId, `${player.userID}远端用户停止推送音频`)
198
202
  this.setPlayerAttributesHandler(player, {
199
203
  muteAudio: true
200
204
  })
@@ -296,7 +300,7 @@ Component({
296
300
  mainRemotePlayer: null,
297
301
  remotePlayerList: null
298
302
  })
299
- wx.statLog.sendStatLog(null, '远端用户都离开了房间自己也需要离开房间,停止推送音视频')
303
+ wx.statLog.sendStatLog(this.properties.orderId, '远端用户都离开了房间自己也需要离开房间,停止推送音视频')
300
304
  // 此时房间内远端用户都离开了,需要自己也离开房间
301
305
  this.setPusherAttributesHandler({
302
306
  enableCamera: false,
@@ -305,7 +309,7 @@ Component({
305
309
  }
306
310
  },
307
311
  switchAudioVideo(toAudio) {
308
- wx.statLog.sendStatLog(null, `切换为${toAudio ? '音频' : '视频'}`)
312
+ wx.statLog.sendStatLog(this.properties.orderId, `切换为${toAudio ? '音频' : '视频'}`)
309
313
  if (toAudio) {
310
314
  this.setPusherAttributesHandler({
311
315
  enableCamera: false,
@@ -1,11 +1,8 @@
1
- const dicomApi = require('../../apis/dicom-api')
2
- const pdfViewer = require('../../public/pdf-viewer')
3
- const hhNavigation = require('../../hh-navigation')
4
1
  const orderApi = require('../../apis/order-app-api')
2
+ const caseImageFilter = require('../../consultation/detail/widget/case-image-filter')
5
3
 
6
4
  module.exports = Behavior({
7
5
  data: {
8
- _mediaFiles: [], // 图片或视频
9
6
  caseGroups: [], // 查看订单中资料
10
7
  },
11
8
 
@@ -17,19 +14,19 @@ module.exports = Behavior({
17
14
  loadFiles(order, callback) {
18
15
  try {
19
16
  let orderMediaPromise = new Promise((resolve, reject) => {
20
- let mediaFiles = []
21
17
  let groups = []
22
18
  if (order && order.orderComponent && order.orderComponent.componentBaseList) {
23
19
  for (let component of order.orderComponent.componentBaseList) {
24
20
  const type = component.type
25
21
  const fileList = component.contentCaseImageList
22
+ const name = component.name
26
23
  if (fileList && fileList.length > 0) {
27
24
  if (type === 'url') {
28
25
  // url 类型组件为链接跳转,每个链接作为一个分组使用单独直接点击跳转
29
26
  const urlFileList = fileList.map((res) => {
30
27
  const item = {
31
28
  type: 'url',
32
- 'url': res.imageurl,
29
+ url: res.imageurl,
33
30
  thumb: 'https://image.hh-medic.com/icon/pacs/hh_consulation_dicom_icon.png'
34
31
  }
35
32
  return item
@@ -39,45 +36,30 @@ module.exports = Behavior({
39
36
  files: urlFileList
40
37
  })
41
38
  } else {
42
- let images = fileList.filter((file) => !file.imageurl.includes('.pdf'))
43
- let pdfs = fileList.filter((file) => file.imageurl.includes('.pdf')) //imagedesc
44
- if (images && images.length > 0) {
45
- let imageList = images.map((file) => {
46
- const url = file.imageurl
47
- let thumb = url
48
- const isVideo = url.endsWith('.mp4')
49
- if (isVideo) {
50
- thumb = `${url}?x-oss-process=video/snapshot,t_0,f_jpg`
51
- }
39
+ let imageList = caseImageFilter.imageList(fileList)
40
+ let videoList = caseImageFilter.videoList(fileList)
41
+ let pdfList = caseImageFilter.pdfList(fileList)
52
42
 
53
- const data = {
54
- url: url,
55
- thumb: thumb,
56
- type: isVideo ? 'video' : 'image',
57
- }
58
- mediaFiles.push(data)
59
- return data
43
+ const imageGroupList = caseImageFilter.mediaGroupList(imageList)
44
+ imageGroupList.forEach(imagesInGroup => {
45
+ groups.push({
46
+ title: name + '(图片)',
47
+ files: imagesInGroup
60
48
  })
49
+ });
61
50
 
51
+ const videoGroupList = caseImageFilter.mediaGroupList(videoList)
52
+ videoGroupList.forEach(videosInGroup => {
62
53
  groups.push({
63
- title: component.name,
64
- files: imageList
65
- })
66
- }
67
- if (pdfs && pdfs.length > 0) {
68
- let pdfFiles = pdfs.map((file) => {
69
- const url = file.imageurl
70
- const thumb = 'https://image.hh-medic.com/icon/pacs/hh_icon_pdf.png'
71
- return {
72
- url: url,
73
- thumb: thumb,
74
- type: 'pdf',
75
- desc: file.imagedesc
76
- }
54
+ title: name + '(视频)',
55
+ files: videosInGroup
77
56
  })
57
+ });
58
+
59
+ if (pdfList && pdfList.length > 0) {
78
60
  groups.push({
79
- title: `${component.name}PDF`,
80
- files: pdfFiles
61
+ title: `${name}(PDF)`,
62
+ files: pdfList
81
63
  })
82
64
  }
83
65
  }
@@ -108,18 +90,20 @@ module.exports = Behavior({
108
90
  resolve({
109
91
  isNew: false,
110
92
  caseGroups: groups,
111
- mediaFiles: mediaFiles
112
93
  })
113
94
  })
114
95
 
115
96
  let promises = [orderMediaPromise]
116
97
 
117
98
  let newFilePromise = new Promise((resolve, reject) => {
118
- let mediaFiles = []
119
99
  orderApi.fileData(order.orderid, order.patient.patientCode).then((res) => {
120
100
  const list = res.data
121
101
  if (list && list.length > 0) {
122
- let fileList = list.map((file) => {
102
+ let groups = []
103
+ let imageList = []
104
+ let videoList = []
105
+ let pdfList = []
106
+ list.forEach((file) => {
123
107
  let type = 'image'
124
108
  const url = file.fileUrl
125
109
  let thumb = url
@@ -137,18 +121,40 @@ module.exports = Behavior({
137
121
  thumb: thumb,
138
122
  type: type,
139
123
  }
140
- if (type !== 'pdf') {
141
- mediaFiles.push(data)
124
+ if (type == 'image') {
125
+ imageList.push(data)
126
+ } else if (type == 'video') {
127
+ videoList.push(data)
128
+ } else {
129
+ pdfList.push(data)
142
130
  }
143
- return data
144
131
  })
132
+
133
+ const imageGroupList = caseImageFilter.mediaGroupList(imageList)
134
+ imageGroupList.forEach(imagesInGroup => {
135
+ groups.push({
136
+ title: "刚刚更新(图片)",
137
+ files: imagesInGroup
138
+ })
139
+ })
140
+
141
+ const videoGroupList = caseImageFilter.mediaGroupList(videoList)
142
+ videoGroupList.forEach(videosInGroup => {
143
+ groups.push({
144
+ title: "刚刚更新(视频)",
145
+ files: videosInGroup
146
+ })
147
+ })
148
+
149
+ if (pdfList.length > 0) {
150
+ groups.push({
151
+ title: '刚刚更新(PDF)',
152
+ files: pdfList
153
+ })
154
+ }
145
155
  resolve({
146
156
  isNew: true,
147
- caseGroups: [{
148
- title: '刚刚更新',
149
- files: fileList
150
- }],
151
- mediaFiles: mediaFiles
157
+ caseGroups: groups,
152
158
  })
153
159
  } else {
154
160
  resolve({
@@ -171,20 +177,15 @@ module.exports = Behavior({
171
177
  Promise.all(promises).then((res) => {
172
178
  wx.hideLoading()
173
179
  let caseGroups = []
174
- let mediaFiles = []
175
180
  for (const result of res) {
176
181
  if (result.isNew) {
177
182
  caseGroups.splice(0, 0, ...result.caseGroups)
178
- mediaFiles.splice(0, 0, ...result.mediaFiles)
179
183
  } else {
180
184
  caseGroups.push(...result.caseGroups)
181
- mediaFiles.push(...result.mediaFiles)
182
185
  }
183
-
184
186
  }
185
187
  this.setData({
186
188
  caseGroups: caseGroups,
187
- _mediaFiles: mediaFiles,
188
189
  mediaTop: 'mediaTop'
189
190
  }, () => {
190
191
  callback()
@@ -61,16 +61,16 @@ module.exports = Behavior({
61
61
  },
62
62
 
63
63
  loadDicom() {
64
- wx.statLog.sendStatLog(null, '获取订单中的DICOM数据')
64
+ wx.statLog.sendStatLog(this.data.orderId, '获取订单中的DICOM数据')
65
65
  dicomApi.getDicom(this.data.orderId).then((res) => {
66
- wx.statLog.sendStatLog(null, '获取订单中的DICOM数据完成')
66
+ wx.statLog.sendStatLog(this.data.orderId, '获取订单中的DICOM数据完成')
67
67
  if (res.status == 200 && res.data && res.data.list && res.data.list.length > 0) {
68
68
  this.setData({
69
69
  dicoms: res.data.list
70
70
  })
71
71
  }
72
72
  }).catch((err) => {
73
- wx.statLog.sendStatLog(null, `获取订单中的DICOM数据失败(${JSON.stringify(err)})`)
73
+ wx.statLog.sendStatLog(this.data.orderId, `获取订单中的DICOM数据失败(${JSON.stringify(err)})`)
74
74
  })
75
75
  },
76
76
 
@@ -78,15 +78,15 @@ module.exports = Behavior({
78
78
  * 加载房间号
79
79
  */
80
80
  loadRoomData() {
81
- wx.statLog.sendStatLog(null, '在获取房间号之前检测是否开启了音视频权限')
81
+ wx.statLog.sendStatLog(this.data.orderId, '在获取房间号之前检测是否开启了音视频权限')
82
82
  const orderId = this.data.orderId
83
83
  checkPermission.checkMediaPermission().then(() => {
84
- wx.statLog.sendStatLog(null, '开始获取房间号')
84
+ wx.statLog.sendStatLog(this.data.orderId, '开始获取房间号')
85
85
  api.getRoomId(orderId).then((res) => {
86
86
  this.setData({
87
87
  roomID: res.data.roomId
88
88
  }, () => {
89
- wx.statLog.sendStatLog(null, `获取房间号完成${JSON.stringify({roomID: this.data.roomID})}`)
89
+ wx.statLog.sendStatLog(this.data.orderId, `获取房间号完成${JSON.stringify({roomID: this.data.roomID})}`)
90
90
  if (!this.data.callback) {
91
91
  this._enterRoom(res.data.roomId)
92
92
  } else {
@@ -95,7 +95,7 @@ module.exports = Behavior({
95
95
  })
96
96
  });
97
97
  }).catch(() => {
98
- wx.statLog.sendStatLog(null, '用户未授权音视频权限直接退出页面')
98
+ wx.statLog.sendStatLog(this.data.orderId, '用户未授权音视频权限直接退出页面')
99
99
  this.sendPermissionFailed()
100
100
  this._directHangup()
101
101
  })
@@ -105,7 +105,7 @@ module.exports = Behavior({
105
105
  */
106
106
  loadExpertInfo() {
107
107
  if (this.data.callback) {
108
- wx.statLog.sendStatLog(null, '专家回拨后开始获取专家数据并显示回拨界面')
108
+ wx.statLog.sendStatLog(this.data.orderId, '专家回拨后开始获取专家数据并显示回拨界面')
109
109
  const order = this.data.order
110
110
  var expertId = order.expertid
111
111
  const expertList = order.orderService.expertList
@@ -113,23 +113,23 @@ module.exports = Behavior({
113
113
  expertId = expertList[expertList.length - 1].expertid
114
114
  }
115
115
  api.getExpertInfo(expertId).then((res) => {
116
- wx.statLog.sendStatLog(null, '获取专家数据完成并显示回拨界面')
116
+ wx.statLog.sendStatLog(this.data.orderId, '获取专家数据完成并显示回拨界面')
117
117
  if (res) {
118
118
  this.setData({
119
119
  expert: res.data
120
120
  })
121
121
  }
122
122
  }).catch((err) => {
123
- wx.statLog.sendStatLog(null, `获取专家数据失败(${JSON.stringify(err)})`)
123
+ wx.statLog.sendStatLog(this.data.orderId, `获取专家数据失败(${JSON.stringify(err)})`)
124
124
  })
125
125
  }
126
126
  },
127
127
  _enterRoom(roomID) {
128
128
  if (this.data.isFromAgora) {
129
- wx.statLog.sendStatLog(null, '开始进房(声网RTC)')
129
+ wx.statLog.sendStatLog(this.data.orderId, '开始进房(声网RTC)')
130
130
  this.selectComponent('#artc').enterRoom(roomID)
131
131
  } else {
132
- wx.statLog.sendStatLog(null, '开始进房(腾讯RTC)')
132
+ wx.statLog.sendStatLog(this.data.orderId, '开始进房(腾讯RTC)')
133
133
  this.selectComponent('#trtc').enterRoom(roomID)
134
134
  }
135
135
 
@@ -137,10 +137,10 @@ module.exports = Behavior({
137
137
 
138
138
  _exitRoom() {
139
139
  if (this.data.isFromAgora) {
140
- wx.statLog.sendStatLog(null, '退出房间(声网RTC)')
140
+ wx.statLog.sendStatLog(this.data.orderId, '退出房间(声网RTC)')
141
141
  this.selectComponent('#artc').exitRoom()
142
142
  } else {
143
- wx.statLog.sendStatLog(null, '退出房间(腾讯RTC)')
143
+ wx.statLog.sendStatLog(this.data.orderId, '退出房间(腾讯RTC)')
144
144
  this.selectComponent('#trtc').exitRoom()
145
145
  }
146
146
  },
@@ -152,9 +152,9 @@ module.exports = Behavior({
152
152
  return
153
153
  }
154
154
  if (status === defines.videoStatus.chatting) {
155
- wx.statLog.sendStatLog(null, '切换到视频中界面')
155
+ wx.statLog.sendStatLog(this.data.orderId, '切换到视频中界面')
156
156
  if (!this.data.callback) { // 只有专家主动呼叫需要发送开始视频日志
157
- wx.statLog.sendStatLog(null, '发送了视频开始的日志')
157
+ wx.statLog.sendStatLog(this.data.orderId, '发送了视频开始的日志')
158
158
  this.sendStart()
159
159
  }
160
160
  this.stopCallRing()
@@ -171,7 +171,7 @@ module.exports = Behavior({
171
171
  * 呼叫时点击取消
172
172
  */
173
173
  _controllerCancel() {
174
- wx.statLog.sendStatLog(null, `${cache.doctorName()}点击取消呼叫`)
174
+ wx.statLog.sendStatLog(this.data.orderId, `${cache.doctorName()}点击取消呼叫`)
175
175
  this._sendLog(`${cache.doctorName()}取消呼叫`)
176
176
  this._cancelCall()
177
177
  },
@@ -180,7 +180,7 @@ module.exports = Behavior({
180
180
  * 专家回拨接听
181
181
  */
182
182
  _controllerAccept() {
183
- wx.statLog.sendStatLog(null, `${cache.doctorName()}点击接听`)
183
+ wx.statLog.sendStatLog(this.data.orderId, `${cache.doctorName()}点击接听`)
184
184
  this._sendLog('点击接听')
185
185
  const roomID = this.data.roomID
186
186
  this._updateVideoState({
@@ -193,21 +193,21 @@ module.exports = Behavior({
193
193
  * 专家回拨主动拒绝接听
194
194
  */
195
195
  _controllerReject() {
196
- wx.statLog.sendStatLog(null, `${cache.doctorName()}拒绝接听`)
196
+ wx.statLog.sendStatLog(this.data.orderId, `${cache.doctorName()}拒绝接听`)
197
197
  this._sendLog('点击拒绝')
198
198
  this._reject()
199
199
  },
200
200
 
201
201
  // 点击发送呼叫通知
202
202
  _controllerNotifyCall() {
203
- wx.statLog.sendStatLog(null, '手动发送呼叫通知消息')
203
+ wx.statLog.sendStatLog(this.data.orderId, '手动发送呼叫通知消息')
204
204
  this.sendCallMessage().then(() => {
205
- wx.statLog.sendStatLog(null, '手动发送呼叫通知消息成功')
205
+ wx.statLog.sendStatLog(this.data.orderId, '手动发送呼叫通知消息成功')
206
206
  wx.showToast({
207
207
  title: '已成功通知对方接听',
208
208
  })
209
209
  }).catch(() => {
210
- wx.statLog.sendStatLog(null, '手动发送呼叫通知消息失败')
210
+ wx.statLog.sendStatLog(this.data.orderId, '手动发送呼叫通知消息失败')
211
211
  wx.showToast({
212
212
  title: '通知失败,对方可能无法加入视频',
213
213
  })
@@ -238,12 +238,12 @@ module.exports = Behavior({
238
238
  selfInVoice: selfInVoice,
239
239
  })
240
240
 
241
- wx.statLog.sendStatLog(null, `切换语音视频,切换为${selfInVoice ? '音频' : '视频'}`)
241
+ wx.statLog.sendStatLog(this.data.orderId, `切换语音视频,切换为${selfInVoice ? '音频' : '视频'}`)
242
242
  if (this.data.isFromAgora) {
243
- wx.statLog.sendStatLog(null, '切换语音视频(声网RTC)')
243
+ wx.statLog.sendStatLog(this.data.orderId, '切换语音视频(声网RTC)')
244
244
  this.selectComponent('#artc').switchAudioVideo(selfInVoice)
245
245
  } else {
246
- wx.statLog.sendStatLog(null, '切换语音视频(腾讯RTC)')
246
+ wx.statLog.sendStatLog(this.data.orderId, '切换语音视频(腾讯RTC)')
247
247
  this.selectComponent('#trtc').switchAudioVideo(selfInVoice)
248
248
  }
249
249
 
@@ -253,7 +253,7 @@ module.exports = Behavior({
253
253
  * 视频中挂断
254
254
  */
255
255
  _controllerHangup() {
256
- wx.statLog.sendStatLog(null, '点击挂断视频通话')
256
+ wx.statLog.sendStatLog(this.data.orderId, '点击挂断视频通话')
257
257
  this.hangup(defines.hangupTypes.hangup)
258
258
  },
259
259
 
@@ -261,7 +261,7 @@ module.exports = Behavior({
261
261
  * 主动呼叫时取消呼叫
262
262
  */
263
263
  _cancelCall() {
264
- wx.statLog.sendStatLog(null, '点击取消视频通话')
264
+ wx.statLog.sendStatLog(this.data.orderId, '点击取消视频通话')
265
265
  if (this.data.order) {
266
266
  this.hangup(defines.hangupTypes.cancel)
267
267
  } else {
@@ -283,7 +283,7 @@ module.exports = Behavior({
283
283
  * 对方拒绝接听
284
284
  */
285
285
  _reject() {
286
- wx.statLog.sendStatLog(null, '点击拒绝视频通话')
286
+ wx.statLog.sendStatLog(this.data.orderId, '点击拒绝视频通话')
287
287
  if (this.data.isFromAgora) {
288
288
  this.selectComponent('#artc').setPusherAttributesHandler({
289
289
  enableMic: false,
@@ -302,7 +302,7 @@ module.exports = Behavior({
302
302
  * 发送呼叫消息
303
303
  */
304
304
  sendCallMessage() {
305
- wx.statLog.sendStatLog(null, '发送呼叫消息')
305
+ wx.statLog.sendStatLog(this.data.orderId, '发送呼叫消息')
306
306
  return new Promise((resolve, reject) => {
307
307
  message_api.bindData({
308
308
  'toUUID': this.data.order.doctorUuid, //this.data.isFamilyOrder ? this.data.order.patient.patientUuid : this.data.order.doctorUuid,
@@ -311,15 +311,15 @@ module.exports = Behavior({
311
311
  message_api.sendCall().then((res) => {
312
312
  if (res.status == 200) {
313
313
  resolve()
314
- wx.statLog.sendStatLog(null, '发送呼叫消息成功')
314
+ wx.statLog.sendStatLog(this.data.orderId, '发送呼叫消息成功')
315
315
  this.sendCallSuccess()
316
316
  } else {
317
- wx.statLog.sendStatLog(null, '发送呼叫消息失败')
317
+ wx.statLog.sendStatLog(this.data.orderId, '发送呼叫消息失败')
318
318
  this.sendCallFailed()
319
319
  reject()
320
320
  }
321
321
  }).catch((e) => {
322
- wx.statLog.sendStatLog(null, `发送呼叫消息异常(${JSON.stringify(e)})`)
322
+ wx.statLog.sendStatLog(this.data.orderId, `发送呼叫消息异常(${JSON.stringify(e)})`)
323
323
  this.sendCallFailed()
324
324
  reject()
325
325
  })
@@ -330,7 +330,7 @@ module.exports = Behavior({
330
330
  * 发送取消呼叫消息
331
331
  */
332
332
  sendCancelMessage() {
333
- wx.statLog.sendStatLog(null, '发送取消呼叫消息')
333
+ wx.statLog.sendStatLog(this.data.orderId, '发送取消呼叫消息')
334
334
  message_api.bindData({
335
335
  'toUUID': this.data.isFamilyOrder ? this.data.order.patient.patientUuid : this.data.order.doctorUuid,
336
336
  'orderId': this.data.orderId
@@ -342,7 +342,7 @@ module.exports = Behavior({
342
342
  * 发送拒绝呼叫消息
343
343
  */
344
344
  sendRejectMessage() {
345
- wx.statLog.sendStatLog(null, '发送拒绝呼叫消息')
345
+ wx.statLog.sendStatLog(this.data.orderId, '发送拒绝呼叫消息')
346
346
  message_api.bindData({
347
347
  'toUUID': this.data.expert.uuid,
348
348
  'orderId': this.orderId
@@ -353,7 +353,7 @@ module.exports = Behavior({
353
353
  hangup(type) {
354
354
  switch (type) {
355
355
  case defines.hangupTypes.reject: // 收到回拨拒绝
356
- wx.statLog.sendStatLog(null, '拒绝接听')
356
+ wx.statLog.sendStatLog(this.data.orderId, '拒绝接听')
357
357
  this.sendRejectMessage()
358
358
  this.setData({
359
359
  hangupType: defines.hangupTypes.reject,
@@ -362,7 +362,7 @@ module.exports = Behavior({
362
362
  })
363
363
  break
364
364
  case defines.hangupTypes.cancel: // 取消视频呼叫
365
- wx.statLog.sendStatLog(null, '取消视频通话呼叫')
365
+ wx.statLog.sendStatLog(this.data.orderId, '取消视频通话呼叫')
366
366
  this.sendCancelMessage()
367
367
  this.setData({
368
368
  hangupType: defines.hangupTypes.cancel,
@@ -372,7 +372,7 @@ module.exports = Behavior({
372
372
 
373
373
  break
374
374
  case defines.hangupTypes.hangup: // 主动挂断视频
375
- wx.statLog.sendStatLog(null, '正常挂断视频通话')
375
+ wx.statLog.sendStatLog(this.data.orderId, '正常挂断视频通话')
376
376
  this.setData({
377
377
  hangupType: defines.hangupTypes.hangup,
378
378
  }, () => {
@@ -380,7 +380,7 @@ module.exports = Behavior({
380
380
  })
381
381
  break
382
382
  case defines.hangupTypes.otherCancel: // 专家回拨的时候专家侧取消
383
- wx.statLog.sendStatLog(null, '专家已经取消视频呼叫')
383
+ wx.statLog.sendStatLog(this.data.orderId, '专家已经取消视频呼叫')
384
384
  this.setData({
385
385
  hangupType: defines.hangupTypes.otherCancel,
386
386
  }, () => {
@@ -388,7 +388,7 @@ module.exports = Behavior({
388
388
  })
389
389
  break
390
390
  case defines.hangupTypes.otherReject: // 对方拒绝接听
391
- wx.statLog.sendStatLog(null, '对方拒绝接听视频呼叫')
391
+ wx.statLog.sendStatLog(this.data.orderId, '对方拒绝接听视频呼叫')
392
392
  this.sendRefuse() //发送对方拒绝的日志
393
393
  hType = defines.hangupTypes.otherReject
394
394
  this.setData({
@@ -407,7 +407,7 @@ module.exports = Behavior({
407
407
  */
408
408
  _directHangup() {
409
409
  if (!this.data.callback && this.data.startChatTime) {
410
- wx.statLog.sendStatLog(null, '发送完成订单日志')
410
+ wx.statLog.sendStatLog(this.data.orderId, '发送完成订单日志')
411
411
  this.sendEnd() // 发送完成订单日志
412
412
  }
413
413
  let tips = '视频已挂断'
@@ -438,7 +438,7 @@ module.exports = Behavior({
438
438
 
439
439
  _onRemoteUserJoin(data) {
440
440
  const userId = data.detail
441
- wx.statLog.sendStatLog(null, `远端用户加入房间${JSON.stringify({userId: userId})}`)
441
+ wx.statLog.sendStatLog(this.data.orderId, `远端用户加入房间${JSON.stringify({userId: userId})}`)
442
442
  if (!this.data.userIdList.includes(userId)) {
443
443
  this.data.userIdList.push(userId)
444
444
  }
@@ -448,14 +448,14 @@ module.exports = Behavior({
448
448
  this.setData({
449
449
  userDidInRoom: true
450
450
  })
451
- wx.statLog.sendStatLog(null, `专家和用户视频成功`)
451
+ wx.statLog.sendStatLog(this.data.orderId, `专家和用户视频成功`)
452
452
  this._sendLog('专家和用户视频成功')
453
453
  }
454
454
  },
455
455
 
456
456
  _onRemoteUserLeave(data) {
457
457
  const userId = data.detail
458
- wx.statLog.sendStatLog(null, `远端用户离开房间${JSON.stringify({userId: userId})}`)
458
+ wx.statLog.sendStatLog(this.data.orderId, `远端用户离开房间${JSON.stringify({userId: userId})}`)
459
459
  const newList = []
460
460
  this.data.userIdList.forEach((element) => {
461
461
  if (userId !== element) {
@@ -468,10 +468,10 @@ module.exports = Behavior({
468
468
  if (this.data.userIdList.length === 0) {
469
469
  const doctor = this.data.doctorInfoMap[userId]
470
470
  if (this.data.userDidInRoom || doctor == null || !doctor.hasAid) {
471
- wx.statLog.sendStatLog(null, `用户和专家视频完成退出房间${JSON.stringify({userId: userId})}`)
471
+ wx.statLog.sendStatLog(this.data.orderId, `用户和专家视频完成退出房间${JSON.stringify({userId: userId})}`)
472
472
  this._exitRoom()
473
473
  } else {
474
- wx.statLog.sendStatLog(null, `医助退出房间(${userId}),重新进入呼叫界面`)
474
+ wx.statLog.sendStatLog(this.data.orderId, `医助退出房间(${userId}),重新进入呼叫界面`)
475
475
  this.setData({
476
476
  videoStatus: defines.videoStatus.calling
477
477
  })
@@ -12,6 +12,10 @@ Component({
12
12
  files: {
13
13
  type: Array,
14
14
  value: []
15
+ },
16
+ groupIndex: {
17
+ type: Number,
18
+ value: -1
15
19
  }
16
20
  },
17
21
 
@@ -31,7 +35,8 @@ Component({
31
35
  const url = e.currentTarget.dataset.url
32
36
  this.triggerEvent('clickMedia', {
33
37
  type: type,
34
- url: url
38
+ url: url,
39
+ groupIndex: this.properties.groupIndex
35
40
  })
36
41
  }
37
42
  }
@@ -3,6 +3,7 @@ const doctorLoader = require('../public/doctor-loader')
3
3
  const defines = require('./video-chat-defines')
4
4
  const pdfViewer = require('../public/pdf-viewer')
5
5
  const hhNavigation = require('../hh-navigation')
6
+ const deviceUtil = require('../utils/device-utils')
6
7
 
7
8
  Page({
8
9
 
@@ -201,27 +202,69 @@ Page({
201
202
  clickMedia(e) {
202
203
  const {
203
204
  type,
204
- url
205
+ url,
206
+ groupIndex
205
207
  } = e.detail
206
- if (type === 'video' || type === 'image') {
207
- const find = this.data._mediaFiles.findIndex((value, index, array) => {
208
- return value.url == url
209
- })
210
- wx.previewMedia({
211
- current: find,
212
- sources: this.data._mediaFiles,
213
- })
214
- } else if (type === 'pdf') {
215
- pdfViewer.viewPdf(url)
216
- } else if (type === 'url') {
217
- // hhNavigation.webPage(url)
218
- hhNavigation.copyUrl(url)
219
- } else if (type === 'dicom') {
220
- hhNavigation.pathology(this.data.orderId, null, null, true)
221
- } else if (type === 'bingli') {
222
- let hospitalId = this.data.order.doctor.hospitalid
223
- hhNavigation.pathology(this.data.orderId, hospitalId, null, false)
208
+ const files = this.data.caseGroups[groupIndex].files
209
+ const find = files.findIndex((value, index, array) => {
210
+ return value.url == url
211
+ })
212
+ switch (type) {
213
+ case 'image':
214
+ const images = files.map((value) => {
215
+ return value.url
216
+ })
217
+ wx.previewImage({
218
+ current: url,
219
+ urls: images,
220
+ })
221
+ break
222
+ case 'video':
223
+ if (deviceUtil.isPC()) {
224
+ hhNavigation.mediaPreview(files, find)
225
+ } else {
226
+ wx.previewMedia({
227
+ current: find,
228
+ sources: files,
229
+ fail: (err) => {
230
+ console.error(err)
231
+ }
232
+ })
233
+ }
234
+ break
235
+ case 'pdf':
236
+ pdfViewer.viewPdf(url)
237
+ break
238
+ case 'url':
239
+ hhNavigation.copyUrl(url)
240
+ break
241
+ case 'dicom':
242
+ hhNavigation.pathology(this.data.orderId, null, null, true)
243
+ break
244
+ case 'bingli':
245
+ let hospitalId = this.data.order.doctor.hospitalid
246
+ hhNavigation.pathology(this.data.orderId, hospitalId, null, false)
247
+ break
224
248
  }
249
+ // if (type === 'video' || type === 'image') {
250
+ // const fileList = this.data.caseGroups[groupIndex].files
251
+ // const find = fileList.findIndex((value, index, array) => {
252
+ // return value.url == url
253
+ // })
254
+ // wx.previewMedia({
255
+ // current: find,
256
+ // sources: this.data._mediaFiles,
257
+ // })
258
+ // } else if (type === 'pdf') {
259
+ // pdfViewer.viewPdf(url)
260
+ // } else if (type === 'url') {
261
+ // hhNavigation.copyUrl(url)
262
+ // } else if (type === 'dicom') {
263
+ // hhNavigation.pathology(this.data.orderId, null, null, true)
264
+ // } else if (type === 'bingli') {
265
+ // let hospitalId = this.data.order.doctor.hospitalid
266
+ // hhNavigation.pathology(this.data.orderId, hospitalId, null, false)
267
+ // }
225
268
  },
226
269
 
227
270
  updateUserAudioStatus(data) {
@@ -85,6 +85,7 @@
85
85
  bind:clickMedia="clickMedia"
86
86
  title="{{item.title}}"
87
87
  files="{{item.files}}"
88
+ groupIndex="{{index}}"
88
89
  />
89
90
  </block>
90
91
  </scroll-view>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hh-doctor-sdk",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "和缓名医小程序SDK",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"