hh-doctor-sdk 0.0.2 → 0.0.4

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.
@@ -65,11 +65,12 @@ module.exports = Behavior({
65
65
 
66
66
  buildMessages() {
67
67
  let order = this.data.order
68
+ const isVideoFinish = this.data.order.isVideoFinish || false
68
69
  const orderAskList = order.orderaskList
69
70
  const isRequest = cache.isRequest(order.doctorid)
70
71
  if (orderAskList && orderAskList.length > 0) {
71
72
  const list = orderAskList.map((value, index, array) => {
72
- return this.createMessageItem(index, value, isRequest)
73
+ return this.createMessageItem(index, value, isRequest, isVideoFinish)
73
74
  }) || []
74
75
  if (this.needShowEvaluate(isRequest)) {
75
76
  // 添加评价
@@ -97,7 +98,7 @@ module.exports = Behavior({
97
98
  return message
98
99
  },
99
100
 
100
- createMessageItem(index, data, isRequest) {
101
+ createMessageItem(index, data, isRequest, isFinish) {
101
102
  var message = {}
102
103
  const isSend = cache.doctorId() == data.doctor.doctorid
103
104
  const status = data.status
@@ -198,7 +199,7 @@ module.exports = Behavior({
198
199
  if (contentType == 'videotime') { // 视频时间
199
200
  message.type = MessageTypes.notify_time
200
201
  message.template = MessageTemplates.notify_time
201
- if (data.showUpdateProvideTime && isSend) {
202
+ if (data.showUpdateProvideTime && isSend && !isFinish) {
202
203
  message.canEdit = true
203
204
  message.dateTimeArray = this.data.dateTimeArray
204
205
  message.dateTime = this.data.dateTime
@@ -42,10 +42,16 @@ module.exports = Behavior({
42
42
  setTimeout(() => {
43
43
  this.loadOrderInfo()
44
44
  }, 1000);
45
- }).catch((err) => {
45
+ }).catch((res) => {
46
46
  wx.hideLoading()
47
- wx.showToast({
48
- title: '设置时间失败',
47
+ let error_msg = res.error_msg || '设置时间失败'
48
+ wx.showModal({
49
+ title: '提示',
50
+ content: error_msg,
51
+ showCancel: false,
52
+ complete: (res) => {
53
+
54
+ }
49
55
  })
50
56
  })
51
57
  },
@@ -1,6 +1,7 @@
1
1
  const api = require('../../../apis/order-app-api')
2
2
  const cache = require('../../../public/cache-data')
3
3
  const hhNavigation = require('../../../hh-navigation')
4
+ const dateFormat = require('../../../utils/dateUtils')
4
5
 
5
6
  const NEED_PAY = "待付款";
6
7
 
@@ -72,16 +73,20 @@ module.exports = Behavior({
72
73
  },
73
74
 
74
75
  _buildOrderItem(isRequest, order, showLine) {
75
- var orderStatusTips = order.orderStatusTips
76
- var isPay = order.ispay == 1
77
- var patientName = order.patient.patientname == null || order.patient.patientname == '' ? '患者' : order.patient.patientname
78
- var doctorName = isRequest ? order.serviceExpertName : order.doctorname
79
- var hospital = isRequest ? order.serviceGroupName : order.hospitalname
80
- var orderType = order.orderType
81
- var provideType = order.orderService.provideType || 'normal'
76
+ let orderStatusTips = order.orderStatusTips
77
+ const isPay = order.ispay == 1
78
+ const patientName = order.patient.patientname == null || order.patient.patientname == '' ? '患者' : order.patient.patientname
79
+ const doctorName = isRequest ? order.serviceExpertName : order.doctorname
80
+ const hospital = isRequest ? order.serviceGroupName : order.hospitalname
81
+ const orderType = order.orderType
82
+ const provideType = order.orderService.provideType || 'normal'
82
83
  if (!isPay && order.state != -1) {
83
84
  orderStatusTips = '待付款'
84
85
  }
86
+ let provideTime = null
87
+ if (order.provideTime && order.provideTime > 0) {
88
+ provideTime = `视频时间:${dateFormat.format(new Date(order.provideTime), 'yyyy-MM-dd hh:mm')}`
89
+ }
85
90
  return {
86
91
  provideType: provideType,
87
92
  orderStatusTips: orderStatusTips,
@@ -92,7 +97,8 @@ module.exports = Behavior({
92
97
  orderType: orderType,
93
98
  icon: this._orderIcon(provideType),
94
99
  showLine: showLine,
95
- statusColor: this._orderStatusBackground(orderStatusTips)
100
+ statusColor: this._orderStatusBackground(orderStatusTips),
101
+ provideTime: provideTime,
96
102
  }
97
103
  },
98
104
 
@@ -1,5 +1,7 @@
1
1
  const doctorLoader = require('../../public/doctor-loader')
2
-
2
+ const {
3
+ judgeLogin
4
+ } = require('../../utils/uiUtil')
3
5
  Page({
4
6
 
5
7
 
@@ -16,16 +18,7 @@ Page({
16
18
  * 生命周期函数--监听页面加载
17
19
  */
18
20
  onLoad(options) {
19
- wx.statLog.sendStatLog(null, '打开咨询单列表界面')
20
- const doctorId = options.doctorId
21
- doctorLoader.loadDoctor({
22
- doctorId: doctorId,
23
- isTest: options.isTest,
24
- }, (result) => {
25
- if (result) {
26
- this.loadList()
27
- }
28
- })
21
+
29
22
  },
30
23
 
31
24
  /**
@@ -37,11 +30,38 @@ Page({
37
30
  * 生命周期函数--监听页面显示
38
31
  */
39
32
  onShow() {
40
- if (this.data.needRefresh) {
41
- this.setData({
42
- needRefresh: false,
33
+ if (judgeLogin()) {
34
+ wx.statLog.sendStatLog(null, '打开咨询单列表界面')
35
+ const doctorId = wx.getStorageSync('doctorId') || ''
36
+ const isTest = (getApp().globalData.profileName || 'prod') == 'test'
37
+ doctorLoader.loadDoctor({
38
+ doctorId: doctorId,
39
+ isTest: isTest,
40
+ }, (result) => {
41
+ if (result) {
42
+ this.loadList()
43
+ }
44
+ })
45
+ } else {
46
+ wx.showModal({
47
+ showCancel: true,
48
+ cancelText: '取消',
49
+ confirmText: '去登录',
50
+ confirmColor: "#0066ff",
51
+ content: "您还未登录,是否去登录?",
52
+ complete: (res) => {
53
+ if (res.cancel) {
54
+ wx.switchTab({
55
+ url: '/pages/recommend/recommend',
56
+ })
57
+ }
58
+ if (res.confirm) {
59
+ wx.navigateTo({
60
+ url: '/pkgMine/pages/mine/loginpage',
61
+ })
62
+ }
63
+ }
43
64
  })
44
- this.loadList()
45
65
  }
46
66
  },
47
67
 
@@ -32,17 +32,18 @@
32
32
  <view
33
33
  wx:if="{{order.orderStatusTips}}"
34
34
  class="order-status {{order.statusColor}}"
35
- >{{order.orderStatusTips}}</view
36
- >
35
+ >{{order.orderStatusTips}}
36
+ </view>
37
37
  </view>
38
38
  <view class="order-hospital"
39
- >{{order.doctorName}}
40
- {{order.hospitalName}}</view
41
- >
39
+ >{{order.doctorName}} {{order.hospitalName}}
40
+ </view>
42
41
  <view
43
- wx:if="{{order.showLine}}"
44
- class="line"
45
- ></view>
42
+ wx:if="{{order.provideTime != null}}"
43
+ class="provide-time"
44
+ >{{order.provideTime}}
45
+ </view>
46
+ <view wx:if="{{order.showLine}}" class="line" />
46
47
  </view>
47
48
  </block>
48
49
  </view>
@@ -24,6 +24,9 @@ page {
24
24
  }
25
25
 
26
26
  .order-item {
27
+ display: flex;
28
+ flex-direction: column;
29
+ align-items: flex-start;
27
30
  background-color: white;
28
31
  padding-left: 30rpx;
29
32
  }
@@ -35,13 +38,14 @@ page {
35
38
  }
36
39
 
37
40
  .order-patient {
41
+ width: 100%;
42
+ position: relative;
38
43
  color: #333333;
39
44
  font-size: 28rpx;
40
45
  display: flex;
41
46
  flex-direction: row;
42
47
  justify-content: space-between;
43
48
  margin-bottom: 20rpx;
44
- margin-right: 20rpx;
45
49
  padding-top: 20rpx;
46
50
  }
47
51
 
@@ -57,6 +61,15 @@ page {
57
61
  margin-bottom: 20rpx;
58
62
  }
59
63
 
64
+ .provide-time {
65
+ color: #f01414;
66
+ font-size: 24rpx;
67
+ margin-bottom: 20rpx;
68
+ border: #dcdcdc solid 2rpx;
69
+ border-radius: 6rpx;
70
+ padding: 2rpx 10rpx;
71
+ }
72
+
60
73
  .order-status {
61
74
  height: 30rpx;
62
75
  padding: 4rpx 8rpx;
@@ -67,6 +80,7 @@ page {
67
80
  align-content: center;
68
81
  justify-content: center;
69
82
  border-radius: 6rpx;
83
+ margin-right: 20rpx;
70
84
  }
71
85
 
72
86
  .order-status-icon {
@@ -43,6 +43,14 @@ module.exports = Behavior({
43
43
  title = '填写所需补充内容'
44
44
  placeHolder = '请在此填写要求医生补充的内容'
45
45
  break
46
+ case menuBuilder.ChatEventType.refuse:
47
+ title = '填写拒绝原因'
48
+ placeHolder = '请在此填写拒绝原因'
49
+ break
50
+ case menuBuilder.ChatEventType.reply:
51
+ title = '填写回复内容'
52
+ placeHolder = '请在此填回复内容'
53
+ break
46
54
  }
47
55
  this.setData({
48
56
  placeHolder: placeHolder
@@ -10,7 +10,7 @@ function initTim() {
10
10
  return
11
11
  }
12
12
  const imManager = require('./public/im-manager')
13
- imManager.init()
13
+ // imManager.init()
14
14
  wx.hhImManager = imManager
15
15
  }
16
16
 
@@ -3,11 +3,11 @@ function cache(data) {
3
3
  if (data.doctorId && data.doctorId !== null && data.doctorId !== '') {
4
4
  generateSessionId()
5
5
  }
6
- if (data.doctor != null) {
7
- const token = data.doctor.videoToken
8
- const uuid = data.doctor.uuid
9
- wx.hhImManager.loginIm(uuid, token)
10
- }
6
+ // if (data.doctor != null) {
7
+ // const token = data.doctor.videoToken
8
+ // const uuid = data.doctor.uuid
9
+ // wx.hhImManager.loginIm(uuid, token)
10
+ // }
11
11
  const newData = Object.assign(doctorOptions, data)
12
12
  wx.doctorOptions = newData
13
13
  }
@@ -10,9 +10,6 @@ const hhNavigation = require('../hh-navigation')
10
10
  const cache = require('../public/cache-data')
11
11
 
12
12
  var chat
13
- var isLogined = false
14
- var isReady = false
15
- var isInit = false
16
13
 
17
14
  let onMessageReceived = function (event) {
18
15
  const messageList = event.data;
@@ -30,7 +27,6 @@ let onMessageReceived = function (event) {
30
27
  } catch (ex) {
31
28
 
32
29
  }
33
-
34
30
  }
35
31
  });
36
32
  };
@@ -47,29 +43,32 @@ function onMessage(message) {
47
43
 
48
44
  let onSdkReady = function (event) {
49
45
  wx.statLog.sendStatLog(null, `IM SDK Ready`)
50
- isReady = true
51
46
  };
52
47
 
53
48
  let onSdkNotReady = function (event) {
54
49
  wx.statLog.sendStatLog(null, `IM SDK Not Ready ${JSON.stringify(event)}`)
55
- isReady = false
50
+ console.error('销毁腾讯IM实例 onSdkNotReady')
56
51
  };
57
52
 
58
53
  function init() {
59
- if (isInit) {
54
+ if (chat != null) {
60
55
  return
61
56
  }
62
57
  wx.statLog.sendStatLog(null, `初始化 IM 管理类`)
58
+ console.error('初始化 IM 管理类')
63
59
  let options = {
64
60
  SDKAppID: '1400073238'
65
61
  }
66
62
  chat = TencentCloudChat.create(options)
67
63
  chat.setLogLevel(0)
68
-
69
64
  chat.on(TencentCloudChat.EVENT.SDK_READY, onSdkReady);
70
65
  chat.on(TencentCloudChat.EVENT.SDK_NOT_READY, onSdkNotReady);
71
66
  chat.on(TencentCloudChat.EVENT.MESSAGE_RECEIVED, onMessageReceived);
72
- isInit = true
67
+
68
+
69
+ const uuid = cache.uuid()
70
+ const token = cache.videoToken()
71
+ loginIm(uuid, token)
73
72
  }
74
73
 
75
74
  /**
@@ -78,13 +77,13 @@ function init() {
78
77
  * @param {*} userSig 用户UserSign
79
78
  */
80
79
  function loginIm(userID, userSig) {
81
- wx.statLog.sendStatLog(null, `开始登录腾讯IM`)
80
+ wx.statLog.sendStatLog(null, '开始登录腾讯IM')
81
+ console.error('开始登录腾讯IM')
82
82
  if (chat) {
83
83
  chat.login({
84
84
  userID: userID.toString(),
85
85
  userSig
86
86
  }).then((res) => {
87
- isLogined = true
88
87
  wx.eventBus.post({
89
88
  params: {
90
89
  result: true
@@ -97,7 +96,7 @@ function loginIm(userID, userSig) {
97
96
  wx.statLog.sendStatLog(null, `登录腾讯IM完成`)
98
97
  }).catch((error) => {
99
98
  wx.statLog.sendStatLog(null, `登录腾讯IM失败 ${JSON.stringify(error)}`)
100
- isLogined = false
99
+ // isLogined = false
101
100
  wx.eventBus.post({
102
101
  params: {
103
102
  result: false
@@ -109,20 +108,16 @@ function loginIm(userID, userSig) {
109
108
  }
110
109
 
111
110
  function logoutIm() {
112
- if (isLogined) {
113
- if (chat) {
114
- chat.logout().then(() => {
115
- isLogined = false
116
- }).catch(() => {
117
- isLogined = false
118
- })
119
- }
111
+ if (chat) {
112
+ chat.logout().then(() => {}).catch(() => {})
120
113
  }
121
114
  }
122
115
 
123
116
  function destory() {
124
117
  if (chat) {
125
- chat.destory()
118
+ console.error('销毁腾讯IM实例')
119
+ chat.destroy()
120
+ chat = null
126
121
  }
127
122
  }
128
123
 
@@ -96,12 +96,15 @@ function _request(request, method, params, data) {
96
96
  setCookie(res.header['Set-Cookie']);
97
97
  }
98
98
  if (success(res)) {
99
+ console.error(`success => ${JSON.stringify(res.data)}`)
99
100
  resolve(res.data);
100
101
  } else {
101
- reject(res);
102
+ console.error(`failed => ${JSON.stringify(res.data)}`)
103
+ reject(res.data);
102
104
  }
103
105
  },
104
106
  fail: function (err) {
107
+ console.error(`fail => ${JSON.stringify(res)}`)
105
108
  reject(err);
106
109
  },
107
110
  })
@@ -0,0 +1,7 @@
1
+ function judgeLogin() {
2
+ return true
3
+ }
4
+
5
+ module.exports = {
6
+ judgeLogin,
7
+ }
@@ -2,18 +2,9 @@ Component({
2
2
 
3
3
  lifetimes: {
4
4
  attached: function () {
5
- if (this.data.showNotifyButton) {
6
- return
7
- }
8
- this.setData({
9
- delayShowTimer: setTimeout(() => {
10
- this.setData({
11
- showNotifyButton: true
12
- })
13
- }, 5000)
14
- })
5
+
15
6
  },
16
- detached: function() {
7
+ detached: function () {
17
8
  clearTimeout(this.data.delayShowTimer)
18
9
  this.setData({
19
10
  delayShowTimer: null
@@ -23,10 +14,10 @@ Component({
23
14
 
24
15
  pageLifetimes: {
25
16
  show: function () {
26
-
17
+
27
18
  },
28
19
  hide: function () {
29
-
20
+
30
21
  },
31
22
  resize: function () {
32
23
 
@@ -37,15 +28,20 @@ Component({
37
28
  * 组件的属性列表
38
29
  */
39
30
  properties: {
40
- isFamilyOrder: {type: Boolean, value: false},
41
- smallVideoTop: {type: Number, value: 0}
31
+ isFamilyOrder: {
32
+ type: Boolean,
33
+ value: false
34
+ },
35
+ smallVideoTop: {
36
+ type: Number,
37
+ value: 0
38
+ }
42
39
  },
43
40
 
44
41
  /**
45
42
  * 组件的初始数据
46
43
  */
47
44
  data: {
48
- showNotifyButton: false,
49
45
  delayShowTimer: null
50
46
  },
51
47
 
@@ -59,17 +55,5 @@ Component({
59
55
  _cancelClick() {
60
56
  this.triggerEvent("cancel")
61
57
  },
62
-
63
- /**
64
- * 发送呼叫通知
65
- */
66
- _notifyCall() {
67
- this.triggerEvent("notifyCall")
68
- if (!this.properties.isFamilyOrder) {
69
- this.setData({
70
- showNotifyButton: false
71
- })
72
- }
73
- }
74
58
  }
75
59
  })
@@ -1,17 +1,7 @@
1
1
  <view class="calling-container">
2
- <view class="calling-tip-container">
3
- <view class="calling-tip-text">
4
- 您已进入视频,可在此界面耐心等待对方进入
5
- </view>
6
- <button
7
- class="calling-tip-button"
8
- bind:tap="_notifyCall"
9
- style="opacity:{{showNotifyButton ? 100 : 0}};"
10
- >
11
- 通知对方加入视频
12
- </button>
2
+ <view class="calling-tip-text">
3
+ 您已进入视频,可在此界面耐心等待对方进入
13
4
  </view>
14
-
15
5
  <image
16
6
  class="default_photo"
17
7
  src="https://image.hh-medic.com/icon/pacs/hh_chat_default_photo.png"
@@ -2,27 +2,20 @@
2
2
 
3
3
  .calling-container {
4
4
  display: flex;
5
- align-content: center;
6
- width: 100vw;
7
- height: 100vh;
8
- }
9
-
10
- .calling-tip-container {
11
- position: relative;
5
+ position: absolute;
12
6
  width: 100%;
13
- display: flex;
14
- align-items: center;
15
- flex-direction: column;
16
- justify-content: center;
7
+ height: 100%;
17
8
  }
18
9
 
19
10
  .calling-tip-text {
11
+ position: relative;
20
12
  display: flex;
21
13
  font-size: 28rpx;
22
14
  color: white;
23
15
  padding: 20rpx;
24
16
  background-color: #00000050;
25
17
  border-radius: 10rpx;
18
+ margin: auto auto;
26
19
  }
27
20
 
28
21
  .calling-tip-button {
@@ -33,41 +33,6 @@
33
33
  <view class="control-button-text">病历资料</view>
34
34
  <view wx:if="{{newCases}}" class="new-tip">NEW</view>
35
35
  </view>
36
- <!-- <view class="item-button" bindtap="_checkCaseClick">
37
- <image
38
- class="item-button-img"
39
- src="https://image.hh-medic.com/icon/pacs/hh_patient_info.png"
40
- mode=""
41
- />
42
- <view>病历资料</view>
43
- </view>
44
-
45
- <view class="item-button" bindtap="_checkPdfClick">
46
- <image
47
- class="item-button-img"
48
- src="https://image.hh-medic.com/icon/pacs/hh_pdf.png"
49
- mode=""
50
- />
51
- <view>PDF报告</view>
52
- </view>
53
-
54
- <view class="item-button" bindtap="_checkDicomClick">
55
- <image
56
- class="item-button-img"
57
- src="https://image.hh-medic.com/icon/pacs/hh_dicom.png"
58
- mode=""
59
- />
60
- <view>DICOM</view>
61
- </view>
62
-
63
- <view class="item-button" bindtap="_changeCameraClick">
64
- <image
65
- class="item-button-img"
66
- src="https://image.hh-medic.com/icon/pacs/hh_change_camera.png"
67
- mode=""
68
- />
69
- <view>翻转</view>
70
- </view> -->
71
36
  </view>
72
37
  </view>
73
38
  </view>
@@ -31,6 +31,7 @@ Page({
31
31
  if (!this.checkParams(options)) {
32
32
  return
33
33
  }
34
+ wx.hhImManager.init()
34
35
  this._sendLog('打开呼叫界面')
35
36
  wx.statLog.sendStatLog(this.data.orderId, '打开呼叫界面')
36
37
  this.bindIMMessageEvent()
@@ -64,6 +65,7 @@ Page({
64
65
  */
65
66
  onUnload() {
66
67
  this.unBindIMMessageEvent()
68
+ wx.hhImManager.destroy()
67
69
  },
68
70
 
69
71
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hh-doctor-sdk",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "和缓名医小程序SDK",
5
5
  "devDependencies": {},
6
6
  "scripts": {