index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. <template>
  2. <view class="mb-5">
  3. <view class="" v-if="userData.id">
  4. <view class="header p-3">
  5. <view class="centerY">
  6. <span class="d-inline-block fs-18 text-white font-bold">个人档案</span>
  7. <span
  8. v-if="ipArr.find(item => item.ip == prodIp) && (ipArr.find(item => item.ip == prodIp).name !== '兰溪'&&ipArr.find(item => item.ip == prodIp).name !== '龙游')"
  9. class="d-inline-block py-1 d-inline-block ml-auto text-white1" @click="closet">
  10. [ 退出 ]
  11. </span>
  12. <span v-if="ipArr.find(item => item.ip == prodIp) && (ipArr.find(item => item.ip == prodIp).name == '兰溪')"
  13. class="d-inline-block py-1 d-inline-block ml-auto text-white1" @click="operation">
  14. [ 切换 ]
  15. </span>
  16. </view>
  17. <view class="centerY mt-2" @click="$mf.clickNavto('/pages/userinfo/userinfo')">
  18. <view class="w-15 userhead">
  19. <view class="picbox">
  20. <image v-if="userData.sex == 1" src="@/static/img/defult/head1.png" mode="widthFix" class="picimg">
  21. </image>
  22. <image v-if="userData.sex == 2" src="@/static/img/defult/head2.png" mode="widthFix" class="picimg">
  23. </image>
  24. </view>
  25. </view>
  26. <view class="w-85 ml-3">
  27. <view class="text-white fs-16 font-bold">{{ userData.username || '' }}</view>
  28. <view class="centerY" style="margin-top:10rpx;">
  29. <view
  30. :class="{ 'iconfont text-white fs-16 font-bold': true, ' nv': userData.sex == 2, nanxing: userData.sex == 1 }">
  31. </view>
  32. <view class="py-1 pl-2 text-center centerY text-gry80 bg-white ml-auto" style="border-radius: 6rpx;">
  33. <view class="">基础资料</view>
  34. <view class="iconfont youla2 fs-12 font-bold"></view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="content p-3 bg-white mx-3 my-3 box-border08">
  41. <view class="" style="display:flex;flex-wrap: wrap !important;">
  42. <view class="w-100 border-box">
  43. <view class=""
  44. style="background: linear-gradient(180deg, rgb(151,220,249) 0%, rgb(110,197,246) 100%);border-radius: 16rpx;">
  45. <view class="px-3 pt-2 pb-3 ">
  46. <view class="centerY ">
  47. <view class="bule_line"></view>
  48. <text class="fs-18 ml-2 font-bold" style="color: #1C90D7;">个人体征</text>
  49. </view>
  50. <view class="mt-2" style="color: #000;">
  51. <view class="font-bold" style="display:flex;flex-wrap: wrap !important;">
  52. <view class="w-50 border-box pr-1">
  53. <view class=" d-flex px-2 py-1"
  54. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  55. 身高
  56. <span class="ml-auto ml-1">{{ physical.height || '-' }} cm</span>
  57. </view>
  58. </view>
  59. <view class="w-50 border-box pl-1">
  60. <view class=" d-flex px-2 py-1"
  61. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  62. 体重
  63. <span class="ml-auto ml-1">{{ physical.weight || '-' }} kg</span>
  64. </view>
  65. </view>
  66. <view class="w-50 border-box pr-1 mt-2">
  67. <view class=" d-flex px-2 py-1"
  68. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  69. BMI
  70. <span class="ml-auto ml-1">{{ physical.bmi || '-' }} kg/m^2</span>
  71. </view>
  72. </view>
  73. <view class="w-50 border-box pl-1 mt-2">
  74. <view class=" d-flex px-2 py-1"
  75. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  76. 血压
  77. <span class="ml-auto ml-1">{{ physical.diastole || '-' }}/{{ physical.shrink || '-' }}
  78. mmHg</span>
  79. </view>
  80. </view>
  81. <view class="w-50 border-box pr-1 mt-2">
  82. <view class=" d-flex px-2 py-1"
  83. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  84. 心率
  85. <span class="ml-auto ml-1">{{ physical.pulse || '-' }} bmp</span>
  86. </view>
  87. </view>
  88. <view class="w-50 border-box pl-1 mt-2">
  89. <view class=" d-flex px-2 py-1"
  90. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  91. 腰围
  92. <span class="ml-auto ml-1">{{ physical.waist || '-' }} cm</span>
  93. </view>
  94. </view>
  95. <view class="w-50 border-box pr-1 mt-2">
  96. <view class=" d-flex px-2 py-1"
  97. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  98. 血糖
  99. <span class="ml-auto ml-1">{{ physical.bloodGlucose || '-' }} mmol/L</span>
  100. </view>
  101. </view>
  102. <view class="w-50 border-box pl-1 mt-2">
  103. <view class=" d-flex px-2 py-1"
  104. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  105. 血氧
  106. <span class="ml-auto ml-1">{{ physical.spo2 || '-' }} mmHg</span>
  107. </view>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. <view class="w-50 pr-2 border-box mt-3">
  115. <image @click="$mf.clickNavto('/pages/medication/medication')" src="@/static/img/index/dqyy.png"
  116. mode="widthFix" class="w-100"></image>
  117. </view>
  118. <view class="w-50 pl-2 border-box mt-3">
  119. <image @click="$mf.clickNavto('/pages/health_report/health_report')" src="@/static/img/index/jkbg.png"
  120. mode="widthFix" class="w-100"></image>
  121. </view>
  122. </view>
  123. <view class="mt-2">
  124. <image @click="$mf.clickNavto('/pages/eye_ground/eye_ground')" src="@/static/img/index/ydjc.png"
  125. mode="widthFix" class="w-100"></image>
  126. </view>
  127. <view class="mt-2">
  128. <image @click="$mf.clickNavto('/pages/home_monitoring/home_monitoring')" src="@/static/img/index/jjjc.png"
  129. mode="widthFix" class="w-100"></image>
  130. </view>
  131. </view>
  132. </view>
  133. <view class="">
  134. <uni-popup ref="popup1" type="top" :mask-click="false">
  135. <view class=" w-80 mx-auto" style="margin-top: 30vh;">
  136. <view class="bg-white p-3 w-100 border-box" style="border-radius: 16rpx;">
  137. <view class="text-center mb-3 fs-14 font-bold py-2">查询</view>
  138. <view class=" centerY mb-3 w-100 border-box" style="overflow: hidden; ">
  139. <input type="text" v-model="valueId" class="px-2 m-0 fs-12 w-75 border-box"
  140. style="height: 70rpx;border: 2px solid #007aff;border-top-left-radius: 4rpx;border-bottom-left-radius: 4rpx;"
  141. placeholder="请输入身份证号码" placeholder-class="fs-12" />
  142. <uni-button type="primary" class="my-button fs-12 ml-auto border-box w-25"
  143. style="height: 70rpx;line-height: 70rpx; padding: 0 ;border-top-right-radius: 12rpx;border-bottom-right-radius: 12rpx;"
  144. @click="search">
  145. 搜索
  146. </uni-button>
  147. </view>
  148. </view>
  149. </view>
  150. </uni-popup>
  151. <uni-popup ref="popup2" type="top" :mask-click="false">
  152. <view class=" w-80 mx-auto" style="margin-top: 30vh;">
  153. <view class="bg-white p-3 w-100 text-center border-box" style="border-radius: 16rpx;">
  154. <view class="text-center mb-3 fs-14 font-bold py-2">患者列表</view>
  155. <view class="text-left centerY mb-3" style="border-radius: 14rpx;border: 2px solid #007aff;">
  156. <uni-data-select v-model="userIndex" :localdata="userArr" @change="bindPickerChange"
  157. placeholder="请选择身份"></uni-data-select>
  158. </view>
  159. <view class="" v-if="userArr.length == 0">
  160. <empty title="还未绑定患者" />
  161. </view>
  162. </view>
  163. </view>
  164. </uni-popup>
  165. </view>
  166. </view>
  167. </template>
  168. <script>
  169. import ipArr from '@/config/servernet.config.js'
  170. console.log(ipArr)
  171. let globalData = getApp().globalData;
  172. import Empty from '@/component/empty/empty.vue';
  173. export default {
  174. components: {
  175. Empty
  176. },
  177. data() {
  178. return {
  179. userData: {},
  180. physical: {},
  181. valueId: '',
  182. prodIp: '',
  183. ipArr,
  184. userArr: [],
  185. userIndex: null
  186. };
  187. },
  188. onLoad() {
  189. this.decrypt();
  190. },
  191. methods: {
  192. //正式
  193. async other() {
  194. let t = this;
  195. if (!uni.getStorageSync('idCard')) {
  196. t.$refs.popup1.open();
  197. uni.hideLoading();
  198. } else {
  199. t.getuserinfo(uni.getStorageSync('idCard'));
  200. }
  201. },
  202. //正式
  203. async zhengshi() {
  204. let t = this;
  205. if (!uni.getStorageSync('idCard')) {
  206. t.$refs.popup1.open();
  207. uni.hideLoading();
  208. } else {
  209. t.getuserinfo(uni.getStorageSync('idCard'));
  210. }
  211. },
  212. //兰溪
  213. lanxi() {
  214. let t = this;
  215. uni.getStorage({
  216. key: 'token',
  217. async success(res) {
  218. if (!res.data) return;
  219. let res2 = await t.$api.decrypt({
  220. toKen: res.data
  221. });
  222. if (res2.code !== -1) {
  223. if (!res2.data.uuid) {
  224. uni.showModal({
  225. title: '提示',
  226. content: '您还未登录请先去登录!',
  227. showCancel: false,
  228. success: function(res3) {
  229. if (res3.confirm) {
  230. console.log('用户点击确定');
  231. uni.navigateBack({
  232. delta: 1 //返回层数,2则上上页
  233. });
  234. }
  235. }
  236. });
  237. return;
  238. }
  239. if (res2.data.users && res2.data.users.length > 0) {
  240. t.$refs.popup2.open();
  241. t.userArr = [];
  242. res2.data.users.map((item, index) => {
  243. t.userArr.push({
  244. value: index,
  245. text: item.idcard
  246. });
  247. });
  248. uni.hideLoading();
  249. } else {
  250. t.$refs.popup2.open();
  251. t.userArr = [];
  252. res2.data.users.map((item, index) => {
  253. t.userArr.push({
  254. value: index,
  255. text: item.idcard
  256. });
  257. });
  258. uni.hideLoading();
  259. }
  260. } else {
  261. //返回数据出错
  262. errordata();
  263. }
  264. },
  265. fail(error) {
  266. //未获取到token或者出错
  267. errordata();
  268. }
  269. });
  270. function errordata() {
  271. if (!uni.getStorageSync('idCard')) {
  272. t.$refs.popup1.open();
  273. // uni.showModal({
  274. // title: '提示',
  275. // content: '您还未绑定身份证!',
  276. // showCancel: false,
  277. // success: function(res3) {
  278. // if (res3.confirm) {
  279. // console.log('用户点击确定');
  280. // uni.navigateBack({
  281. // delta: 1 //返回层数,2则上上页
  282. // });
  283. // }
  284. // }
  285. // });
  286. // return;
  287. uni.hideLoading();
  288. } else {
  289. t.getuserinfo(uni.getStorageSync('idCard'));
  290. }
  291. }
  292. },
  293. //龙游
  294. longyou() {
  295. let t = this;
  296. // s({
  297. // userId: '1232131',
  298. // idCard: '330122195011081823'
  299. // })
  300. // async function s(res) {
  301. // if (!res.userId) {
  302. // uni.showModal({
  303. // title: '提示',
  304. // content: '您还未登录请先去登录!',
  305. // showCancel: false,
  306. // success: function(res2) {
  307. // if (res2.confirm) {
  308. // console.log('用户点击确定');
  309. // uni.navigateBack({
  310. // delta: 1 //返回层数,2则上上页
  311. // });
  312. // }
  313. // }
  314. // });
  315. // return;
  316. // }
  317. // t.valueId = res.idCard;
  318. // t.search()
  319. // uni.hideLoading();
  320. // }
  321. // return
  322. try {
  323. window.yt.getUserInfo({
  324. async success(res) {
  325. if (!res.userId) {
  326. uni.showModal({
  327. title: '提示',
  328. content: '您还未登录请先去登录!',
  329. showCancel: false,
  330. success: function(res2) {
  331. if (res2.confirm) {
  332. console.log('用户点击确定');
  333. uni.navigateBack({
  334. delta: 1 //返回层数,2则上上页
  335. });
  336. }
  337. }
  338. });
  339. return;
  340. }
  341. t.valueId = res.idCard;
  342. t.search()
  343. uni.hideLoading();
  344. },
  345. error() {
  346. errordata();
  347. }
  348. });
  349. } catch (e) {
  350. // console.log(e)
  351. uni.showModal({
  352. title: '提示',
  353. content: '环境异常',
  354. showCancel: false,
  355. success: function(res3) {
  356. if (res3.confirm) {
  357. console.log('用户点击确定');
  358. uni.navigateBack({
  359. delta: 1 //返回层数,2则上上页
  360. });
  361. }
  362. }
  363. });
  364. }
  365. function errordata() {
  366. if (!uni.getStorageSync('idCard')) {
  367. t.$refs.popup1.open();
  368. uni.hideLoading();
  369. } else {
  370. t.getuserinfo(uni.getStorageSync('idCard'));
  371. }
  372. }
  373. },
  374. decrypt() {
  375. //token解码
  376. uni.showLoading({
  377. title: '加载中'
  378. });
  379. let t = this;
  380. let timer = setInterval(() => {
  381. //等待获取ip
  382. if (globalData.configData.prodIp) {
  383. t.prodIp = globalData.configData.prodIp;
  384. clearInterval(timer);
  385. }
  386. ipArr.map(async item => {
  387. console.log(item.ip, globalData.configData.prodIp)
  388. if (item.ip == globalData.configData.prodIp && item.name == '龙游') {
  389. t.longyou();
  390. return;
  391. }
  392. if (item.ip == globalData.configData.prodIp && item.name == '兰溪') {
  393. t.lanxi();
  394. return;
  395. }
  396. if (item.ip == globalData.configData.prodIp && item.name == '附海') {
  397. t.other();
  398. return;
  399. }
  400. if (item.ip == globalData.configData.prodIp && item.name == '正式') {
  401. t.zhengshi();
  402. return;
  403. }
  404. if (item.ip == globalData.configData.prodIp && item.name == '测试') {
  405. t.zhengshi();
  406. return;
  407. }
  408. if (item.ip == globalData.configData.prodIp && item.name == '开发') {
  409. t.other();
  410. return;
  411. }
  412. });
  413. }, 300);
  414. },
  415. //切换
  416. operation() {
  417. uni.clearStorage('idCard');
  418. uni.clearStorage('userData');
  419. this.valueId = '';
  420. this.userData = {};
  421. this.physical = {};
  422. this.$refs.popup2.open();
  423. },
  424. bindPickerChange(e) {
  425. if (this.userArr[e] && this.userArr[e].text) {
  426. this.getuserinfo(this.userArr[e].text);
  427. }
  428. },
  429. closet() {
  430. uni.clearStorage('idCard');
  431. uni.clearStorage('userData');
  432. this.valueId = '';
  433. this.userData = {};
  434. this.physical = {};
  435. this.$refs.popup1.open();
  436. },
  437. search() {
  438. if (!this.$mf.isCardID(this.valueId)) {
  439. uni.showToast({
  440. title: '请输入正确的身份证号',
  441. icon: 'error',
  442. duration: 2000,
  443. mask: true
  444. });
  445. return;
  446. }
  447. this.userData = {};
  448. this.physical = {};
  449. this.getuserinfo(this.valueId);
  450. },
  451. async find_physical() {
  452. uni.showLoading({
  453. title: '加载中'
  454. });
  455. let idCard = uni.getStorageSync('idCard');
  456. let {
  457. data,
  458. code
  459. } = await this.$api.find_physical({
  460. idCard
  461. });
  462. if (code == 0) {
  463. this.physical = data || {};
  464. uni.hideLoading();
  465. } else {
  466. uni.hideLoading();
  467. }
  468. uni.stopPullDownRefresh();
  469. },
  470. async getuserinfo(idCard) {
  471. //330222194512283184
  472. idCard = idCard || uni.getStorageSync('idCard');
  473. uni.showLoading({
  474. title: '加载中'
  475. });
  476. let {
  477. data,
  478. code
  479. } = await this.$api.getUserInfo({
  480. idCard
  481. });
  482. if (code == 0) {
  483. this.valueId = '';
  484. uni.setStorageSync('userData', data || {});
  485. uni.setStorageSync('idCard', (data && data.idCard) || '');
  486. this.userData = data || {};
  487. if (data && data.id) {
  488. this.find_physical();
  489. this.$refs.popup1.close();
  490. this.$refs.popup2.close();
  491. } else {
  492. uni.showToast({
  493. title: '未查询到患者',
  494. icon: 'error'
  495. });
  496. }
  497. uni.hideLoading();
  498. uni.stopPullDownRefresh();
  499. } else {
  500. this.valueId = '';
  501. uni.hideLoading();
  502. uni.stopPullDownRefresh();
  503. }
  504. }
  505. },
  506. onPullDownRefresh() {
  507. if (this.userData && this.physical) {
  508. if (uni.getStorageSync('idCard')) {
  509. this.find_physical();
  510. } else {
  511. uni.stopPullDownRefresh();
  512. }
  513. } else {
  514. uni.stopPullDownRefresh();
  515. }
  516. }
  517. };
  518. </script>
  519. <style lang="scss">
  520. page {
  521. background: #f5f9ff;
  522. }
  523. .header {
  524. background: linear-gradient(180deg, #096dcb 0%, #6faae1 100%);
  525. }
  526. .userhead {
  527. border-radius: 50%;
  528. box-shadow: 1px 1px 10px 1px #096dcb;
  529. }
  530. .text-gry80 {
  531. color: #808080;
  532. }
  533. .box-border08 {
  534. border-radius: 16rpx;
  535. }
  536. </style>