<template>
    <div class="page_called">
        <div class="calledOne" v-for="(item,i) in called" :key="i">
            <div class="calledOneLeft">
                <img src="https://images.shengws.com/201809182128111.png?imageView2/2/w/500/h/500/q/90" alt="">
                <div class="name">
                    <p>{{ item.patient_name }}</p>
                    <p>
                        <span class="nameTips">签到时间：{{ item.create_time }}</span>
                        <span class="nameTips" v-if="index == 1">床位号：{{ item.partition_name + item.bed_name }}</span>
                        <span class="nameTips" v-else>叫号时间：{{ getCallTime(item.remark) }}</span>
                    </p>
                    <p>
                        <span class="nameTips">透前体重：{{ item.weight_before ? item.weight_before : '/' }}kg</span>
                        <span class="nameTips lastNameTips">透前血压：{{ item.systolic_blood_pressure ? parseInt(item.systolic_blood_pressure) : '' }}/{{ item.diastolic_blood_pressure ? parseInt(item.diastolic_blood_pressure) : '' }}mmHg</span>
                    </p>
                </div>
            </div>
            <div class="waitingOneRight">
                <span v-if="item.schedule_type == 1">上午</span>
                <span v-if="item.schedule_type == 2">下午</span>
                <span v-if="item.schedule_type == 3">晚上</span>
                {{ item.queue_no }}号
            </div>
        </div>
    </div>
</template>

<script>
import axios from 'axios'
import {Toast} from "vant";
export default {
    props:{
        index:Number,
        called:Array
    },
    data(){
        return{

        }
    },
    created(){
        // console.log('this.index',this.index)
    },
    methods:{
        getCallTime(time){
            let obj = JSON.parse(time)
            let str = ''
            // console.log(111111,obj)
            str = obj.typeone[0].call_time.split(' ')[1]
            return str
        },
        call(patient_id){
            // console.log('patient_id',patient_id)
            let org_id =  parseInt(sessionStorage.getItem("org_id"));
            let admin_user_id = parseInt(sessionStorage.getItem("admin_user_id"));
            axios.get('/api/index/upcall?org_id=' + org_id + '&patient_id=' + patient_id + '&admin_user_id=' + admin_user_id).then(res => {
                // console.log(res)
                if(res.data.code == 200){
                    Toast.success('叫号成功');
                }
                
            })
            
        }
    }
}
</script>


<style lang="scss" scoped>
.page_called{
    .calledOne{
        display: flex;
        padding: 0.46rem 0.43rem;
        border: 1px solid #e5e5ee;
        border-radius: 5px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.5rem;
        .calledOneLeft{
            display: flex;
            img{
                width: 1rem;
                height: 1rem;
                border-radius: 50%;
                margin-right: 0.33rem;
            }
            .name{
                >p:first-child{
                    font-size: 0.53rem;
                    font-weight: bold;
                    color:#000;
                }
                >p:nth-of-type(2){
                    font-size: 0.4rem;
                    color:#999999;
                    margin-top: 0.15rem;
                }
                >p:nth-of-type(3){
                    font-size: 0.4rem;
                    color:#999999;
                    margin-top: 0.1rem;
                }
                .nameTips{
                    // width: 4.2rem;
                    margin-right:0.33rem;
                    display: inline-block;
                }
                // .lastNameTips{
                //     width: 5rem;
                // }
                
            }
            
        }
        .waitingOneRight{
            .van-icon {
                color: #3389FB;
                font-size: 1rem;
                margin-top: 0.1rem;
            }
        }
    }
}
</style>
