hh-doctor-sdk 0.3.1 → 0.3.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.
@@ -8,6 +8,10 @@ const apiPaths = {
8
8
  hostType: hostDefine.hostTypes.dicom,
9
9
  path: '/service/querydicom'
10
10
  },
11
+ getPathology: {
12
+ hostType: hostDefine.hostTypes.dicom,
13
+ path: '/api/pathology',
14
+ }
11
15
  }
12
16
 
13
17
  function getDicom(orderId) {
@@ -18,6 +22,30 @@ function getDicom(orderId) {
18
22
  return httpUtils.get(apiPaths.getDicom, params, {})
19
23
  }
20
24
 
25
+ function getPatholoty(hospitalId, orderId, path) {
26
+ let params = {
27
+ 'action': 'listmenu',
28
+ 'hospitalid': hospitalId,
29
+ 'orderid': orderId
30
+ }
31
+ if (path) {
32
+ params['path'] = path
33
+ }
34
+ return httpUtils.get(apiPaths.getPathology, params, {})
35
+ }
36
+
37
+ function getPatholotyDetail(hospitalId, orderId, path) {
38
+ let params = {
39
+ 'action': 'listall',
40
+ 'hospitalid': hospitalId,
41
+ 'orderid': orderId
42
+ }
43
+ if (path) {
44
+ params['path'] = path
45
+ }
46
+ return httpUtils.get(apiPaths.getPathology, params, {})
47
+ }
48
+
21
49
  function dicomUrl(id) {
22
50
  const baseUrl = cache.isTest() ? 'https://test.hh-medic.com/dicom/dicomviewer/viewer.html' : 'https://dicom.hh-medic.com/dicomviewer/viewer.html'
23
51
  const timestamp = new Date().getTime()
@@ -27,5 +55,7 @@ function dicomUrl(id) {
27
55
 
28
56
  module.exports = {
29
57
  getDicom,
30
- dicomUrl
58
+ dicomUrl,
59
+ getPatholoty,
60
+ getPatholotyDetail
31
61
  }
@@ -81,12 +81,14 @@ module.exports = Behavior({
81
81
  messages: list,
82
82
  isRequest: isRequest,
83
83
  }, () => {
84
- wx.createSelectorQuery().select('#scroll-body').boundingClientRect(res => {
85
- wx.pageScrollTo({
86
- scrollTop: res.bottom,
87
- duration: 200
88
- })
89
- }).exec()
84
+ setTimeout(() => {
85
+ wx.createSelectorQuery().select('#scroll-body').boundingClientRect(res => {
86
+ wx.pageScrollTo({
87
+ scrollTop: res.bottom,
88
+ duration: 200
89
+ })
90
+ }).exec()
91
+ }, 500);
90
92
  })
91
93
  }
92
94
  },
@@ -2,6 +2,7 @@ const pdfViewer = require('../../../public/pdf-viewer')
2
2
  const dicomApi = require('../../../apis/dicom-api')
3
3
  const caseImageFilter = require('../widget/case-image-filter')
4
4
  const hhNavigation = require('../../../hh-navigation')
5
+ const cache = require('../../../public/cache-data')
5
6
 
6
7
  module.exports = Behavior({
7
8
 
@@ -30,7 +31,7 @@ module.exports = Behavior({
30
31
  /**
31
32
  * 构建多媒体文件数据
32
33
  * @param {*} index 分组下标
33
- * @param {*} type 类型 0.图片 1.pdf 2.DICOM 4.视频 5.URL DICOM
34
+ * @param {*} type 类型 0.图片 1.pdf 2.DICOM 4.视频 5.URL DICOM 6.病理
34
35
  * @param {*} label 显示标题
35
36
  * @param {*} files 文件列表
36
37
  */
@@ -98,6 +99,10 @@ module.exports = Behavior({
98
99
  mediaGroups.push(this.mediaItem(groupIndex, 2, 'DICOM', [], 'https://imgs.hh-medic.com/icon/hh_consulation_dicom_icon.png', '点击查看'))
99
100
  groupIndex++
100
101
  }
102
+ if (order.patient.patientBingli && order.patient.patientBingli.length > 0) {
103
+ mediaGroups.push(this.mediaItem(groupIndex, 6, '病理', [], 'http://image.hh-medic.com/icon/pacs/hh_icon_bingli.png', '点击查看'))
104
+ groupIndex++
105
+ }
101
106
  this.setData({
102
107
  mediaInfo: mediaGroups
103
108
  })
@@ -148,6 +153,9 @@ module.exports = Behavior({
148
153
  const url = media.files[0].url
149
154
  hhNavigation.webPage(url)
150
155
  }
156
+ } else if (media.type == 6) {
157
+ let hospitalId = this.data.order.doctor.hospitalid
158
+ hhNavigation.pathology(this.data.orderId, hospitalId)
151
159
  }
152
160
  },
153
161
 
@@ -123,10 +123,12 @@ function _normalMenus(order) {
123
123
  if (haveInvite) {
124
124
  menus.push(_menu(ChatEventType.discuss, '内部讨论'))
125
125
  menus.push(_menu(ChatEventType.reply, '回复意见', 1))
126
+ } else {
127
+ menus.push(_menu(ChatEventType.reply, '回复意见', 1))
126
128
  }
127
129
  break
128
130
  default:
129
- // menus.push(_menu(ChatEventType.reply, '回复意见', 1))
131
+ menus.push(_menu(ChatEventType.reply, '回复意见', 1))
130
132
  break;
131
133
  }
132
134
  return menus
@@ -139,7 +141,6 @@ function _normalMenus(order) {
139
141
  function _doctorNormalMenu(order) {
140
142
  var menus = []
141
143
  const state = order.state
142
- console.error(`order state => ${state}`)
143
144
  const isPaySuccess = (order.needPayMoney || 0) <= 0
144
145
  const canFeedback = order.orderMessage && (order.orderMessage.needDoctorFeedback || false)
145
146
  const canAsk = (order.isask || 0) == 1
@@ -145,9 +145,6 @@ module.exports = Behavior({
145
145
  wx.showLoading({
146
146
  title: '保存中...',
147
147
  })
148
-
149
- console.error(JSON.stringify(body))
150
-
151
148
  api.requestReply(type, params, body).then((res) => {
152
149
  wx.hideLoading()
153
150
  if (res.status == 200 && res.data) {
@@ -5,6 +5,7 @@ const pages = {
5
5
  webPage: 'uikit/web-view-page/web-view-page',
6
6
  evaluate: 'consultation/evaluate/evaluate-page',
7
7
  videoChat: 'video-chat-page/video-chat-page',
8
+ pathology: 'pathology/pathology-page'
8
9
  }
9
10
 
10
11
 
@@ -76,6 +77,20 @@ function videoChat(orderId, doctorId, isTest, callback) {
76
77
  })
77
78
  }
78
79
 
80
+ function pathology(orderId, hospitalId, path) {
81
+ let params = {
82
+ 'orderId': orderId,
83
+ 'hospitalId': hospitalId
84
+ }
85
+ if (path) {
86
+ params['path'] = path
87
+ }
88
+ navigateTo(
89
+ pages.pathology,
90
+ params
91
+ )
92
+ }
93
+
79
94
  module.exports = {
80
95
  navigateTo,
81
96
  orderList,
@@ -84,4 +99,5 @@ module.exports = {
84
99
  webPage,
85
100
  evaluate,
86
101
  videoChat,
102
+ pathology,
87
103
  }
@@ -0,0 +1,130 @@
1
+ const dicomApi = require('../apis/dicom-api')
2
+ const hhNavigation = require('../hh-navigation')
3
+ const base64Utils = require('../utils/base64')
4
+
5
+ const basePathologyUrl = 'https://dicom.hh-medic.com/pathology/viewer'
6
+
7
+ Page({
8
+
9
+ /**
10
+ * 页面的初始数据
11
+ */
12
+ data: {
13
+ orderId: null,
14
+ hospitalId: null,
15
+ path: null,
16
+ list: [],
17
+ },
18
+
19
+ /**
20
+ * 生命周期函数--监听页面加载
21
+ */
22
+ onLoad(options) {
23
+ const orderId = options.orderId
24
+ const hospitalId = options.hospitalId
25
+ let path = options.path || null
26
+ if (path != null) {
27
+ path = decodeURIComponent(path)
28
+ }
29
+ if (path != null) {
30
+ wx.setNavigationBarTitle({
31
+ title: path,
32
+ })
33
+ }
34
+ this.setData({
35
+ orderId: orderId,
36
+ hospitalId: hospitalId,
37
+ path: path,
38
+ })
39
+ },
40
+
41
+ /**
42
+ * 生命周期函数--监听页面初次渲染完成
43
+ */
44
+ onReady() {
45
+ wx.startPullDownRefresh()
46
+ },
47
+
48
+ /**
49
+ * 生命周期函数--监听页面显示
50
+ */
51
+ onShow() {
52
+
53
+ },
54
+
55
+ /**
56
+ * 生命周期函数--监听页面隐藏
57
+ */
58
+ onHide() {
59
+
60
+ },
61
+
62
+ /**
63
+ * 生命周期函数--监听页面卸载
64
+ */
65
+ onUnload() {
66
+
67
+ },
68
+
69
+ /**
70
+ * 页面相关事件处理函数--监听用户下拉动作
71
+ */
72
+ onPullDownRefresh() {
73
+ this._loadList()
74
+ },
75
+
76
+ /**
77
+ * 页面上拉触底事件的处理函数
78
+ */
79
+ onReachBottom() {
80
+
81
+ },
82
+
83
+ /**
84
+ * 用户点击右上角分享
85
+ */
86
+ onShareAppMessage() {
87
+
88
+ },
89
+
90
+ clickCell: function (event) {
91
+ const name = event.currentTarget.dataset.name
92
+ if (this.data.path == null) {
93
+ hhNavigation.pathology(this.data.orderId, this.data.hospitalId, name)
94
+ } else {
95
+ dicomApi.getPatholotyDetail(this.data.hospitalId, this.data.orderId, name).then((res) => {
96
+ const dataEncode = encodeURIComponent(JSON.stringify(res.data))
97
+ const base64Params = base64Utils.base64Encode(dataEncode)
98
+ const url = `${basePathologyUrl}?para=${base64Params}`
99
+ hhNavigation.webPage(url)
100
+ })
101
+ }
102
+ },
103
+
104
+ _loadList() {
105
+ wx.showNavigationBarLoading()
106
+ const hospitalId = this.data.hospitalId
107
+ const orderId = this.data.orderId
108
+ const path = this.data.path
109
+ dicomApi.getPatholoty(hospitalId, orderId, path).then(res => {
110
+ wx.hideNavigationBarLoading()
111
+ wx.stopPullDownRefresh()
112
+ if (res.data && res.data.list) {
113
+ this.setData({
114
+ list: res.data.list,
115
+ })
116
+ if (!path || path == null) {
117
+ wx.setNavigationBarTitle({
118
+ title: res.data.hospital,
119
+ })
120
+ }
121
+ }
122
+ }).catch((e) => {
123
+ wx.hideNavigationBarLoading()
124
+ wx.stopPullDownRefresh()
125
+ wx.showToast({
126
+ title: '加载出错了',
127
+ })
128
+ })
129
+ }
130
+ })
@@ -0,0 +1,4 @@
1
+ {
2
+ "usingComponents": {},
3
+ "enablePullDownRefresh": true
4
+ }
@@ -0,0 +1,17 @@
1
+ <view>
2
+ <view class="tui-table-view">
3
+ <view
4
+ class="tui-col-3"
5
+ wx:for="{{list}}"
6
+ wx:key="item"
7
+ data-name="{{item.name}}"
8
+ bind:tap="clickCell"
9
+ >
10
+ <view class="tui-col-3-image-container">
11
+ <image class="tui-col-3-image" src="{{item.url}}"></image>
12
+ <view class="tui-col-3-count">共{{item.count}}张</view>
13
+ </view>
14
+ <view class="tui-col-3-name">{{item.name}}</view>
15
+ </view>
16
+ </view>
17
+ </view>
@@ -0,0 +1,52 @@
1
+ page {
2
+ background-color: #f3f5fb;
3
+ width: 100%;
4
+ height: 100%;
5
+ }
6
+
7
+ .tui-table-view {
8
+ display: -webkit-flex;
9
+ display: flex;
10
+ align-items: center;
11
+ justify-content: space-between;
12
+ flex-wrap: wrap;
13
+ width: 90%;
14
+ margin: 0 5%;
15
+ }
16
+ .tui-col-3 {
17
+ width: 47%;
18
+ text-align: center;
19
+ color: #797979;
20
+ padding-top: 20rpx;
21
+ font-size: 30rpx;
22
+ margin-bottom: 20rpx;
23
+ }
24
+
25
+ .tui-col-3-image-container {
26
+ position: relative;
27
+ height: 240rpx;
28
+ border-radius: 6rpx;
29
+ overflow: hidden;
30
+ }
31
+
32
+ .tui-col-3-image {
33
+ width: 100%;
34
+ height: 100%;
35
+ }
36
+
37
+ .tui-col-3-count {
38
+ background-color: rgba(0, 0, 0, 0.3);
39
+ position: absolute;
40
+ right: 0;
41
+ bottom: 0;
42
+ color: white;
43
+ font-size: 32rpx;
44
+ padding: 4rpx 10rpx;
45
+ border-radius: 6rpx;
46
+ }
47
+
48
+ .tui-col-3-name {
49
+ font-size: 32rpx;
50
+ margin-top: 20rpx;
51
+ color: #333333;
52
+ }
@@ -84,6 +84,14 @@ function uuid() {
84
84
  return null
85
85
  }
86
86
 
87
+ function userToken() {
88
+ const doctorInfo = doctor()
89
+ if (doctorInfo) {
90
+ return doctorInfo.userToken
91
+ }
92
+ return null
93
+ }
94
+
87
95
  function videoToken() {
88
96
  const doctorInfo = doctor()
89
97
  if (doctorInfo) {
@@ -130,5 +138,6 @@ module.exports = {
130
138
  getSessionId,
131
139
  getLogId,
132
140
  clearLogId,
133
- isRequest
141
+ isRequest,
142
+ userToken,
134
143
  }
@@ -0,0 +1,67 @@
1
+ // 实现Base64加密
2
+ function base64Encode(str) {
3
+ let base64 = new Base64();
4
+ return base64.encode(str);
5
+ }
6
+
7
+ // 实现Base64解密
8
+ function base64Decode(str) {
9
+ let base64 = new Base64();
10
+ return base64.decode(str);
11
+ }
12
+
13
+ // 定义Base64对象
14
+ function Base64() {
15
+
16
+ // Base64字符集
17
+ const base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
18
+
19
+ // 编码函数
20
+ this.encode = function (str) {
21
+ let result = '';
22
+ for (let i = 0; i < str.length; i += 3) {
23
+ let a = str.charCodeAt(i);
24
+ let b = i + 1 < str.length ? str.charCodeAt(i + 1) : 0;
25
+ let c = i + 2 < str.length ? str.charCodeAt(i + 2) : 0;
26
+
27
+ let a1 = a >> 2,
28
+ a2 = ((a & 3) << 4) | (b >> 4),
29
+ a3 = ((b & 15) << 2) | (c >> 6),
30
+ a4 = c & 63;
31
+
32
+ result += base64Chars[a1] + base64Chars[a2] + (i + 1 < str.length ? base64Chars[a3] : '=') + (i + 2 < str.length ? base64Chars[a4] : '=');
33
+ }
34
+ return result;
35
+ }
36
+
37
+ // 解码函数
38
+ this.decode = function (str) {
39
+ let result = '';
40
+ let i = 0;
41
+ while (i < str.length) {
42
+ let a = base64Chars.indexOf(str.charAt(i++));
43
+ let b = base64Chars.indexOf(str.charAt(i++));
44
+ let c = base64Chars.indexOf(str.charAt(i++));
45
+ let d = base64Chars.indexOf(str.charAt(i++));
46
+
47
+ let a1 = (a << 2) | (b >> 4);
48
+ let a2 = ((b & 15) << 4) | (c >> 2);
49
+ let a3 = ((c & 3) << 6) | d;
50
+
51
+ result += String.fromCharCode(a1);
52
+ if (c != 64) {
53
+ result += String.fromCharCode(a2);
54
+ }
55
+ if (d != 64) {
56
+ result += String.fromCharCode(a3);
57
+ }
58
+ }
59
+ return result;
60
+ }
61
+ }
62
+
63
+ // 向外暴露方法
64
+ module.exports = {
65
+ base64Encode: base64Encode,
66
+ base64Decode: base64Decode
67
+ }
@@ -61,7 +61,7 @@ function _request(request, method, params, data) {
61
61
  const header = {
62
62
  'Accept': 'application/json',
63
63
  'content-type': 'application/json',
64
- 'cookie': cookie,
64
+ // 'cookie': cookie,
65
65
  'APPTYPE': 'pc',
66
66
  'AppKey': appConfig.appKey,
67
67
  'Nonce': nonce,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hh-doctor-sdk",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "和缓名医小程序SDK",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"