123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>保健记录</title>
- <link rel="stylesheet" type="text/css" href="../../../css/bootstrap.min.css" />
- <link rel="stylesheet" type="text/css" href="../../../css/style.min.css" />
- <link rel="stylesheet" type="text/css" href="../../../css/cross.css" />
- <link rel="stylesheet" href="../../../plugins/toastr/toastr.min.css" />
- <link rel="stylesheet" href="../../../plugins/element-ui/element-ui.css" />
- <link rel="stylesheet" type="text/css" href="../css/date.css" />
- <link rel="stylesheet" href="../css/common.css" />
- <style>
- #app {
- padding: 8px 16px;
- font-size: 14px;
- }
- .box {
- height: 642px;
- overflow: auto;
- }
- .item {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 8px 0;
- border-bottom: 1px solid rgba(0, 0, 0, 0.1);
- }
- .lheight2 {
- line-height: 2;
- }
- .flex {
- display: flex;
- align-items: center;
- }
- .pl8 {
- padding-left: 8px;
- }
- </style>
- </head>
- <body>
- <div id="app" v-cloak>
- <div class="box" v-if="key == 0">
- <div class="item" v-for="(item,i) in sportList" :key="i">
- <div>
- <div class="lheight2">
- 运动:{{item.sports}}
- <span class="pl8">时长:{{item.sports_time}}h</span>
- </div>
- <div class="lheight2">{{item.record_date}}</div>
- </div>
- <el-tag :type="item.tagType">{{item.sports_type}}</el-tag>
- </div>
- </div>
- <div class="box" v-else-if="key == 1">
- <div class="item" v-for="(item,i) in medicineList" :key="i">
- <div>
- <div class="lheight2">{{item.medicines}}</div>
- <div class="lheight2">{{item.record_date}} {{item.recordMethod}}</div>
- </div>
- </div>
- </div>
- <div class="box" v-else>
- <div class="item" v-for="(item,i) in foodList" :key="i" style="cursor: pointer" @click="openFoodDetail(item)">
- <div>
- <div class="lheight2" style="font-size: 16px">{{item.content}}</div>
- <div class="lheight2">{{item.record_date}} {{item.recordMethod}}</div>
- </div>
- <i class="el-icon-arrow-right"></i>
- </div>
- </div>
- </div>
- <script type="text/javascript" src="../../../js/vue.js"></script>
- <script type="text/javascript" src="../../../js/jquery-2.2.4.js"></script>
- <script type="text/javascript" src="../../../js/es6-promise.js" charset="utf-8"></script>
- <script type="text/javascript" src="../../../plugins/toastr/toastr.min.js"></script>
- <script type="text/javascript" src="../../../plugins/element-ui/element-ui.js"></script>
- <script type="text/javascript" src="../../../api/http-request.js"></script>
- <script type="text/javascript" src="../../../plugins/layer/layer.min.js"></script>
- <script type="text/javascript" src="../../../api/rehabilitation-api.js"></script>
- <script type="text/javascript" src="../../../api/recover_api.js"></script>
- <script type="text/javascript" src="../../../js/underscore-1.9.1.js"></script>
- <script type="text/javascript" src="../../../js/util.js" charset="utf-8"></script>
- <script>
- new Vue({
- el: '#app',
- data() {
- return {
- key: null,
- patient: null,
- endTime: null,
- sportList: [],
- medicineList: [],
- foodList: []
- }
- },
- mounted() {
- this.key = GetRequest().key
- this.patient = GetRequest().patient
- this.endTime = GetRequest().time
- switch (this.key) {
- case '0':
- this.getSportList()
- break
- case '1':
- this.getMedicineList()
- break
- case '2':
- this.getFoodList()
- break
- }
- },
- methods: {
- openFoodDetail(item) {
- top.layer.open({
- type: 2,
- area: ['700px', '700px'],
- shade: 0.5,
- title: '饮食详情',
- fixed: true, //不固定
- maxmin: true,
- closeBtn: 1,
- // shift: 5,
- shadeClose: false, //点击遮罩关闭层
- content: `../../rehabilitation/html/healthFoodDetail.html?id=${item.id}`
- })
- },
- getSportList() {
- const vm = this
- function getTagType(val) {
- switch (val) {
- case '轻度运动':
- return 'success'
- case '中度运动':
- return ''
- case '稍强运动':
- return 'warning'
- case '强度运动':
- return 'danger'
- }
- }
- const params = {
- page: 1,
- pagesize: 100,
- patient: this.patient,
- start: this.getDateFromCurrentDate(this.endTime, -2000) + ' 00:00:00',
- end: this.endTime + ' 23:59:59'
- }
- httpRequest.post('doctor/health_record/list_sports', { data: params }).then(function (res) {
- vm.sportList = res.list.map(function (item) {
- return {
- ...item,
- tagType: getTagType(item.sports_type)
- }
- })
- })
- },
- getMedicineList() {
- const vm = this
- const params = {
- page: 1,
- pagesize: 100,
- patient: this.patient,
- start: this.getDateFromCurrentDate(this.endTime, -2000) + ' 00:00:00',
- end: this.endTime + ' 23:59:59'
- }
- httpRequest.post('doctor/health_record/list_medication', { data: params }).then(function (res) {
- vm.medicineList = res.list.map(function (item) {
- return {
- ...item,
- recordMethod: item.source == 0 ? '手动记录' : '设备上传'
- }
- })
- })
- },
- getFoodList() {
- const vm = this
- const params = {
- page: 1,
- pagesize: 100,
- patient: this.patient,
- start: this.getDateFromCurrentDate(this.endTime, -2000) + ' 00:00:00',
- end: this.endTime + ' 23:59:59'
- }
- httpRequest.post('doctor/health_record/list_diet', { data: params }).then(function (res) {
- vm.foodList = res.list.map(function (item) {
- return {
- ...item,
- recordMethod: item.deviceSn ? '设备上传' : '手动上传'
- }
- })
- })
- },
- getDateFromCurrentDate(fromDate, dayInterval) {
- var curDate = new Date(Date.parse(fromDate.replace(/-/g, '/')))
- curDate.setDate(curDate.getDate() + dayInterval)
- var year = curDate.getFullYear()
- var month = curDate.getMonth() + 1 < 10 ? '0' + (curDate.getMonth() + 1) : curDate.getMonth() + 1
- var day = curDate.getDate() < 10 ? '0' + curDate.getDate() : curDate.getDate()
- return year + '-' + month + '-' + day
- }
- }
- })
- </script>
- </body>
- </html>
|