index.vue 12 KB

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