Ver código fonte

对接龙游

xklr/wly 6 meses atrás
pai
commit
050b32b05e
3 arquivos alterados com 105 adições e 71 exclusões
  1. 14 1
      App.vue
  2. 90 69
      pages/index/index.vue
  3. 1 1
      static/.config.json

+ 14 - 1
App.vue

@@ -34,7 +34,8 @@
 		},
 		onLaunch: function(option) {
 			let token = window.location.search.split('token=')[1]
-			console.log('App Launch')
+			let serialNumber = window.location.search.split('serialNumber=')[1]
+			console.log('App Launch',token,serialNumber)
 			// console.log(token)
 			let t = this;
 			inforeq((res) => {
@@ -47,7 +48,19 @@
 							console.log('success');
 						}
 					});
+					
 					t.globalData.token = token
+					
+				}
+				if(serialNumber && serialNumber.length > 0){
+					uni.setStorage({
+						key: 'serialNumber',
+						data: serialNumber,
+						success: function() {
+							console.log('success');
+						}
+					});
+					t.globalData.serialNumber = serialNumber
 				}
 			})
 		},

+ 90 - 69
pages/index/index.vue

@@ -9,7 +9,8 @@
 						class="d-inline-block py-1 d-inline-block ml-auto text-white1" @click="closet">
 						[ 退出 ]
 					</span>
-					<span v-if="ipArr.find(item => item.ip == prodIp) && (ipArr.find(item => item.ip == prodIp).name == '兰溪')"
+					<span
+						v-if="ipArr.find(item => item.ip == prodIp) && (ipArr.find(item => item.ip == prodIp).name == '兰溪')"
 						class="d-inline-block py-1 d-inline-block ml-auto text-white1" @click="operation">
 						[ 切换 ]
 					</span>
@@ -17,9 +18,11 @@
 				<view class="centerY mt-2" @click="$mf.clickNavto('/pages/userinfo/userinfo')">
 					<view class="w-15 userhead">
 						<view class="picbox">
-							<image v-if="userData.sex == 1" src="@/static/img/defult/head1.png" mode="widthFix" class="picimg">
+							<image v-if="userData.sex == 1" src="@/static/img/defult/head1.png" mode="widthFix"
+								class="picimg">
 							</image>
-							<image v-if="userData.sex == 2" src="@/static/img/defult/head2.png" mode="widthFix" class="picimg">
+							<image v-if="userData.sex == 2" src="@/static/img/defult/head2.png" mode="widthFix"
+								class="picimg">
 							</image>
 						</view>
 					</view>
@@ -29,7 +32,8 @@
 							<view
 								:class="{ 'iconfont text-white fs-16 font-bold': true, ' nv': userData.sex == 2, nanxing: userData.sex == 1 }">
 							</view>
-							<view class="py-1 pl-2 text-center centerY text-gry80 bg-white ml-auto" style="border-radius: 6rpx;">
+							<view class="py-1 pl-2 text-center centerY text-gry80 bg-white ml-auto"
+								style="border-radius: 6rpx;">
 								<view class="">基础资料</view>
 								<view class="iconfont youla2 fs-12 font-bold"></view>
 							</view>
@@ -74,7 +78,8 @@
 											<view class=" d-flex px-2 py-1"
 												style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
 												血压
-												<span class="ml-auto ml-1">{{ physical.diastole || '-' }}/{{ physical.shrink || '-' }}
+												<span
+													class="ml-auto ml-1">{{ physical.diastole || '-' }}/{{ physical.shrink || '-' }}
 													mmHg</span>
 											</view>
 										</view>
@@ -96,7 +101,8 @@
 											<view class=" d-flex px-2 py-1"
 												style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
 												血糖
-												<span class="ml-auto ml-1">{{ physical.bloodGlucose || '-' }} mmol/L</span>
+												<span class="ml-auto ml-1">{{ physical.bloodGlucose || '-' }}
+													mmol/L</span>
 											</view>
 										</view>
 										<view class="w-50 border-box pl-1 mt-2">
@@ -116,8 +122,8 @@
 							mode="widthFix" class="w-100"></image>
 					</view>
 					<view class="w-50 pl-2 border-box mt-3">
-						<image @click="$mf.clickNavto('/pages/health_report/health_report')" src="@/static/img/index/jkbg.png"
-							mode="widthFix" class="w-100"></image>
+						<image @click="$mf.clickNavto('/pages/health_report/health_report')"
+							src="@/static/img/index/jkbg.png" mode="widthFix" class="w-100"></image>
 					</view>
 				</view>
 				<view class="mt-2">
@@ -125,8 +131,8 @@
 						mode="widthFix" class="w-100"></image>
 				</view>
 				<view class="mt-2">
-					<image @click="$mf.clickNavto('/pages/home_monitoring/home_monitoring')" src="@/static/img/index/jjjc.png"
-						mode="widthFix" class="w-100"></image>
+					<image @click="$mf.clickNavto('/pages/home_monitoring/home_monitoring')"
+						src="@/static/img/index/jjjc.png" mode="widthFix" class="w-100"></image>
 				</view>
 			</view>
 		</view>
@@ -169,7 +175,6 @@
 
 <script>
 	import ipArr from '@/config/servernet.config.js'
-	console.log(ipArr)
 	let globalData = getApp().globalData;
 	import Empty from '@/component/empty/empty.vue';
 	export default {
@@ -296,42 +301,48 @@
 			//龙游
 			longyou() {
 				let t = this;
-				// s({
-				// 	userId: '1232131',
-				// 	idCard: '330122195011081823'
-				// })
-				// async function s(res) {
-				// 	if (!res.userId) {
-				// 		uni.showModal({
-				// 			title: '提示',
-				// 			content: '您还未登录请先去登录!',
-				// 			showCancel: false,
-				// 			success: function(res2) {
-				// 				if (res2.confirm) {
-				// 					console.log('用户点击确定');
-				// 					uni.navigateBack({
-				// 						delta: 1 //返回层数,2则上上页
-				// 					});
-				// 				}
-				// 			}
-				// 		});
-				// 		return;
-				// 	}
-				// 	t.valueId = res.idCard;
-				// 	t.search()
-				// 	uni.hideLoading();
-				// }
-				// return
-				try {
-					window.yt.getUserInfo({
-						async success(res) {
-							if (!res.userId) {
+				uni.getStorage({
+					key: 'serialNumber',
+					async success(d) {
+						console.log(d)
+						if (!d.data) return;
+						fetch('http://220.191.237.238:8085/ehr/authentication', {
+							method: 'POST',
+							headers: {
+								"Content-Type": "application/json;charset=UTF-8"
+							},
+							body: JSON.stringify({
+								serialNumber: d.data
+							})
+						}).then(res => {
+							return res.json(res);
+						}).then(res => {
+							console.log(res); // 这里是获取到的数据
+							// t.getuserinfo('342201199608189314')
+							// return false
+							if (res.status == 1) {
+								t.getuserinfo(res.data.idCard)
+							} else if (res.status == 50000) {
 								uni.showModal({
 									title: '提示',
-									content: '您还未登录请先去登录!',
+									content: '未登录返回登录',
 									showCancel: false,
-									success: function(res2) {
-										if (res2.confirm) {
+									success: function(res3) {
+										if (res3.confirm) {
+											console.log('用户点击确定');
+											uni.navigateBack({
+												delta: 1 //返回层数,2则上上页
+											});
+										}
+									}
+								});
+							} else {
+								uni.showModal({
+									title: '提示',
+									content: res.msg,
+									showCancel: false,
+									success: function(res3) {
+										if (res3.confirm) {
 											console.log('用户点击确定');
 											uni.navigateBack({
 												delta: 1 //返回层数,2则上上页
@@ -339,21 +350,19 @@
 										}
 									}
 								});
-								return;
 							}
-							t.valueId = res.idCard;
-							t.search()
-							uni.hideLoading();
-						},
-						error() {
-							errordata();
-						}
-					});
-				} catch (e) {
-					// console.log(e)
+						})
+					},
+					fail(error) {
+						//未获取到token或者出错
+						errordata();
+					}
+				});
+
+				function errordata() {
 					uni.showModal({
 						title: '提示',
-						content: '环境异常',
+						content: '您还未登录请先去登录!',
 						showCancel: false,
 						success: function(res3) {
 							if (res3.confirm) {
@@ -365,15 +374,6 @@
 						}
 					});
 				}
-
-				function errordata() {
-					if (!uni.getStorageSync('idCard')) {
-						t.$refs.popup1.open();
-						uni.hideLoading();
-					} else {
-						t.getuserinfo(uni.getStorageSync('idCard'));
-					}
-				}
 			},
 			decrypt() {
 				//token解码
@@ -388,7 +388,7 @@
 						clearInterval(timer);
 					}
 					ipArr.map(async item => {
-						console.log(item.ip, globalData.configData.prodIp)
+						// console.log(item.ip, globalData.configData.prodIp)
 						if (item.ip == globalData.configData.prodIp && item.name == '龙游') {
 							t.longyou();
 							return;
@@ -493,10 +493,31 @@
 						this.$refs.popup1.close();
 						this.$refs.popup2.close();
 					} else {
-						uni.showToast({
-							title: '未查询到患者',
-							icon: 'error'
+						ipArr.map(async item => {
+							// console.log(item.ip, globalData.configData.prodIp)
+							if (item.ip == globalData.configData.prodIp && item.name == '龙游') {
+								uni.showModal({
+									title: '提示',
+									content: '患者不在慢病系统中!',
+									showCancel: false,
+									success: function(res3) {
+										if (res3.confirm) {
+											console.log('用户点击确定');
+											uni.navigateBack({
+												delta: 1 //返回层数,2则上上页
+											});
+										}
+									}
+								});
+							}else{
+								uni.showToast({
+									title: '未查询到患者',
+									icon: 'error'
+								});
+							}
+							
 						});
+						
 					}
 					uni.hideLoading();
 					uni.stopPullDownRefresh();

+ 1 - 1
static/.config.json

@@ -1,7 +1,7 @@
 {
 	"prodIp": "http://220.191.237.238:10066",
 	"img_prod_host": "http://img.xklr.net/",
-	"devIp": "http://192.168.1.103:10066",
+	"devIp": "https://lxh5api.xklr.net",
 	"testIp": "http://testapi.xklr.net:8601",
 	"appConfig": {
 		"jt_service_url": "http://118.31.70.1:8601",