<!-- 办理住院 -->
<template>
    <nav-bar navbar-data="navbarData" />
    <view :style="{ paddingTop: height + 'px', height: '100vh', boxSizing: 'border-box' }" class="admission">
        <view class="waiting-progress-card">
            <view style="padding:30rpx" v-if="!admissionList[0]">暂无住院信息</view>
            <view class="waiting-progress-content" v-for="(item, index) in admissionList" :key="index">
                <view class="waiting-progress-card-head">
                    <view class="waiting-progress-head-loc">住院编号：{{ item.adminNo }}</view>
                    <!-- <view>排队中</view> -->
                    <view class="admission-head-status">{{ item.admStaDesc }}</view>
                </view>
                <view class="waiting-progress-card-boby">
                    <view>
                        <view class="wpcb-label">就诊人：</view>
                        <view class="wpcb-value FF9933">{{ item.patName }}</view>
                    </view>
                    <view>
                        <view class="wpcb-label">入院机构：</view>
                        <view class="wpcb-value FF9933">{{ item.hospDesc }}</view>
                    </view>
                    <view>
                        <view class="wpcb-label">入院病区：</view>
                        <view class="wpcb-value FF9933">{{ item.wardDesc }}</view>
                    </view>
                    <view>
                        <view class="wpcb-label">入院时间：</view>
                        <view class="wpcb-value">{{ item.adminDate }}</view>
                    </view>
                    <view>
                        <view class="wpcb-label">入院床位：</view>
                        <view class="wpcb-value">{{ item.bedDesc }}</view>
                    </view>
                    <view>
                        <view class="wpcb-label">申请医生：</view>
                        <view class="wpcb-value">{{ item.docDesc }}</view>
                    </view>
                </view>
                <view class="waiting-progress-card-footer">
                    <van-button plain round type="info" style="margin-right: 24rpx;" @tap="handleViewDetails(item)">查看详情</van-button>
                    <!-- <van-button round type="info">出示住院证</van-button> -->
                </view>
            </view>
        </view>
    </view>
</template>

<script>
import $http from "@/utils/https"
import httpConfig from '@/utils/httpConfig'
import NavBar from '@/components/navBar/index'
import VanButton from '@/components/button/index'
const app = getApp()
export default {
    components: {
        'nav-bar': NavBar,
        'van-button': VanButton,
    },
    data() {
        return {
            height: app.globalData.height,
            navbarData: {
                isGoHome: true,
                isGoBack: true,
                title: "办理住院"
            },
            admissionList: [],
        }
    },
    onShow: function () {
        this.getAdmission();
    },
    methods: {
        // 查看详情 -- 跳转到办理住院详情界面
        handleViewDetails: function (data) {
            let detailObj = data
            uni.navigateTo({
                url: "/pages/order/pages/admissionDetails/admissionDetails",
                success: (res) => {
                    res.eventChannel.emit('detailObj', {
                        detailObj: detailObj
                    }, () => {
                        console.log("detailObj", detailObj)
                    })
                },
            })
        },
        //获取住院证列表
        getAdmission: function () {
            let userData = this.$cache.get('userData');
            let data = {
                params: [{
                    patID: userData.hisPatID || "",
                    //patID: '36145'
                }]
            }
            $http.post("urlS", this, {
                code: "03100205",
                data: data,
                namespace: "Y",
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.admissionList = res.result
                    } else {
                        this.admissionList = []
                    }
                }
            });
        },
    }
}
</script>

<style>
.waiting-progress-title {
  width: 100%;
  padding: 24rpx 20rpx;
  line-height: 36rpx;
  box-sizing: border-box;
  color: #666;
  font-size: 26rpx;
}
.waiting-progress-card {
  width: 100%;
  padding: 0 24rpx;
  box-sizing: border-box;
}

.waiting-progress-content {
  width: 100%;
  background: #fff;
  margin-bottom: 8rpx;
}

.waiting-progress-card-head {
  height: 92rpx;
  line-height: 92rpx;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48rpx 0 24rpx;
  box-sizing: border-box;
  color: #666;
  border-bottom: 1rpx solid #f2f2f2;
}

.waiting-progress-head-loc {
  font-size: 34rpx;
  font-weight: 600;
}

.waiting-progress-head-status {
  font-size: 32rpx;
  font-weight: 900;
  color: #df342a;
}

.waiting-progress-card-boby {
  width: 100%;
  padding: 12rpx 0;
  border-bottom: 1rpx solid #f2f2f2;
  box-sizing: border-box;
}

.waiting-progress-card-boby>view {
  width: 100%;
  display: flex;
  font-size: 26rpx;
  height: 56rpx;
  line-height: 56rpx;
}

.wpcb-label {
  width: 200rpx;
  color: #999;
  text-align: right;
}

.wpcb-value {
  width: calc(100% - 200rpx);
  padding-left: 24rpx;
  color: #333;
  box-sizing: border-box;
}

.waiting-progress .FF9933 {
  color: #FF9933;
  font-weight: 700;
}

.waiting-progress-card-footer {
  width: 100%;
  height: 92rpx;
  padding: 0 28rpx;
  box-sizing: border-box;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.waiting-progress-card-footer .van-button {
  height: 64rpx;
  line-height: 64rpx;
}

.waiting-progress-btn {
  padding-top: 96rpx;
  margin-bottom: 30rpx;
}

.waiting-progress-btn  .van-button {
  font-size: 32rpx;
}

.admission {
  width: 100%;
  padding: 12rpx;
  box-sizing: border-box;
}

.admission-head-status {
  color: #3478F7;
}
</style>