healthProtect.html 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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. padding: 8px 16px;
  17. font-size: 14px;
  18. }
  19. .box {
  20. height: 642px;
  21. overflow: auto;
  22. }
  23. .item {
  24. display: flex;
  25. align-items: center;
  26. justify-content: space-between;
  27. padding: 8px 0;
  28. border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  29. }
  30. .lheight2 {
  31. line-height: 2;
  32. }
  33. .flex {
  34. display: flex;
  35. align-items: center;
  36. }
  37. .pl8 {
  38. padding-left: 8px;
  39. }
  40. </style>
  41. </head>
  42. <body>
  43. <div id="app" v-cloak>
  44. <div class="box" v-if="key == 0">
  45. <div class="item" v-for="(item,i) in sportList" :key="i">
  46. <div>
  47. <div class="lheight2">
  48. 运动:{{item.sports}}
  49. <span class="pl8">时长:{{item.sports_time}}h</span>
  50. </div>
  51. <div class="lheight2">{{item.record_date}}</div>
  52. </div>
  53. <el-tag :type="item.tagType">{{item.sports_type}}</el-tag>
  54. </div>
  55. </div>
  56. <div class="box" v-else-if="key == 1">
  57. <div class="item" v-for="(item,i) in medicineList" :key="i">
  58. <div>
  59. <div class="lheight2">{{item.medicines}}</div>
  60. <div class="lheight2">{{item.record_date}} {{item.recordMethod}}</div>
  61. </div>
  62. </div>
  63. </div>
  64. <div class="box" v-else>
  65. <div class="item" v-for="(item,i) in foodList" :key="i" style="cursor: pointer" @click="openFoodDetail(item)">
  66. <div>
  67. <div class="lheight2" style="font-size: 16px">{{item.content}}</div>
  68. <div class="lheight2">{{item.record_date}} {{item.recordMethod}}</div>
  69. </div>
  70. <i class="el-icon-arrow-right"></i>
  71. </div>
  72. </div>
  73. </div>
  74. <script type="text/javascript" src="../../../js/vue.js"></script>
  75. <script type="text/javascript" src="../../../js/jquery-2.2.4.js"></script>
  76. <script type="text/javascript" src="../../../js/es6-promise.js" charset="utf-8"></script>
  77. <script type="text/javascript" src="../../../plugins/toastr/toastr.min.js"></script>
  78. <script type="text/javascript" src="../../../plugins/element-ui/element-ui.js"></script>
  79. <script type="text/javascript" src="../../../api/http-request.js"></script>
  80. <script type="text/javascript" src="../../../plugins/layer/layer.min.js"></script>
  81. <script type="text/javascript" src="../../../api/rehabilitation-api.js"></script>
  82. <script type="text/javascript" src="../../../api/recover_api.js"></script>
  83. <script type="text/javascript" src="../../../js/underscore-1.9.1.js"></script>
  84. <script type="text/javascript" src="../../../js/util.js" charset="utf-8"></script>
  85. <script>
  86. new Vue({
  87. el: '#app',
  88. data() {
  89. return {
  90. key: null,
  91. patient: null,
  92. endTime: null,
  93. sportList: [],
  94. medicineList: [],
  95. foodList: []
  96. }
  97. },
  98. mounted() {
  99. this.key = GetRequest().key
  100. this.patient = GetRequest().patient
  101. this.endTime = GetRequest().time
  102. switch (this.key) {
  103. case '0':
  104. this.getSportList()
  105. break
  106. case '1':
  107. this.getMedicineList()
  108. break
  109. case '2':
  110. this.getFoodList()
  111. break
  112. }
  113. },
  114. methods: {
  115. openFoodDetail(item) {
  116. top.layer.open({
  117. type: 2,
  118. area: ['700px', '700px'],
  119. shade: 0.5,
  120. title: '饮食详情',
  121. fixed: true, //不固定
  122. maxmin: true,
  123. closeBtn: 1,
  124. // shift: 5,
  125. shadeClose: false, //点击遮罩关闭层
  126. content: `../../rehabilitation/html/healthFoodDetail.html?id=${item.id}`
  127. })
  128. },
  129. getSportList() {
  130. const vm = this
  131. function getTagType(val) {
  132. switch (val) {
  133. case '轻度运动':
  134. return 'success'
  135. case '中度运动':
  136. return ''
  137. case '稍强运动':
  138. return 'warning'
  139. case '强度运动':
  140. return 'danger'
  141. }
  142. }
  143. const params = {
  144. page: 1,
  145. pagesize: 100,
  146. patient: this.patient,
  147. start: this.getDateFromCurrentDate(this.endTime, -2000) + ' 00:00:00',
  148. end: this.endTime + ' 23:59:59'
  149. }
  150. httpRequest.post('doctor/health_record/list_sports', { data: params }).then(function (res) {
  151. vm.sportList = res.list.map(function (item) {
  152. return {
  153. ...item,
  154. tagType: getTagType(item.sports_type)
  155. }
  156. })
  157. })
  158. },
  159. getMedicineList() {
  160. const vm = this
  161. const params = {
  162. page: 1,
  163. pagesize: 100,
  164. patient: this.patient,
  165. start: this.getDateFromCurrentDate(this.endTime, -2000) + ' 00:00:00',
  166. end: this.endTime + ' 23:59:59'
  167. }
  168. httpRequest.post('doctor/health_record/list_medication', { data: params }).then(function (res) {
  169. vm.medicineList = res.list.map(function (item) {
  170. return {
  171. ...item,
  172. recordMethod: item.source == 0 ? '手动记录' : '设备上传'
  173. }
  174. })
  175. })
  176. },
  177. getFoodList() {
  178. const vm = this
  179. const params = {
  180. page: 1,
  181. pagesize: 100,
  182. patient: this.patient,
  183. start: this.getDateFromCurrentDate(this.endTime, -2000) + ' 00:00:00',
  184. end: this.endTime + ' 23:59:59'
  185. }
  186. httpRequest.post('doctor/health_record/list_diet', { data: params }).then(function (res) {
  187. vm.foodList = res.list.map(function (item) {
  188. return {
  189. ...item,
  190. recordMethod: item.deviceSn ? '设备上传' : '手动上传'
  191. }
  192. })
  193. })
  194. },
  195. getDateFromCurrentDate(fromDate, dayInterval) {
  196. var curDate = new Date(Date.parse(fromDate.replace(/-/g, '/')))
  197. curDate.setDate(curDate.getDate() + dayInterval)
  198. var year = curDate.getFullYear()
  199. var month = curDate.getMonth() + 1 < 10 ? '0' + (curDate.getMonth() + 1) : curDate.getMonth() + 1
  200. var day = curDate.getDate() < 10 ? '0' + curDate.getDate() : curDate.getDate()
  201. return year + '-' + month + '-' + day
  202. }
  203. }
  204. })
  205. </script>
  206. </body>
  207. </html>