<template>
    <div style="margin-left: 15px">
        显示范围
        <el-select v-model="queryParam.queryRange"
                   :clearable="wardsClearable"
                   style="width: 110px"
        >
            <el-option v-for="item in queryRangeList"
                       :key="item.code"
                       :label="item.name"
                       :value="item.code"/>
        </el-select>
        状态
        <el-select v-model="queryParam.statusFlag"
                   :clearable="wardsClearable"
                   style="width: 110px"
        >
            <el-option v-for="item in statusFlagList"
                       :key="item.code"
                       :label="item.name"
                       :value="item.code"/>
        </el-select>
        <el-button icon="Search" type="primary" @click="queryYzInfo">查询</el-button>
        <div style="display: flex;float: right;margin-right: 20px">
            <status-color color="#05ff00" label="R:录入"/>
            <status-color color="#0000fb" label="Q:确认"/>
            <status-color color="#ff07f3" label="Z:执行"/>
            <status-color color="red" label="T:停止"/>
            <status-color color="#00ffe0" label="D:作废"/>
        </div>
    </div>
    <div style="height: 82%;margin-top: 10px">
        <el-table :data="yzDataList"  highlight-current-row stripe border show-overflow-tooltip   style="width: 100%;height: 100%">
            <el-table-column label="排序" type="index" width="40" />
            <el-table-column prop="orderGroup" label="组" width="30"/>
            <el-table-column prop="statusFlag" label="状态" width="40" >
                <template #default="scope">
                    <span v-html="getStatusFlagHtml(scope.row)"></span>
                </template>
            </el-table-column>
            <el-table-column prop="actOrderNo" label="医嘱号" />
            <el-table-column prop="orderName" label="医嘱名称" min-width="180" show-overflow-tooltip />
            <el-table-column prop="orderName" label="剂量" width="60">
                <template #default="scope"> {{ scope.row.dose }} {{ scope.row.doseUnitName }}</template>
            </el-table-column>
            <el-table-column label="频率" prop="frequCode" width="100" />
            <el-table-column label="给药方式" prop="supplyCodeName" min-width="100"/>
            <el-table-column label="开始时间" prop="startTime" width="125"/>
            <el-table-column label="结束时间" prop="endTime" width="125"/>
            <el-table-column label="医保自费">
                <template #default="scope">
                    <el-tag v-if="scope.row.ybSelfFlag === '1'">√</el-tag>
                </template>
            </el-table-column>
            <el-table-column label="是否紧急">
                <template #default="scope">
                    <el-tag v-if="scope.row.emergencyFlag === '1'">√</el-tag>
                </template>
            </el-table-column>
            <el-table-column label="医生" prop="physicianName"/>
            <el-table-column label="费用标志" prop="selfBuyName"/>
            <el-table-column label="执行科室" prop="execUnitName" min-width="120"/>
            <el-table-column label="领量" prop="drugQuan">
                <template #default="scope"> {{ scope.row.drugQuan }} {{ scope.row.drugQuanName }}</template>
            </el-table-column>
            <el-table-column label="药房" prop="groupNoName"></el-table-column>
            <el-table-column label="序号" prop="serial"></el-table-column>
            <el-table-column label="嘱托" prop="instruction"></el-table-column>
        </el-table>
    </div>
</template>

<script setup name='YzTable'>
import {getStatusFlagHtml} from "@/components/medical-advice/MedicalAdviceCommonUtil"
import {queryYz} from "@/api/medical-advice/medical-advice-management";
import StatusColor from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/yz-header/StatusColor";
import {onMounted} from "vue";
import {stringNotBlank} from "@/utils/blank-utils";

const props = defineProps({
    patientInfo: {
        type: Object,
        default:{}
    },

})
const yzDataList = ref([])
const queryParam = ref({
    patNo:props.patientInfo.inpatientNo,
    times:props.patientInfo.admissTimes,
    queryRange:'0',
    statusFlag:'3'
})
const queryRangeList=ref([{
    code:'0',
    name:'全部',
},{
    code:'1',
    name:'停止',
},{
    code:'2',
    name:'当前',
},{
    code:'3',
    name:'今天',
}])
const statusFlagList=ref([{
    code:'0',
    name:'全部',
},{
    code:'1',
    name:'录入',
},{
    code:'2',
    name:'确认',
},{
    code:'3',
    name:'执行',
},{
    code:'5',
    name:'停止',
}])


onMounted(()=>{
    queryYzInfo()
})

const queryYzInfo=()=>{
    queryYz(queryParam.value).then((res) => {
        yzDataList.value = res.yzDataList
    })
}
</script>

<style scoped>
.status_color {
        width: 10px;
        height: 10px;
    }
</style>