index.vue 13 KB

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