index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  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. console.log(1)
  360. uni.showModal({
  361. title: '提示',
  362. content: '您还未登录请先去登录!',
  363. showCancel: false,
  364. success: function(res3) {
  365. if (res3.confirm) {
  366. console.log('用户点击确定');
  367. uni.navigateBack({
  368. delta: 1 //返回层数,2则上上页
  369. });
  370. }
  371. }
  372. });
  373. }
  374. },
  375. decrypt() {
  376. //token解码
  377. uni.showLoading({
  378. title: '加载中'
  379. });
  380. let t = this;
  381. let timer = setInterval(() => {
  382. //等待获取ip
  383. if (globalData.configData.prodIp) {
  384. t.prodIp = globalData.configData.prodIp;
  385. clearInterval(timer);
  386. }
  387. ipArr.map(async item => {
  388. // console.log(item.ip, globalData.configData.prodIp)
  389. if (item.ip == globalData.configData.prodIp && item.name == '龙游') {
  390. t.longyou();
  391. return;
  392. }
  393. if (item.ip == globalData.configData.prodIp && item.name == '兰溪') {
  394. t.lanxi();
  395. return;
  396. }
  397. if (item.ip == globalData.configData.prodIp && item.name == '附海') {
  398. t.other();
  399. return;
  400. }
  401. if (item.ip == globalData.configData.prodIp && item.name == '正式') {
  402. t.zhengshi();
  403. return;
  404. }
  405. if (item.ip == globalData.configData.prodIp && item.name == '测试') {
  406. t.zhengshi();
  407. return;
  408. }
  409. if (item.ip == globalData.configData.prodIp && item.name == '开发') {
  410. t.other();
  411. return;
  412. }
  413. });
  414. }, 300);
  415. },
  416. //切换
  417. operation() {
  418. uni.clearStorage('idCard');
  419. uni.clearStorage('userData');
  420. this.valueId = '';
  421. this.userData = {};
  422. this.physical = {};
  423. this.$refs.popup2.open();
  424. },
  425. bindPickerChange(e) {
  426. if (this.userArr[e] && this.userArr[e].text) {
  427. this.getuserinfo(this.userArr[e].text);
  428. }
  429. },
  430. closet() {
  431. uni.clearStorage('idCard');
  432. uni.clearStorage('userData');
  433. this.valueId = '';
  434. this.userData = {};
  435. this.physical = {};
  436. this.$refs.popup1.open();
  437. },
  438. search() {
  439. if (!this.$mf.isCardID(this.valueId)) {
  440. uni.showToast({
  441. title: '请输入正确的身份证号',
  442. icon: 'error',
  443. duration: 2000,
  444. mask: true
  445. });
  446. return;
  447. }
  448. this.userData = {};
  449. this.physical = {};
  450. this.getuserinfo(this.valueId);
  451. },
  452. async find_physical() {
  453. uni.showLoading({
  454. title: '加载中'
  455. });
  456. let idCard = uni.getStorageSync('idCard');
  457. let {
  458. data,
  459. code
  460. } = await this.$api.find_physical({
  461. idCard
  462. });
  463. if (code == 0) {
  464. this.physical = data || {};
  465. uni.hideLoading();
  466. } else {
  467. uni.hideLoading();
  468. }
  469. uni.stopPullDownRefresh();
  470. },
  471. async getuserinfo(idCard) {
  472. //330222194512283184
  473. idCard = idCard || uni.getStorageSync('idCard');
  474. uni.showLoading({
  475. title: '加载中'
  476. });
  477. let {
  478. data,
  479. code
  480. } = await this.$api.getUserInfo({
  481. idCard
  482. });
  483. if (code == 0) {
  484. this.valueId = '';
  485. uni.setStorageSync('userData', data || {});
  486. uni.setStorageSync('idCard', (data && data.idCard) || '');
  487. this.userData = data || {};
  488. if (data && data.id) {
  489. this.find_physical();
  490. this.$refs.popup1.close();
  491. this.$refs.popup2.close();
  492. } else {
  493. ipArr.map(async item => {
  494. // console.log(item.ip, globalData.configData.prodIp)
  495. if (item.ip == globalData.configData.prodIp && item.name == '龙游') {
  496. uni.showModal({
  497. title: '提示',
  498. content: '患者不在慢病系统中!',
  499. showCancel: false,
  500. success: function(res3) {
  501. if (res3.confirm) {
  502. console.log('用户点击确定');
  503. uni.navigateBack({
  504. delta: 1 //返回层数,2则上上页
  505. });
  506. }
  507. }
  508. });
  509. }else{
  510. uni.showToast({
  511. title: '未查询到患者',
  512. icon: 'error'
  513. });
  514. }
  515. });
  516. }
  517. uni.hideLoading();
  518. uni.stopPullDownRefresh();
  519. } else {
  520. this.valueId = '';
  521. uni.hideLoading();
  522. uni.stopPullDownRefresh();
  523. }
  524. }
  525. },
  526. onPullDownRefresh() {
  527. if (this.userData && this.physical) {
  528. if (uni.getStorageSync('idCard')) {
  529. this.find_physical();
  530. } else {
  531. uni.stopPullDownRefresh();
  532. }
  533. } else {
  534. uni.stopPullDownRefresh();
  535. }
  536. }
  537. };
  538. </script>
  539. <style lang="scss">
  540. page {
  541. background: #f5f9ff;
  542. }
  543. .header {
  544. background: linear-gradient(180deg, #096dcb 0%, #6faae1 100%);
  545. }
  546. .userhead {
  547. border-radius: 50%;
  548. box-shadow: 1px 1px 10px 1px #096dcb;
  549. }
  550. .text-gry80 {
  551. color: #808080;
  552. }
  553. .box-border08 {
  554. border-radius: 16rpx;
  555. }
  556. </style>