<template>
  <view class="patientInformationInfo" v-if="Object.keys(infoDATA).length > 0">
    <view class="page_head">
      <view class="title">{{ infoDATA.patientName }}</view>
      <view class="patientCode">{{ infoDATA.patientCode }}</view>
      <view class="info">
        <view class="bedNum">
          <text class="info_h">床号</text>
          <text class="info_b">{{ infoDATA.bedNum || "-" }}</text>
        </view>
        <view :class="infoDATA.careLevel?'bedNum':'waitingCount'">
          <text class="info_h">待检查数</text>
          <text class="info_b">{{ infoDATA.watingCount }}</text>
        </view>
        <view class="bedNum" v-if="infoDATA.careLevel">
          <text class="info_h">护理等级</text>
          <text class="info_b">{{ infoDATA.careLevel.name }}</text>
        </view>
        <view class="waitingCount" v-if="infoDATA.illnessState">
          <text class="info_h">病情级别</text>
          <text class="info_b">{{ infoDATA.illnessState.name }}</text>
        </view>
      </view>
    </view>
    <view class="page_item" v-for="item in infoDATA.inspects" :key="item.id">
      <view class="page_item_info">
        <view class="page_item_info_title">检查项目：<text>{{ item.inspectName || "-" }}</text></view>
        <view class="page_item_info_title">检查科室：<text>{{
            item.execDept ? item.execDept.dept : "-"
          }}</text></view>
        <view class="page_item_info_title">预约时间：<text>{{ item.yyTime || "-" }}</text></view>
        <view class="page_item_info_title">预约叫号：<text>{{ item.reservationNumber || "-" }}</text></view>
      </view>
    </view>
    <view v-if="infoDATA.inspects.length == 0" class="zwsj">
      <image class="zwsj-img" mode="widthFix" src="../../static/img/zanwushuju.png"></image>
      <view class="zwsj-txt">暂无检查信息</view>
    </view>
  </view>
</template>
<script>
  import {
    get,
    post,
    SM,
    webHandle
  } from "../../http/http.js";
  export default {
    data() {
      return {
        infoDATA: {},
      };
    },
    methods: {
      // 请求详细页面的数据
      getInfo(patientCode) {
        uni.showLoading({
          title: "加载中",
          mask: true,
        });
        post("/nurse/workOrder/getPatientInspectInfo", {
          patientCode,
        }).then((res) => {
          uni.hideLoading();
          if (res.status == 200) {
            this.infoDATA = res.data;
          } else {
            uni.showToast({
              icon: "none",
              title: "请求失败！",
            });
          }
        });
      },
    },
    onLoad(options) {
      let {
        patientCode
      } = options;
      this.getInfo(patientCode);
      // #ifdef APP-PLUS
      webHandle("no", "app");
      // #endif
      // #ifdef H5
      webHandle("no", "wx");
      // #endif
    },
  };
</script>
<style lang="less">
  .patientInformationInfo {
    padding: 0 20rpx;
    overflow: hidden;

    .zwsj {
      text-align: center;

      .zwsj-img {
        width: 560rpx;
      }

      .zwsj-txt {
        font-size: 36rpx;
        font-weight: 700;
        margin-top: 20rpx;
        text-align: center;
      }
    }

    .page_head {
      background-color: #49b856;
      color: #fff;

      .title {
        font-size: 48rpx;
        padding-top: 24rpx;
        text-align: center;
      }

      .patientCode {
        padding-bottom: 12rpx;
        font-size: 28rpx;
        text-align: center;
      }

      .info {
        padding-bottom: 24rpx;
        margin: 8rpx 0;
        height: 80rpx;
        display: flex;
        justify-content: center;
        align-items: center;

        .bedNum,
        .waitingCount {
          width: 300rpx;
          height: 100%;
          display: flex;
          flex-direction: column;
          justify-content: center;
          align-items: center;

          .info_h {
            font-size: 30rpx;
          }

          .info_b {
            font-size: 26rpx;
          }
        }

        .bedNum {
          position: relative;

          &:after {
            content: "";
            position: absolute;
            width: 4rpx;
            height: 50rpx;
            right: -2rpx;
            top: 15rpx;
            background-color: #fff;
          }
        }
      }
    }

    .page_item {
      margin-top: 16rpx;
      margin-bottom: 16rpx;
      background: #fff;
      border-radius: 8rpx;
      overflow: hidden;
      padding: 0 16rpx;
      border: 2rpx solid #e5e9ed;

      .page_item_info {
        padding: 20rpx 16rpx;
        text-align: left;
        line-height: 60rpx;
        font-size: 30rpx;

        .page_item_info_title {
          font-weight: 700;

          text {
            font-weight: normal;
          }
        }
      }
    }
  }
</style>
