hh-doctor-sdk 0.6.9 → 0.7.2
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 +22 -6
- package/components/apis/dicom-api.js +11 -1
- package/components/apis/stat-log-api.js +11 -1
- package/components/consultation/detail/consultation-detail-page.js +1 -2
- package/components/consultation/detail/widget/chat-bottom/chat-bottom.js +1 -1
- package/components/consultation/list/behaviors/consultation-list-base-behaviors.js +1 -1
- package/components/consultation/list/consultation-list-page.js +1 -4
- package/components/hh-doctor.js +24 -1
- package/components/hh-navigation.js +5 -8
- package/components/public/cache-data.js +0 -5
- package/components/public/doctor-loader.js +1 -3
- package/components/public/im-manager.js +1 -1
- package/components/utils/httpUtils.js +11 -1
- package/components/video-chat-page/behaviors/chat-log-behaviors.js +1 -3
- package/components/video-chat-page/video-chat-page.js +1 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// 已废弃 cache.isTest(),改用 getApp().globalData.profileName
|
|
2
2
|
|
|
3
3
|
const hostTypes = {
|
|
4
4
|
order: 'order', // host order app
|
|
@@ -26,37 +26,53 @@ const healthProd = 'https://mhealth.hh-medic.com/familyplatformdisease'
|
|
|
26
26
|
const wmpTest = 'https://test.hh-medic.com/wmp'
|
|
27
27
|
const wmpProd = 'https://wmp.hh-medic.com/wmp'
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* 安全获取环境配置,默认返回生产环境
|
|
31
|
+
* @returns {string} 'test' 或 'prod'
|
|
32
|
+
*/
|
|
33
|
+
function _getProfileName() {
|
|
34
|
+
try {
|
|
35
|
+
const app = getApp()
|
|
36
|
+
if (app && app.globalData && app.globalData.profileName) {
|
|
37
|
+
return app.globalData.profileName
|
|
38
|
+
}
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.warn('获取环境配置失败,使用默认生产环境:', error)
|
|
41
|
+
}
|
|
42
|
+
// 默认返回生产环境
|
|
43
|
+
return 'prod'
|
|
44
|
+
}
|
|
29
45
|
|
|
30
46
|
function _requestHost() {
|
|
31
|
-
if (
|
|
47
|
+
if (_getProfileName() === 'test') {
|
|
32
48
|
return testHost
|
|
33
49
|
}
|
|
34
50
|
return prodHost
|
|
35
51
|
}
|
|
36
52
|
|
|
37
53
|
function _familyHost() {
|
|
38
|
-
if (
|
|
54
|
+
if (_getProfileName() === 'test') {
|
|
39
55
|
return familyTest
|
|
40
56
|
}
|
|
41
57
|
return familyProd
|
|
42
58
|
}
|
|
43
59
|
|
|
44
60
|
function _dicomHost() {
|
|
45
|
-
if (
|
|
61
|
+
if (_getProfileName() === 'test') {
|
|
46
62
|
return dicomTest
|
|
47
63
|
}
|
|
48
64
|
return dicomProd
|
|
49
65
|
}
|
|
50
66
|
|
|
51
67
|
function _statHost() {
|
|
52
|
-
if (
|
|
68
|
+
if (_getProfileName() === 'test') {
|
|
53
69
|
return statLogTest
|
|
54
70
|
}
|
|
55
71
|
return statLogProd
|
|
56
72
|
}
|
|
57
73
|
|
|
58
74
|
function _healthHost() {
|
|
59
|
-
if (
|
|
75
|
+
if (_getProfileName() === 'test') {
|
|
60
76
|
return healthTest
|
|
61
77
|
}
|
|
62
78
|
return healthProd
|
|
@@ -47,7 +47,17 @@ function getPatholotyDetail(hospitalId, orderId, path) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
function dicomUrl(id) {
|
|
50
|
-
|
|
50
|
+
// 安全获取环境配置
|
|
51
|
+
let profileName = 'prod'
|
|
52
|
+
try {
|
|
53
|
+
const app = getApp()
|
|
54
|
+
if (app && app.globalData && app.globalData.profileName) {
|
|
55
|
+
profileName = app.globalData.profileName
|
|
56
|
+
}
|
|
57
|
+
} catch (error) {
|
|
58
|
+
console.warn('获取环境配置失败,使用默认生产环境:', error)
|
|
59
|
+
}
|
|
60
|
+
const baseUrl = (profileName === 'test') ? 'https://test.hh-medic.com/dicom/dicomviewer/viewer.html' : 'https://dicom.hh-medic.com/dicomviewer/viewer.html'
|
|
51
61
|
const timestamp = new Date().getTime()
|
|
52
62
|
const checksum = checksumUtils.sha1(`Bck3bOeR5rSJ${id}${timestamp}`)
|
|
53
63
|
return `${baseUrl}?Nonce=${id}&CurTime=${timestamp}&CheckSum=${checksum}`
|
|
@@ -46,7 +46,17 @@ function pointLog(type, content, orderId) {
|
|
|
46
46
|
if (!route.includes('video-chat-page/video-chat-page')) {
|
|
47
47
|
return
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
// 安全获取环境配置
|
|
50
|
+
let profileName = 'prod'
|
|
51
|
+
try {
|
|
52
|
+
const app = getApp()
|
|
53
|
+
if (app && app.globalData && app.globalData.profileName) {
|
|
54
|
+
profileName = app.globalData.profileName
|
|
55
|
+
}
|
|
56
|
+
} catch (error) {
|
|
57
|
+
console.warn('获取环境配置失败,使用默认生产环境:', error)
|
|
58
|
+
}
|
|
59
|
+
const isTest = (profileName === 'test')
|
|
50
60
|
let host = isTest ? 'https://test.hh-medic.com/point-log?' : "https://sec.hh-medic.com/point-log?"
|
|
51
61
|
const id = cache.getLogId() || 1
|
|
52
62
|
let url = `${host}sdkProductId=${appConfig.appID}`
|
|
@@ -76,7 +76,7 @@ Component({
|
|
|
76
76
|
_startVideo() {
|
|
77
77
|
const order = this.properties.order
|
|
78
78
|
if (order && order.orderid && order.orderid.length > 0) {
|
|
79
|
-
hhNavigation.videoChat(order.orderid, cache.doctorId(),
|
|
79
|
+
hhNavigation.videoChat(order.orderid, cache.doctorId(), false)
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
|
|
@@ -158,7 +158,7 @@ module.exports = Behavior({
|
|
|
158
158
|
|
|
159
159
|
clickOrderItem: function (event) {
|
|
160
160
|
let orderId = event.currentTarget.dataset.orderid
|
|
161
|
-
hhNavigation.orderDetail(orderId.trim(), cache.doctorId()
|
|
161
|
+
hhNavigation.orderDetail(orderId.trim(), cache.doctorId())
|
|
162
162
|
},
|
|
163
163
|
}
|
|
164
164
|
})
|
|
@@ -52,9 +52,7 @@ Page({
|
|
|
52
52
|
wx.statLog.sendStatLog(null, '打开咨询单列表界面')
|
|
53
53
|
const doctorId = wx.getStorageSync('doctorId') || ''
|
|
54
54
|
// console.error(`doctorId => ${doctorId}`)
|
|
55
|
-
const isTest = (getApp().globalData.profileName || 'prod') == 'test'
|
|
56
55
|
cache.cache({
|
|
57
|
-
isTest: isTest,
|
|
58
56
|
doctorId: doctorId
|
|
59
57
|
})
|
|
60
58
|
if (!doctorId) {
|
|
@@ -78,8 +76,7 @@ Page({
|
|
|
78
76
|
isLogin: true
|
|
79
77
|
})
|
|
80
78
|
doctorLoader.loadDoctor({
|
|
81
|
-
doctorId: doctorId
|
|
82
|
-
isTest: isTest,
|
|
79
|
+
doctorId: doctorId
|
|
83
80
|
}, (result) => {
|
|
84
81
|
if (result) {
|
|
85
82
|
if (this.data.init) {
|
package/components/hh-doctor.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
const api = require('./apis/order-app-api')
|
|
2
|
+
const { doctor } = require('./public/cache-data')
|
|
3
|
+
|
|
1
4
|
function initEventBus() {
|
|
2
5
|
if (wx.eventBus) {
|
|
3
6
|
return
|
|
@@ -34,6 +37,25 @@ function setLoginCheck(judgeLogin, directLogin) {
|
|
|
34
37
|
wx.loginConfig.directLogin = directLogin
|
|
35
38
|
}
|
|
36
39
|
|
|
40
|
+
/**
|
|
41
|
+
* 检测医生信息是否认证完成
|
|
42
|
+
* @param {*} doctorId 医生Id
|
|
43
|
+
*/
|
|
44
|
+
async function isDoctorAuth(doctorId) {
|
|
45
|
+
try {
|
|
46
|
+
const res = await api.getDoctorInfo(doctorId);
|
|
47
|
+
if (res && res.data) {
|
|
48
|
+
const doctorInfo = res.data;
|
|
49
|
+
const isAuthHH = doctorInfo.authhh === 1;
|
|
50
|
+
const haveLicense = (doctorInfo.superLicenseUrl && doctorInfo.superLicenseUrl.length > 0) || (doctorInfo.superLicense1Url && doctorInfo.superLicense1Url.length > 0);
|
|
51
|
+
return isAuthHH && haveLicense;
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
54
|
+
} catch {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
37
59
|
function enterForground() {
|
|
38
60
|
wx.statLog.sendStatLog('', '学术小程序进入前台')
|
|
39
61
|
wx.statLog.pointLog(0, {
|
|
@@ -61,5 +83,6 @@ module.exports = {
|
|
|
61
83
|
initStatLog,
|
|
62
84
|
setLoginCheck,
|
|
63
85
|
enterForground,
|
|
64
|
-
enterBackground
|
|
86
|
+
enterBackground,
|
|
87
|
+
isDoctorAuth
|
|
65
88
|
}
|
|
@@ -38,18 +38,16 @@ function navigateTo(path, params) {
|
|
|
38
38
|
})
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
function orderList() {
|
|
41
|
+
function orderList(doctorId) {
|
|
42
42
|
navigateTo(pages.orderList, {
|
|
43
|
-
|
|
44
|
-
// 'isTest': isTest
|
|
43
|
+
'doctorId': doctorId
|
|
45
44
|
})
|
|
46
45
|
}
|
|
47
46
|
|
|
48
|
-
function orderDetail(orderId, doctorId
|
|
47
|
+
function orderDetail(orderId, doctorId) {
|
|
49
48
|
navigateTo(pages.orderDetail, {
|
|
50
49
|
'orderId': orderId,
|
|
51
|
-
'doctorId': doctorId
|
|
52
|
-
'isTest': isTest
|
|
50
|
+
'doctorId': doctorId
|
|
53
51
|
})
|
|
54
52
|
}
|
|
55
53
|
|
|
@@ -77,11 +75,10 @@ function evaluate(orderId, isRequest) {
|
|
|
77
75
|
})
|
|
78
76
|
}
|
|
79
77
|
|
|
80
|
-
function videoChat(orderId, doctorId,
|
|
78
|
+
function videoChat(orderId, doctorId, callback) {
|
|
81
79
|
navigateTo(pages.videoChat, {
|
|
82
80
|
'orderId': orderId,
|
|
83
81
|
'doctorId': doctorId,
|
|
84
|
-
'isTest': isTest,
|
|
85
82
|
'callback': callback || false
|
|
86
83
|
})
|
|
87
84
|
}
|
|
@@ -119,17 +119,12 @@ function isLoadDoctor() {
|
|
|
119
119
|
return doctor() != null
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
function isTest() {
|
|
123
|
-
return getValue('isTest') || false
|
|
124
|
-
}
|
|
125
|
-
|
|
126
122
|
module.exports = {
|
|
127
123
|
cache,
|
|
128
124
|
isLoadDoctor,
|
|
129
125
|
getValue,
|
|
130
126
|
uuid,
|
|
131
127
|
videoToken,
|
|
132
|
-
isTest,
|
|
133
128
|
doctorId,
|
|
134
129
|
doctorName,
|
|
135
130
|
doctor,
|
|
@@ -7,7 +7,6 @@ const cache = require('./cache-data')
|
|
|
7
7
|
*/
|
|
8
8
|
function loadDoctor(options, callback) {
|
|
9
9
|
const doctorId = options.doctorId
|
|
10
|
-
const isTest = options.isTest || false
|
|
11
10
|
if (!doctorId) {
|
|
12
11
|
wx.statLog.sendStatLog(null, `场景:${options.scence || '未知'} 未传必要的参数`)
|
|
13
12
|
wx.showToast({
|
|
@@ -22,8 +21,7 @@ function loadDoctor(options, callback) {
|
|
|
22
21
|
// 如果传入是新的doctorId,重新缓存doctorId并重置doctor为空
|
|
23
22
|
cache.cache({
|
|
24
23
|
doctorId: doctorId,
|
|
25
|
-
doctor: null
|
|
26
|
-
isTest: isTest
|
|
24
|
+
doctor: null
|
|
27
25
|
})
|
|
28
26
|
}
|
|
29
27
|
|
|
@@ -36,7 +36,7 @@ function onMessage(message) {
|
|
|
36
36
|
const command = message.command
|
|
37
37
|
if (command === 'call') { // 收到了回拨消息
|
|
38
38
|
const orderId = message.orderId
|
|
39
|
-
hhNavigation.videoChat(orderId, null,
|
|
39
|
+
hhNavigation.videoChat(orderId, null, true)
|
|
40
40
|
return true
|
|
41
41
|
}
|
|
42
42
|
return false
|
|
@@ -45,7 +45,17 @@ function _request(request, method, params, data) {
|
|
|
45
45
|
if (uuid) {
|
|
46
46
|
fullParams.uuid = uuid
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
// 安全获取环境配置
|
|
49
|
+
let profileName = 'prod'
|
|
50
|
+
try {
|
|
51
|
+
const app = getApp()
|
|
52
|
+
if (app && app.globalData && app.globalData.profileName) {
|
|
53
|
+
profileName = app.globalData.profileName
|
|
54
|
+
}
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.warn('获取环境配置失败,使用默认生产环境:', error)
|
|
57
|
+
}
|
|
58
|
+
fullParams.session_id = (profileName === 'test') ? appConfig.sessionId : appConfig.sessionIdProd
|
|
49
59
|
fullParams.random = new Date().getTime()
|
|
50
60
|
|
|
51
61
|
for (let [key, value] of Object.entries(fullParams)) {
|