<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="calledOneRight" v-if="index == 1" @click="call(item.patient_id)">
                <img src="../../../assets/img/volume.png" alt="">
            </div>
        </div>
        <div class="NoData" v-show="called.length == 0">
            <img src="@/assets/img/data.jpg" alt="">
        </div>
    </div>
</template>

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

        }
    },
    methods:{
        getCallTime(time){
            let obj = JSON.parse(time)
            let str = ''
            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)
                // let patientArr = res.data.queue_list.data
                // this.patientArr = patientArr
                // this.$emit('child-event',this.patientArr)
                if(res.data.code == 200){
                    this.$message({
                        message: res.data.msg,
                        type: 'success'
                    });
                }
                
            })
            
        }
    }
}
</script>


<style lang="scss" scoped>
.page_called{
    width:100%;
    .calledOne{
        border: 1px #e5e5ee solid;
        padding: 9px 0;
        margin: 0 15px 15px 0;
        float: left;
        width: 360px;
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px;
        .calledOneLeft{
            display: flex;
            img{
                width: 45px;
                height: 45px;
                border-radius: 50%;
                margin-right: 15px;
            }
            .name{
                >p:first-child{
                    font-size: 16px;
                    font-weight: bold;
                    color:#000;
                }
                >p:nth-of-type(2){
                    font-size: 12px;
                    color:#999999;
                    margin-top: 6px;
                }
                >p:nth-of-type(3){
                    font-size: 12px;
                    color:#999999;
                    margin-top: 3px;
                }
                .nameTips{
                    margin-right:10px;
                    display: inline-block;
                }
                
            }
            
        }
        .calledOneRight{
            img{
                width: 30px;
                margin-top: 8px;
            }
        }
    }
}
</style>
