index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  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
  13. v-if="ipArr.find(item => item.ip == prodIp) && (ipArr.find(item => item.ip == prodIp).name == '兰溪')"
  14. class="d-inline-block py-1 d-inline-block ml-auto text-white1" @click="operation">
  15. [ 切换 ]
  16. </span>
  17. </view>
  18. <view class="centerY mt-2" @click="$mf.clickNavto('/pages/userinfo/userinfo')">
  19. <view class="w-15 userhead">
  20. <view class="picbox">
  21. <image v-if="userData.sex == 1" src="@/static/img/defult/head1.png" mode="widthFix"
  22. class="picimg">
  23. </image>
  24. <image v-if="userData.sex == 2" src="@/static/img/defult/head2.png" mode="widthFix"
  25. class="picimg">
  26. </image>
  27. </view>
  28. </view>
  29. <view class="w-85 ml-3">
  30. <view class="text-white fs-16 font-bold">{{ userData.username || '' }}</view>
  31. <view class="centerY" style="margin-top:10rpx;">
  32. <view
  33. :class="{ 'iconfont text-white fs-16 font-bold': true, ' nv': userData.sex == 2, nanxing: userData.sex == 1 }">
  34. </view>
  35. <view class="py-1 pl-2 text-center centerY text-gry80 bg-white ml-auto"
  36. style="border-radius: 6rpx;">
  37. <view class="">基础资料</view>
  38. <view class="iconfont youla2 fs-12 font-bold"></view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="content p-3 bg-white mx-3 my-3 box-border08">
  45. <view class="" style="display:flex;flex-wrap: wrap !important;">
  46. <view class="w-100 border-box">
  47. <view class=""
  48. style="background: linear-gradient(180deg, rgb(151,220,249) 0%, rgb(110,197,246) 100%);border-radius: 16rpx;">
  49. <view class="px-3 pt-2 pb-3 ">
  50. <view class="centerY ">
  51. <view class="bule_line"></view>
  52. <text class="fs-18 ml-2 font-bold" style="color: #1C90D7;">个人体征</text>
  53. </view>
  54. <view class="mt-2" style="color: #000;">
  55. <view class="font-bold" style="display:flex;flex-wrap: wrap !important;">
  56. <view class="w-50 border-box pr-1">
  57. <view class=" d-flex px-2 py-1"
  58. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  59. 身高
  60. <span class="ml-auto ml-1">{{ physical.height || '-' }} cm</span>
  61. </view>
  62. </view>
  63. <view class="w-50 border-box pl-1">
  64. <view class=" d-flex px-2 py-1"
  65. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  66. 体重
  67. <span class="ml-auto ml-1">{{ physical.weight || '-' }} kg</span>
  68. </view>
  69. </view>
  70. <view class="w-50 border-box pr-1 mt-2">
  71. <view class=" d-flex px-2 py-1"
  72. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  73. BMI
  74. <span class="ml-auto ml-1">{{ physical.bmi || '-' }} kg/m^2</span>
  75. </view>
  76. </view>
  77. <view class="w-50 border-box pl-1 mt-2">
  78. <view class=" d-flex px-2 py-1"
  79. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  80. 血压
  81. <span
  82. class="ml-auto ml-1">{{ physical.diastole || '-' }}/{{ physical.shrink || '-' }}
  83. mmHg</span>
  84. </view>
  85. </view>
  86. <view class="w-50 border-box pr-1 mt-2">
  87. <view class=" d-flex px-2 py-1"
  88. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  89. 心率
  90. <span class="ml-auto ml-1">{{ physical.pulse || '-' }} bmp</span>
  91. </view>
  92. </view>
  93. <view class="w-50 border-box pl-1 mt-2">
  94. <view class=" d-flex px-2 py-1"
  95. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  96. 腰围
  97. <span class="ml-auto ml-1">{{ physical.waist || '-' }} cm</span>
  98. </view>
  99. </view>
  100. <view class="w-50 border-box pr-1 mt-2">
  101. <view class=" d-flex px-2 py-1"
  102. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  103. 血糖
  104. <span class="ml-auto ml-1">{{ physical.bloodGlucose || '-' }}
  105. mmol/L</span>
  106. </view>
  107. </view>
  108. <view class="w-50 border-box pl-1 mt-2">
  109. <view class=" d-flex px-2 py-1"
  110. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  111. 血氧
  112. <span class="ml-auto ml-1">{{ physical.spo2 || '-' }} mmHg</span>
  113. </view>
  114. </view>
  115. </view>
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. <view class="w-50 pr-2 border-box mt-3">
  121. <image @click="$mf.clickNavto('/pages/medication/medication')" src="@/static/img/index/dqyy.png"
  122. mode="widthFix" class="w-100"></image>
  123. </view>
  124. <view class="w-50 pl-2 border-box mt-3">
  125. <image @click="$mf.clickNavto('/pages/health_report/health_report')"
  126. src="@/static/img/index/jkbg.png" mode="widthFix" class="w-100"></image>
  127. </view>
  128. </view>
  129. <view class="mt-2">
  130. <image @click="$mf.clickNavto('/pages/eye_ground/eye_ground')" src="@/static/img/index/ydjc.png"
  131. mode="widthFix" class="w-100"></image>
  132. </view>
  133. <view class="mt-2">
  134. <image @click="$mf.clickNavto('/pages/home_monitoring/home_monitoring')"
  135. src="@/static/img/index/jjjc.png" mode="widthFix" class="w-100"></image>
  136. </view>
  137. </view>
  138. </view>
  139. <view class="">
  140. <uni-popup ref="popup1" type="top" :mask-click="false">
  141. <view class=" w-80 mx-auto" style="margin-top: 30vh;">
  142. <view class="bg-white p-3 w-100 border-box" style="border-radius: 16rpx;">
  143. <view class="text-center mb-3 fs-14 font-bold py-2">查询</view>
  144. <view class=" centerY mb-3 w-100 border-box" style="overflow: hidden; ">
  145. <input type="text" v-model="valueId" class="px-2 m-0 fs-12 w-75 border-box"
  146. style="height: 70rpx;border: 2px solid #007aff;border-top-left-radius: 4rpx;border-bottom-left-radius: 4rpx;"
  147. placeholder="请输入身份证号码" placeholder-class="fs-12" />
  148. <uni-button type="primary" class="my-button fs-12 ml-auto border-box w-25"
  149. style="height: 70rpx;line-height: 70rpx; padding: 0 ;border-top-right-radius: 12rpx;border-bottom-right-radius: 12rpx;"
  150. @click="search">
  151. 搜索
  152. </uni-button>
  153. </view>
  154. </view>
  155. </view>
  156. </uni-popup>
  157. <uni-popup ref="popup2" type="top" :mask-click="false">
  158. <view class=" w-80 mx-auto" style="margin-top: 30vh;">
  159. <view class="bg-white p-3 w-100 text-center border-box" style="border-radius: 16rpx;">
  160. <view class="text-center mb-3 fs-14 font-bold py-2">患者列表</view>
  161. <view class="text-left centerY mb-3" style="border-radius: 14rpx;border: 2px solid #007aff;">
  162. <uni-data-select v-model="userIndex" :localdata="userArr" @change="bindPickerChange"
  163. placeholder="请选择身份"></uni-data-select>
  164. </view>
  165. <view class="" v-if="userArr.length == 0">
  166. <empty title="还未绑定患者" />
  167. </view>
  168. </view>
  169. </view>
  170. </uni-popup>
  171. </view>
  172. </view>
  173. </template>
  174. <script>
  175. import ipArr from '@/config/servernet.config.js'
  176. let globalData = getApp().globalData;
  177. import Empty from '@/component/empty/empty.vue';
  178. export default {
  179. components: {
  180. Empty
  181. },
  182. data() {
  183. return {
  184. userData: {},
  185. physical: {},
  186. valueId: '',
  187. prodIp: '',
  188. ipArr,
  189. userArr: [],
  190. userIndex: null
  191. };
  192. },
  193. onLoad() {
  194. this.decrypt();
  195. },
  196. methods: {
  197. //正式
  198. async other() {
  199. let t = this;
  200. if (!uni.getStorageSync('idCard')) {
  201. t.$refs.popup1.open();
  202. uni.hideLoading();
  203. } else {
  204. t.getuserinfo(uni.getStorageSync('idCard'));
  205. }
  206. },
  207. //正式
  208. async zhengshi() {
  209. let t = this;
  210. if (!uni.getStorageSync('idCard')) {
  211. t.$refs.popup1.open();
  212. uni.hideLoading();
  213. } else {
  214. t.getuserinfo(uni.getStorageSync('idCard'));
  215. }
  216. },
  217. //兰溪
  218. lanxi() {
  219. let t = this;
  220. uni.getStorage({
  221. key: 'token',
  222. async success(res) {
  223. if (!res.data) return;
  224. let res2 = await t.$api.decrypt({
  225. toKen: res.data
  226. });
  227. if (res2.code !== -1) {
  228. if (!res2.data.uuid) {
  229. uni.showModal({
  230. title: '提示',
  231. content: '您还未登录请先去登录!',
  232. showCancel: false,
  233. success: function(res3) {
  234. if (res3.confirm) {
  235. console.log('用户点击确定');
  236. uni.navigateBack({
  237. delta: 1 //返回层数,2则上上页
  238. });
  239. }
  240. }
  241. });
  242. return;
  243. }
  244. if (res2.data.users && res2.data.users.length > 0) {
  245. t.$refs.popup2.open();
  246. t.userArr = [];
  247. res2.data.users.map((item, index) => {
  248. t.userArr.push({
  249. value: index,
  250. text: item.idcard
  251. });
  252. });
  253. uni.hideLoading();
  254. } else {
  255. t.$refs.popup2.open();
  256. t.userArr = [];
  257. res2.data.users.map((item, index) => {
  258. t.userArr.push({
  259. value: index,
  260. text: item.idcard
  261. });
  262. });
  263. uni.hideLoading();
  264. }
  265. } else {
  266. //返回数据出错
  267. errordata();
  268. }
  269. },
  270. fail(error) {
  271. //未获取到token或者出错
  272. errordata();
  273. }
  274. });
  275. function errordata() {
  276. if (!uni.getStorageSync('idCard')) {
  277. t.$refs.popup1.open();
  278. // uni.showModal({
  279. // title: '提示',
  280. // content: '您还未绑定身份证!',
  281. // showCancel: false,
  282. // success: function(res3) {
  283. // if (res3.confirm) {
  284. // console.log('用户点击确定');
  285. // uni.navigateBack({
  286. // delta: 1 //返回层数,2则上上页
  287. // });
  288. // }
  289. // }
  290. // });
  291. // return;
  292. uni.hideLoading();
  293. } else {
  294. t.getuserinfo(uni.getStorageSync('idCard'));
  295. }
  296. }
  297. },
  298. //龙游
  299. longyou() {
  300. let t = this;
  301. uni.getStorage({
  302. key: 'serialNumber',
  303. async success(d) {
  304. console.log(d)
  305. if (!d.data) return;
  306. fetch('http://220.191.237.238:8085/ehr/authentication', {
  307. method: 'POST',
  308. headers: {
  309. "Content-Type": "application/json;charset=UTF-8"
  310. },
  311. body: JSON.stringify({
  312. serialNumber: d.data
  313. })
  314. }).then(res => {
  315. return res.json(res);
  316. }).then(res => {
  317. console.log(res); // 这里是获取到的数据
  318. // t.getuserinfo('342201199608189314')
  319. // return false
  320. if (res.status == 1) {
  321. t.getuserinfo(res.data.idCard)
  322. } else if (res.status == 50000) {
  323. uni.showModal({
  324. title: '提示',
  325. content: '未登录返回登录',
  326. showCancel: false,
  327. success: function(res3) {
  328. if (res3.confirm) {
  329. console.log('用户点击确定');
  330. uni.navigateBack({
  331. delta: 1 //返回层数,2则上上页
  332. });
  333. }
  334. }
  335. });
  336. } else {
  337. uni.showModal({
  338. title: '提示',
  339. content: res.msg,
  340. showCancel: false,
  341. success: function(res3) {
  342. if (res3.confirm) {
  343. console.log('用户点击确定');
  344. uni.navigateBack({
  345. delta: 1 //返回层数,2则上上页
  346. });
  347. }
  348. }
  349. });
  350. }
  351. })
  352. },
  353. fail(error) {
  354. //未获取到token或者出错
  355. errordata();
  356. }
  357. });
  358. function errordata() {
  359. uni.showModal({
  360. title: '提示',
  361. content: '您还未登录请先去登录!',
  362. showCancel: false,
  363. success: function(res3) {
  364. if (res3.confirm) {
  365. console.log('用户点击确定');
  366. uni.navigateBack({
  367. delta: 1 //返回层数,2则上上页
  368. });
  369. }
  370. }
  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. ipArr.map(async item => {
  493. // console.log(item.ip, globalData.configData.prodIp)
  494. if (item.ip == globalData.configData.prodIp && item.name == '龙游') {
  495. uni.showModal({
  496. title: '提示',
  497. content: '患者不在慢病系统中!',
  498. showCancel: false,
  499. success: function(res3) {
  500. if (res3.confirm) {
  501. console.log('用户点击确定');
  502. uni.navigateBack({
  503. delta: 1 //返回层数,2则上上页
  504. });
  505. }
  506. }
  507. });
  508. }else{
  509. uni.showToast({
  510. title: '未查询到患者',
  511. icon: 'error'
  512. });
  513. }
  514. });
  515. }
  516. uni.hideLoading();
  517. uni.stopPullDownRefresh();
  518. } else {
  519. this.valueId = '';
  520. uni.hideLoading();
  521. uni.stopPullDownRefresh();
  522. }
  523. }
  524. },
  525. onPullDownRefresh() {
  526. if (this.userData && this.physical) {
  527. if (uni.getStorageSync('idCard')) {
  528. this.find_physical();
  529. } else {
  530. uni.stopPullDownRefresh();
  531. }
  532. } else {
  533. uni.stopPullDownRefresh();
  534. }
  535. }
  536. };
  537. </script>
  538. <style lang="scss">
  539. page {
  540. background: #f5f9ff;
  541. }
  542. .header {
  543. background: linear-gradient(180deg, #096dcb 0%, #6faae1 100%);
  544. }
  545. .userhead {
  546. border-radius: 50%;
  547. box-shadow: 1px 1px 10px 1px #096dcb;
  548. }
  549. .text-gry80 {
  550. color: #808080;
  551. }
  552. .box-border08 {
  553. border-radius: 16rpx;
  554. }
  555. </style>