healthBodyRecord.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>记录详情</title>
  7. <link rel="stylesheet" type="text/css" href="../../../css/bootstrap.min.css" />
  8. <link rel="stylesheet" type="text/css" href="../../../css/style.min.css" />
  9. <link rel="stylesheet" type="text/css" href="../../../css/cross.css" />
  10. <link rel="stylesheet" href="../../../plugins/toastr/toastr.min.css" />
  11. <link rel="stylesheet" href="../../../plugins/element-ui/element-ui.css" />
  12. <link rel="stylesheet" type="text/css" href="../css/date.css" />
  13. <link rel="stylesheet" href="../css/common.css" />
  14. <style>
  15. #app {
  16. font-size: 14px;
  17. }
  18. .box {
  19. height: 640px;
  20. overflow: auto;
  21. padding: 8px 16px;
  22. box-sizing: border-box;
  23. }
  24. .item {
  25. display: flex;
  26. align-items: center;
  27. justify-content: space-between;
  28. padding: 8px 0;
  29. border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  30. }
  31. .lheight2 {
  32. line-height: 2;
  33. }
  34. .flex {
  35. display: flex;
  36. align-items: center;
  37. }
  38. .pl8 {
  39. padding-left: 8px;
  40. }
  41. </style>
  42. </head>
  43. <body>
  44. <div id="app" v-cloak>
  45. <div class="box" v-if="key==0">
  46. <!-- 血压 -->
  47. <div class="item" v-for="(item,i) in bloodPressureList" :key="i">
  48. <div>
  49. <div class="lheight2">
  50. 收缩压:{{item.value1}}
  51. <span class="pl8">
  52. 舒张压:{{item.value2}}
  53. <span class="pl8">脉搏:{{item.value3}} 次/分</span>
  54. </span>
  55. </div>
  56. <div class="lheight2">{{formatDate(item.date)}} {{item.recordMethod}}</div>
  57. </div>
  58. <el-tag :type="item.tagType" effect="dark">{{item.tagName}}</el-tag>
  59. </div>
  60. </div>
  61. <div class="box" v-else-if="key==1">
  62. <!-- 血糖 -->
  63. <div class="item" v-for="(item,i) in bloodSugarList" :key="i">
  64. <div>
  65. <div class="lheight2">{{item.text}}</div>
  66. <div class="lheight2">{{formatDate(item.time)}} {{item.recordMethod}}</div>
  67. </div>
  68. <div class="flex">
  69. <el-tag :type="item.tagType" effect="dark">{{item.tagName}}</el-tag>
  70. <div class="pl8" style="width: 50px; text-align: right">{{item.value}}</div>
  71. </div>
  72. </div>
  73. </div>
  74. <div class="box" v-else-if="key==2">
  75. <!-- 身高体重 -->
  76. <div class="item" v-for="(item,i) in heightWeightList" :key="i">
  77. <div>
  78. <div class="lheight2">
  79. 身高:{{item.value2}}cm
  80. <span class="pl8">体重:{{item.value1}}kg</span>
  81. </div>
  82. <div class="lheight2">{{formatDate(item.time)}} {{item.recordMethod}}</div>
  83. </div>
  84. <div class="flex">
  85. <el-tag :type="item.tagType" effect="dark">{{item.tagName}}</el-tag>
  86. </div>
  87. </div>
  88. </div>
  89. <div class="box" v-else-if="key == 3">
  90. <!-- 腰围 -->
  91. <div class="item" v-for="(item,i) in waistList" :key="i">
  92. <div>
  93. <div class="lheight2">{{item.value1}} cm</div>
  94. <div class="lheight2">{{formatDate(item.time)}} {{item.recordMethod}}</div>
  95. </div>
  96. </div>
  97. </div>
  98. <div class="box" v-else>
  99. <!-- 心率 -->
  100. <div class="item" v-for="(item,i) in heartRateList" :key="i">
  101. <div>
  102. <div class="lheight2">{{item.value1}} 次/分</div>
  103. <div class="lheight2">{{formatDate(item.time)}} {{item.recordMethod}}</div>
  104. </div>
  105. <el-tag :type="item.tagType" effect="dark">{{item.tagName}}</el-tag>
  106. </div>
  107. </div>
  108. </div>
  109. <script type="text/javascript" src="../../../js/vue.js"></script>
  110. <script type="text/javascript" src="../../../js/jquery-2.2.4.js"></script>
  111. <script type="text/javascript" src="../../../js/es6-promise.js" charset="utf-8"></script>
  112. <script type="text/javascript" src="../../../plugins/toastr/toastr.min.js"></script>
  113. <script type="text/javascript" src="../../../plugins/element-ui/element-ui.js"></script>
  114. <script type="text/javascript" src="../../../api/http-request.js"></script>
  115. <script type="text/javascript" src="../../../plugins/layer/layer.min.js"></script>
  116. <script type="text/javascript" src="../../../api/rehabilitation-api.js"></script>
  117. <script type="text/javascript" src="../../../api/recover_api.js"></script>
  118. <script type="text/javascript" src="../../../js/underscore-1.9.1.js"></script>
  119. <script type="text/javascript" src="../../../js/util.js" charset="utf-8"></script>
  120. <script>
  121. new Vue({
  122. el: '#app',
  123. data() {
  124. return {
  125. key: '',
  126. patient: '',
  127. endDate: '',
  128. pager: {
  129. num: 1,
  130. size: 15
  131. },
  132. bloodPressureList: [],
  133. bloodPressureDisabled: false,
  134. bloodSugarList: [],
  135. heightWeightList: [],
  136. waistList: [],
  137. heartRateList: []
  138. }
  139. },
  140. mounted() {
  141. this.key = GetRequest().key
  142. this.patient = GetRequest().patient
  143. this.endDate = GetRequest().time
  144. console.log(GetRequest())
  145. switch (this.key) {
  146. case '0':
  147. this.getBloodPressureList()
  148. break
  149. case '1':
  150. this.getBloodSugarList()
  151. break
  152. case '2':
  153. this.getHeightWeightList()
  154. break
  155. case '3':
  156. this.getWaistList()
  157. break
  158. case '4':
  159. this.getHeartRateList()
  160. break
  161. }
  162. },
  163. methods: {
  164. getRecordType(isDevice) {
  165. return isDevice === null ? '手动记录' : isDevice != null ? '设备上传' : ''
  166. },
  167. getLevelClazz(value, max, min) {
  168. if (!value || (!max && !min)) {
  169. return ''
  170. }
  171. var value = parseFloat(value)
  172. if (value < min) {
  173. return '-1'
  174. } else if (value > max) {
  175. return '1'
  176. } else {
  177. return ''
  178. }
  179. },
  180. getBloodPressureList() {
  181. const vm = this
  182. function getTagInfo(type, val1, val2) {
  183. switch (type) {
  184. case 'type':
  185. if (val1 > 0 || val2 > 0) {
  186. return 'danger'
  187. }
  188. if (val1 < 0 || val2 < 0) {
  189. return 'success'
  190. }
  191. return ''
  192. case 'name':
  193. if (val1 > 0 || val2 > 0) {
  194. return '偏高'
  195. }
  196. if (val1 < 0 || val2 < 0) {
  197. return '偏低'
  198. }
  199. return '正常'
  200. }
  201. }
  202. const params = {
  203. type: 2,
  204. page: 1,
  205. pagesize: 100,
  206. patient: this.patient,
  207. begin: this.getDateFromCurrentDate(this.endDate, -2000) + ' 00:00:00',
  208. end: this.endDate + ' 23:59:59'
  209. }
  210. httpRequest.post('doctor/health_index/list', { data: params }).then(function (res) {
  211. vm.bloodPressureList = res.list.data.map(function (item) {
  212. return {
  213. ...item,
  214. recordMethod: vm.getRecordType(item.deviceSn),
  215. tagType: getTagInfo('type', vm.getLevelClazz(item.value1, 139, 90), vm.getLevelClazz(item.value2, 89, 60)),
  216. tagName: getTagInfo('name', vm.getLevelClazz(item.value1, 139, 90), vm.getLevelClazz(item.value2, 89, 60))
  217. }
  218. })
  219. })
  220. },
  221. getBloodSugarList() {
  222. const vm = this
  223. function getText(dataType) {
  224. switch (dataType) {
  225. case '1':
  226. return '早餐前'
  227. case '2':
  228. return '早餐后'
  229. case '3':
  230. return '午餐前'
  231. case '4':
  232. return '午餐后'
  233. case '5':
  234. return '晚餐前'
  235. case '6':
  236. return '晚餐后'
  237. case '7':
  238. return '睡前'
  239. }
  240. }
  241. function getDevice(device) {
  242. return device == '' ? '手动记录' : '设备上传'
  243. }
  244. function getTagInfo(type, val, dataType) {
  245. var levels = [[], [7.0, 3.9], [11.1, 4.0], [7.0, 3.9], [11.1, 4.0], [7.0, 3.9], [11.1, 4.0], [7.0, 3.9]][dataType]
  246. switch (type) {
  247. case 'name':
  248. if (vm.getLevelClazz(val, levels[0], levels[1]) > 0) {
  249. return '偏高'
  250. } else if (vm.getLevelClazz(val, levels[0], levels[1]) < 0) {
  251. return '偏低'
  252. } else {
  253. return '正常'
  254. }
  255. case 'type':
  256. if (vm.getLevelClazz(val, levels[0], levels[1]) > 0) {
  257. return 'danger'
  258. } else if (vm.getLevelClazz(val, levels[0], levels[1]) < 0) {
  259. return 'success'
  260. } else {
  261. return ''
  262. }
  263. }
  264. }
  265. const params = {
  266. type: 1,
  267. page: 1,
  268. pagesize: 100,
  269. patient: this.patient,
  270. begin: this.getDateFromCurrentDate(this.endDate, -2000) + ' 00:00:00',
  271. end: this.endDate + ' 23:59:59'
  272. }
  273. vm.bloodSugarList = []
  274. httpRequest.post('doctor/health_index/list', { data: params }).then(function (res) {
  275. // vm.bloodSugarList = res.list.data.map(function (item) {
  276. // return {
  277. // ...item,
  278. // text: getText(item.dataType),
  279. // tagType: getTagInfo('type', item['value' + item.dataType], item.dataType),
  280. // tagName: getTagInfo('name', item['value' + item.dataType], item.dataType),
  281. // recordMethod: getDevice(item['deviceSn' + item.dataType]),
  282. // value: item['value' + item.dataType],
  283. // time: item['time' + item.dataType]
  284. // }
  285. // })
  286. res.list.data.forEach(function (item) {
  287. console.log(item)
  288. var arr = Object.keys(item)
  289. .filter(function (item1) {
  290. return item1.indexOf('deviceSn') > -1
  291. })
  292. .map(function (item1) {
  293. return item1.substring(8)
  294. })
  295. arr.forEach(function (item1) {
  296. var newObj = {
  297. text: getText(item1),
  298. tagType: getTagInfo('type', item['value' + item1], item1),
  299. tagName: getTagInfo('name', item['value' + item1], item1),
  300. recordMethod: getDevice(item['deviceSn' + item1]),
  301. value: item['value' + item1],
  302. time: item['time' + item1]
  303. }
  304. vm.bloodSugarList.push(newObj)
  305. })
  306. })
  307. })
  308. },
  309. getHeightWeightList() {
  310. const vm = this
  311. function getTixingInfo(type, val) {
  312. switch (type) {
  313. case 'name':
  314. if (val > 0) {
  315. return '偏瘦'
  316. } else if (val < 0) {
  317. return '偏胖'
  318. } else {
  319. return '正常'
  320. }
  321. case 'type':
  322. if (val > 0) {
  323. return 'success'
  324. } else if (val < 0) {
  325. return 'danger'
  326. } else {
  327. return ''
  328. }
  329. }
  330. }
  331. const params = {
  332. type: 3,
  333. page: 1,
  334. pagesize: 100,
  335. patient: this.patient,
  336. begin: this.getDateFromCurrentDate(this.endDate, -2000) + ' 00:00:00',
  337. end: this.endDate + ' 23:59:59'
  338. }
  339. httpRequest.post('doctor/health_index/list', { data: params }).then(function (res) {
  340. vm.heightWeightList = res.list.data.map(function (item) {
  341. return {
  342. ...item,
  343. tagName: getTixingInfo('name', item.value4 * 1),
  344. tagType: getTixingInfo('type', item.value4 * 1),
  345. recordMethod: item.deviceSn == '' ? '手动记录' : '设备上传',
  346. time: item.czrq.substring(0, 16)
  347. }
  348. })
  349. })
  350. },
  351. getWaistList() {
  352. const vm = this
  353. const params = {
  354. type: 4,
  355. page: 1,
  356. pagesize: 100,
  357. patient: this.patient,
  358. begin: this.getDateFromCurrentDate(this.endDate, -2000) + ' 00:00:00',
  359. end: this.endDate + ' 23:59:59'
  360. }
  361. httpRequest.post('doctor/health_index/list', { data: params }).then(function (res) {
  362. vm.waistList = res.list.data.map(function (item) {
  363. return {
  364. ...item,
  365. recordMethod: item.deviceSn == '' ? '手动记录' : '设备上传',
  366. time: item.czrq.substring(0, 16)
  367. }
  368. })
  369. })
  370. },
  371. getHeartRateList() {
  372. const vm = this
  373. function getRateInfo(type, val) {
  374. switch (type) {
  375. case 'name':
  376. if (val > 100) {
  377. return '过快'
  378. } else if (val < 60) {
  379. return '过缓'
  380. } else {
  381. return '正常'
  382. }
  383. case 'type':
  384. if (val > 100) {
  385. return 'danger'
  386. } else if (val < 60) {
  387. return 'success'
  388. } else {
  389. return ''
  390. }
  391. }
  392. }
  393. const params = {
  394. type: 5,
  395. page: 1,
  396. pagesize: 100,
  397. patient: this.patient,
  398. begin: this.getDateFromCurrentDate(this.endDate, -2000) + ' 00:00:00',
  399. end: this.endDate + ' 23:59:59'
  400. }
  401. httpRequest.post('doctor/health_index/list', { data: params }).then(function (res) {
  402. vm.heartRateList = res.list.data.map(function (item) {
  403. return {
  404. ...item,
  405. recordMethod: item.deviceSn == '' ? '手动记录' : '设备上传',
  406. tagName: getRateInfo('name', item.value1),
  407. tagType: getRateInfo('type', item.value1),
  408. time: item.czrq.substring(0, 16)
  409. }
  410. })
  411. })
  412. },
  413. getDateFromCurrentDate(fromDate, dayInterval) {
  414. var curDate = new Date(Date.parse(fromDate.replace(/-/g, '/')))
  415. curDate.setDate(curDate.getDate() + dayInterval)
  416. var year = curDate.getFullYear()
  417. var month = curDate.getMonth() + 1 < 10 ? '0' + (curDate.getMonth() + 1) : curDate.getMonth() + 1
  418. var day = curDate.getDate() < 10 ? '0' + curDate.getDate() : curDate.getDate()
  419. return year + '-' + month + '-' + day
  420. },
  421. formatDate(date){
  422. return date.substring(0,16)
  423. }
  424. }
  425. })
  426. </script>
  427. </body>
  428. </html>