index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  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="center" :mask-click="false" class="w-100">
  119. <view class="bg-white p-3 w-100" style="border-radius: 16rpx;">
  120. <view class="text-center mb-3 fs-14 font-bold py-2">
  121. 查询
  122. </view>
  123. <view class=" centerY mb-3 w-100 border-box" style="overflow: hidden; ">
  124. <input type="text" v-model="valueId" class="px-2 py-2 fs-12 w-70"
  125. style="border: 2px solid #007aff;border-top-left-radius: 2rpx;border-bottom-left-radius: 2rpx;"
  126. placeholder="请输入身份证号码" placeholder-class="fs-12" />
  127. <uni-button type="primary" class="my-button fs-12 px-2 ml-auto border-box w-30"
  128. style="padding: 0x ;border: 1px solid #007aff;border-top-right-radius: 12rpx;border-bottom-right-radius: 12rpx;"
  129. @click="search">搜索
  130. </uni-button>
  131. </view>
  132. </view>
  133. </uni-popup>
  134. <uni-popup ref="popup2" type="center" :mask-click="false" class="w-100">
  135. <view class="bg-white p-3 w-80 text-center" style="border-radius: 16rpx;min-width: 400rpx;">
  136. <view class="text-center mb-3 fs-14 font-bold py-2">
  137. 患者列表
  138. </view>
  139. <view class="text-left centerY mb-3" style="border-radius: 14rpx;border: 2px solid #007aff;">
  140. <uni-data-select v-model="userIndex" :localdata="userArr" @change="bindPickerChange"
  141. placeholder="请选择身份">
  142. </uni-data-select>
  143. </view>
  144. </view>
  145. </uni-popup>
  146. </view>
  147. </view>
  148. </template>
  149. <script>
  150. const ipArr = [{
  151. name: '开发',
  152. ip: 'http://192.168.1.103:10066'
  153. },
  154. {
  155. name: '测试',
  156. ip: 'http://testapi.xklr.net:8601'
  157. },
  158. {
  159. name: '正式',
  160. ip: 'http://apiv3.xklr.net'
  161. },
  162. {
  163. name: '兰溪',
  164. ip: 'http://10.50.13.200:10066'
  165. }
  166. ]
  167. let globalData = getApp().globalData
  168. export default {
  169. data() {
  170. return {
  171. userData: {},
  172. physical: {},
  173. valueId: '',
  174. prodIp: '',
  175. ipArr,
  176. userArr: [],
  177. userIndex: null,
  178. }
  179. },
  180. onLoad() {
  181. this.decrypt()
  182. },
  183. methods: {
  184. //切换
  185. operation() {
  186. uni.clearStorage('idCard')
  187. uni.clearStorage('userData')
  188. this.valueId = '';
  189. this.userData = {};
  190. this.physical = {};
  191. this.$refs.popup2.open()
  192. },
  193. bindPickerChange(e) {
  194. if (this.userArr[e] && this.userArr[e].text) {
  195. this.getuserinfo(this.userArr[e].text)
  196. }
  197. },
  198. decrypt() {
  199. uni.showLoading({
  200. title: '加载中'
  201. })
  202. let t = this;
  203. uni.getStorage({
  204. key: 'token',
  205. success(res) {
  206. console.log(res)
  207. if (res.data !== '') {
  208. ipArr.map((item) => {
  209. console.log(globalData.configData.prodIp)
  210. let timer = setInterval(async () => {
  211. if (globalData.configData.prodIp) {
  212. t.prodIp = globalData.configData.prodIp
  213. clearInterval(timer)
  214. }
  215. if (item.ip == globalData.configData.prodIp) {
  216. //兰溪
  217. if (item.name == '兰溪') {
  218. if (!res.data.length > 10) return
  219. console.log(res)
  220. let res2 = await t.$api.decrypt({
  221. toKen: res.data
  222. });
  223. if (res2.code !== -1) {
  224. if (res2.data.users && res2.data.users.length >
  225. 0) {
  226. t.$refs.popup2.open()
  227. t.userArr = []
  228. res2.data.users.map((item, index) => {
  229. t.userArr.push({
  230. value: index,
  231. text: item.idcard
  232. })
  233. })
  234. console.log(t.userArr)
  235. uni.hideLoading()
  236. }
  237. } else {
  238. console.log(1)
  239. if (!uni.getStorageSync('idCard')) {
  240. t.$refs.popup1.open()
  241. uni.hideLoading()
  242. } else {
  243. t.getuserinfo(uni.getStorageSync('idCard'))
  244. }
  245. }
  246. }
  247. } else {
  248. if (!uni.getStorageSync('idCard')) {
  249. t.$refs.popup1.open()
  250. uni.hideLoading()
  251. } else {
  252. t.getuserinfo(uni.getStorageSync('idCard'))
  253. }
  254. }
  255. }, 300)
  256. })
  257. } else {
  258. let timer = setInterval(async () => {
  259. if (globalData.configData.prodIp) {
  260. t.prodIp = globalData.configData.prodIp
  261. clearInterval(timer)
  262. }
  263. let i = ipArr.find((item) => item.ip == globalData.configData.prodIp)
  264. .name == '兰溪'
  265. if (!i) {
  266. if (!uni.getStorageSync('idCard')) {
  267. t.$refs.popup1.open()
  268. uni.hideLoading()
  269. } else {
  270. t.getuserinfo(uni.getStorageSync('idCard'))
  271. }
  272. }
  273. }, 300)
  274. }
  275. },
  276. fail(res) {
  277. console.log(res)
  278. let timer = setInterval(async () => {
  279. if (globalData.configData.prodIp) {
  280. t.prodIp = globalData.configData.prodIp
  281. clearInterval(timer)
  282. }
  283. let i = ipArr.find((item) => item.ip == globalData.configData.prodIp)
  284. .name == '兰溪'
  285. if (!i) {
  286. if (!uni.getStorageSync('idCard')) {
  287. t.$refs.popup1.open()
  288. uni.hideLoading()
  289. } else {
  290. t.getuserinfo(uni.getStorageSync('idCard'))
  291. }
  292. }
  293. }, 300)
  294. }
  295. })
  296. },
  297. closet() {
  298. uni.clearStorage('idCard')
  299. uni.clearStorage('userData')
  300. this.valueId = '';
  301. this.userData = {};
  302. this.physical = {};
  303. this.$refs.popup1.open()
  304. },
  305. search() {
  306. this.getuserinfo(this.valueId)
  307. this.valueId = '';
  308. this.userData = {};
  309. this.physical = {};
  310. },
  311. async find_physical() {
  312. uni.showLoading({
  313. title: '加载中'
  314. });
  315. let idCard = uni.getStorageSync('idCard')
  316. let {
  317. data,
  318. code
  319. } = await this.$api.find_physical({
  320. idCard
  321. })
  322. if (code == 0) {
  323. this.physical = data || {}
  324. uni.hideLoading();
  325. } else {
  326. uni.hideLoading();
  327. }
  328. uni.stopPullDownRefresh()
  329. },
  330. async getuserinfo(idCard) { //330222194512283184
  331. uni.showLoading({
  332. title: '加载中'
  333. });
  334. let {
  335. data,
  336. code
  337. } = await this.$api.getUserInfo({
  338. idCard
  339. })
  340. if (code == 0) {
  341. uni.setStorageSync('userData', data || {});
  342. uni.setStorageSync('idCard', data && data.idCard || '')
  343. this.userData = data || {}
  344. if (data && data.id) {
  345. this.$refs.popup1.close();
  346. this.find_physical()
  347. this.$refs.popup2.close();
  348. } else {
  349. uni.showToast({
  350. title: '未查询到患者',
  351. icon: 'error'
  352. })
  353. }
  354. uni.hideLoading();
  355. } else {
  356. uni.hideLoading();
  357. uni.stopPullDownRefresh()
  358. }
  359. }
  360. },
  361. onPullDownRefresh() {
  362. this.getuserinfo()
  363. }
  364. }
  365. </script>
  366. <style lang="scss">
  367. page {
  368. background: #F5F9FF;
  369. }
  370. .header {
  371. background: linear-gradient(180deg, #096DCB 0%, #6faae1 100%)
  372. }
  373. .userhead {
  374. border-radius: 50%;
  375. box-shadow: 1px 1px 10px 1px #096DCB;
  376. }
  377. .text-gry80 {
  378. color: #808080;
  379. }
  380. .box-border08 {
  381. border-radius: 16rpx;
  382. }
  383. </style>