<template>
  <div class="reciped">
    <div class="flex-vertical-center-l btns">
      <div class="flex-center" @click="$router.back()">返回</div>
      <div class="flex-center bg-yellow" v-print="'#reciped'">打印</div>
    </div>
    <div id="reciped" v-if="msg.patient">
      <div class="title">中药处方筏</div>
      <div class="flex-vertical-center-l flex-wrap">
        <div class="flex-plane-center-l item">
          <div class="name">姓名：</div>
          <div>{{msg.patient.name}}</div>
        </div>
        <div class="flex-plane-center-l item">
          <div class>性别：</div>
          <div>{{msg.patient.sex}}</div>
        </div>
        <div class="flex-plane-center-l item">
          <div class>年龄：</div>
          <div>{{msg.patient.age}}岁</div>
        </div>
        <div class="flex-plane-center-l item">
          <div class>费别：</div>
          <div>自费</div>
        </div>
        <div class="flex-plane-center-l item">
          <div class>电话：</div>
          <div>{{msg.patient.phone}}</div>
        </div>
        <div class="flex-plane-center-l item">
          <div class>就诊科室：</div>
          <div>内科</div>
        </div>
        <div class="flex-plane-center-l item">
          <div class>临床诊断：</div>
          <div>{{msg.mainDiagnosis.namemedicine?msg.mainDiagnosis.namemedicine:msg.mainDiagnosis.diagnosis}}</div>
        </div>
        <div class="flex-plane-center-l item">
          <div class>开方时间：</div>
          <div>{{msg.patientprescription.createTime}}</div>
        </div>
      </div>
      <div class="title mr-t20">RP</div>
      <div class="flex-vertical-center-l flex-wrap">
        <div
          class="flex-plane-center-l item"
          v-for="(item,index) in msg.patientprescription.myPatientDetailVos"
          :key="index"
        >
          <div>
            {{item.name}}
            <span v-if="item.num">*{{item.num}}</span>
            <span v-if="item.unit">（{{item.unit}}）</span>
          </div>
        </div>
      </div>
      <div class="title mr-t20">处方信息</div>
      <div class="flex-vertical-center-l flex-wrap">
        <div class="flex-plane-center-l item">
          <div class="name">剂型：</div>
          <div>{{msg.patientprescription.dosageForm |dosageForm}}</div>
        </div>
        <div class="flex-plane-center-l item">
          <div class="name">剂数：</div>
          <div>{{msg.patientprescription.num}}</div>
        </div>
        <div class="flex-plane-center-l item">
          <div class="name">频次：</div>
          <div>{{msg.patientprescription.frequencyValue}}</div>
        </div>
      </div>
      <div class="flex-vertical-center-l flex-wrap">
        <div class="flex-plane-center-l item" v-if="msg.patientprescription.dosageForm==1">
          <div class="name">浓煎：</div>
          <div>{{msg.patientprescription.strongFried}}</div>
        </div>
        <div class="flex-plane-center-l item" v-if="msg.patientprescription.dosageForm==1">
          <div class="name">代煎：</div>
          <div>{{msg.patientprescription.agency}}</div>
        </div>

        <div class="flex-plane-center-l item">
          <div class="name">用法：</div>
          <div>{{msg.patientprescription.usestrValue}}</div>
        </div>
      </div>
      <div class="item flex-plane-center-l">
        <div class="name">嘱托：</div>
        <div>{{msg.patientprescription.command}}</div>
      </div>
      <div class="item flex-plane-center-l">
        <div class="name">收货姓名：</div>
        <div>{{msg.patientprescription.consigneeName}}</div>
      </div>
      <div class="item flex-plane-center-l">
        <div class="name">收货电话：</div>
        <div>{{msg.patientprescription.consigneePhone}}</div>
      </div>
      <div class="item flex-plane-center-l">
        <div class="name">配送地址：</div>
        <div>{{msg.patientprescription.province}}{{msg.patientprescription.city}}{{msg.patientprescription.district}}{{msg.patientprescription.address}}</div>
      </div>
      <div class="title mr-t20">费用明细</div>
      <div class="item flex-plane-center-l">
        <div class="name">药品金额：</div>
        <div>{{msg.patientprescription.thisRecipePrice}}</div>
      </div>
      <div class="item flex-plane-center-l">
        <div class="name">特殊调配费：</div>
        <div>{{msg.patientprescription.deploymentfree?msg.patientprescription.deploymentfree:0}}</div>
      </div>
      <div class="item flex-plane-center-l">
        <div class="name">代煎费：</div>
        <div>{{msg.patientprescription.friedfree?msg.patientprescription.friedfree:0}}</div>
      </div>
      <div class="item flex-plane-center-l">
        <div class="name">制膏费：</div>
        <div>{{msg.patientprescription.markfree?msg.patientprescription.markfree:0}}</div>
      </div>
      <div class="title mr-t20">其他</div>
      <div class="item flex-plane-center-l">
        <div class="name">医生签名：</div>
        <div>{{msg.patientprescription.updateUser}}</div>
      </div>
      <div class="item flex-plane-center-l">
        <div class="name">审核：</div>
        <div>{{msg.patientprescription.auditAccount?msg.patientprescription.auditAccount:'系统审核'}}</div>
      </div>
      <!-- <div class="item flex-plane-center-l" v-if="msg.patientprescription.auditAccount">
                <div class="name">审核账号：</div>
                <div>{{}}</div>
      </div>-->
      <div class="item flex-plane-center-l">
        <div class="name">注：</div>
        <div>
          <p>1.本处方当日有效</p>
          <p>2.取药时请您当面核对药品名称</p>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { getRecipeDMsg } from "@/api/business.js";
export default {
  data() {
    return {
      msg: {}
    };
  },
  created() {
    this.getRecipeDMsg();
  },
  methods: {
    async getRecipeDMsg() {
      let res = await getRecipeDMsg(this.$route.query.pid);
      if (res.ResultCode == 0) {
        // if(res.Data.patientprescription.type==2){
        //     res.Data.patientprescription.detail.forEach(item=>{
        //         item.drugName = item.
        //     })
        // }

        this.msg = res.Data;
      }
    }
  },
  filters: {
    dosageForm(val) {
      if (val == 0) {
        return "膏剂";
      }

      if (val == 1) {
        return "汤剂";
      }

      if (val == 2) {
        return "丸剂";
      }

      if (val == 3) {
        return "丹剂";
      }
    }
  }
};
</script>
<style lang="scss" scoped>
@import "../../style/common.scss";

.reciped {
  padding: 33px 46px;
  background: #ffffff;
  border-radius: 5px;

  .btns {
    margin-bottom: 34px;

    div {
      width: 74px;
      height: 36px;
      background: #5386f6;
      border-radius: 4px;
      font-size: 14px;
      font-family: PingFang SC;
      font-weight: 400;
      color: #ffffff;
      margin-right: 19px;
      cursor: pointer;
    }

    .bg-yellow {
      background: #ffae45;
    }
  }

  .title {
    font-size: 16px;
    font-family: PingFang SC;
    font-weight: 500;
    color: #5386f6;
    margin-bottom: 15px;
  }

  .item {
    font-size: 16px;
    font-family: PingFang SC;
    font-weight: 500;
    color: #333;
    margin-bottom: 15px;
    margin-right: 20px;

    .name {
      width: 105px;
      text-align-last: justify;
    }
  }
}
</style>