<template>
  <div class="plate-box">
    <h2 class="title"><span class="line"></span><p>{{title}}</p><span class="line"></span> </h2> 
    <div class="plate">   
      <ul>
        <li>
          <label>透析模式 : </label>
          <span class="content">{{dialysis_mode}}</span>
        </li>
        <li>
          <label>灌流器 : </label>
          <span class="content">{{perfusion_apparatus}}</span>
        </li>
        <li>
          <label>置换液(L) : </label>
          <span class="content">{{displace_liqui}}</span>
          <span class="unit">L</span>
        </li>
        <li>
          <label>首剂(mg) : </label>
          <span class="content">{{anticoagulant_shouji}}</span>
          <span class="unit">mg</span>
        </li>
        <li>
          <label>钾(mmol/L) : </label>
          <span class="content">{{kalium}}</span>
          <span class="unit">mmol/L</span>
        </li>
        <li>
          <label>碳酸氢盐 : </label>
          <span class="content">{{bicarbonate}}</span>
          <span class="unit">mmol/l</span>
        </li>
        <li>
          <label>透析液流量 : </label>
          <span class="content">{{dialysate_flow}}</span>
          <span class="unit">ml/min</span>
        </li>
      </ul>
      <ul>
        <li>
          <label>透析时长 : </label>
          <span class="content">{{dialysis_duration}}</span>
          <span class="unit">h</span>
        </li>
        <li>
          <label>血流量 : </label>
          <span class="content">{{blood_flow_volume}}</span>
          <span class="unit">ml/min</span>
        </li>
        <li>
          <label>置换方式 : </label>
          <span class="content">{{replacement_way}}</span>
        </li>
        <li>
          <label>维持(mg/h) : </label>
          <span class="content">{{anticoagulant_weichi}}</span>
          <span class="unit">mg/h</span>
        </li>
        <li>
          <label>钠(mmol/L): </label>
          <span class="content">{{sodium}}</span>
          <span class="unit">mmol/l</span>
        </li>
        <li>
          <label>葡萄糖 : </label>
          <span class="content">{{glucose}}</span>
          <span class="unit">mmol/l</span>
        </li>
        <li>
          <label>透析液温度 : </label>
          <span class="content">{{dialysate_temperature}}</span>
          <span class="unit">℃</span>
        </li>
      </ul>
      <ul>
        <li>
          <label>透析器 : </label>
          <span class="content">{{dialyzer}}</span>
        </li>
        <li>
          <label>脱水量 : </label>
          <span class="content">{{prescription_dewatering}}</span>
          <span class="unit">L</span>
        </li>
        <li>
          <label>抗疑剂 : </label>
          <span class="content">{{anticoagulant}}</span>
        </li>
        <li>
          <label>总量(mg) : </label>
          <span class="content">{{anticoagulant_zongliang}}</span>
          <span class="unit">mg</span>
        </li>
        <li>
          <label>钙(mmol/L): </label>
          <span class="content">{{calcium}}</span>
          <span class="unit">mmol/l</span>
        </li>
        <li>
          <label>干体重(kg) : </label>
          <span class="content">{{dry_weight}}</span>
          <span class="unit">kg</span>
        </li>
        <li>
          <label>电导率 : </label>
          <span class="content">{{conductivity}}</span>
          <span class="unit">mS/cm</span>
        </li>
      </ul>
    </div>
    <div class="note">备注 : <span>{{note}}</span></div>
    <!-- <div class="note">处方医生 : {{doctor}}</div> -->
  </div>
</template>

<script>
export default {
  name: "DialysisPrescription",
  data() {
    return {
      title: "透析处方",
      // note: "",
      // doctor: "刘小军 医生",
      // row1: [
      //   { value: "1", label: "透析模式 : ", content: "", unit: "" },
      //   { value: "2", label: "灌流器 : ", content: "0", unit: "L" },
      //   { value: "3", label: "置换液(L) : ", content: "0", unit: "L" },
      //   { value: "4", label: "首剂(mg) : ", content: "0", unit: "mg" },
      //   { value: "5", label: "钾(mmol/L) : ", content: "0", unit: "mmol/l" },
      //   { value: "6", label: "碳酸氢盐 : ", content: "0", unit: "mmol/l" },
      //   { value: "7", label: "透析液流量 : ", content: "0", unit: "ml/min" }
      // ],
      // row2: [
      //   // { value: "1", label: "透析时长 : ", content: "0", unit: "h" },
      //   { value: "2", label: "血流量 : ", content: "0", unit: "ml/min" },
      //   { value: "3", label: "置换方式 : ", content: "", unit: "" },
      //   { value: "4", label: "维持(mg/h) : ", content: "0", unit: "mg/h" },
      //   { value: "5", label: "钠(mmol/L): ", content: "0", unit: "mmol/l" },
      //   { value: "6", label: "葡萄糖 : ", content: "0", unit: "mmol/l" },
      //   { value: "7", label: "透析液温度 : ", content: "0", unit: "℃" }
      // ],
      // row3: [
      //   { value: "1", label: "透析器 : ", content: "0", unit: "L" },
      //   { value: "2", label: "脱水量 : ", content: "0", unit: "L" },
      //   { value: "3", label: "抗疑剂 : ", content: "", unit: "" },
      //   { value: "4", label: "总量(mg) : ", content: "0", unit: "mg" },
      //   { value: "5", label: "钙(mmol/L): ", content: "0", unit: "mmol/l" },
      //   { value: "6", label: "干体重(kg) : ", content: "0", unit: "kg" },
      //   { value: "7", label: "电导率 : ", content: "0", unit: "mS/cm" }
      // ],
      // prescription: null,
      // solution: null,
    };
  },
  props: {
    prescription: {
      type: Object,
    },
    solution: {
      type: Object,
    },
  },
  // watch: {
  //   prescription: function() {
  //     this.setPrescription1(this.prescription, this.solution)
  //   },
  //   solution: function() {
  //     this.setPrescription1(this.prescription, this.solution)
  //   }
  // },
  computed: {
    // row1
    dialysis_mode: function() {
      return this.getValueStr("mode_id", "mode_id")
    },
    perfusion_apparatus: function() {
      return this.getValueStr("perfusion_apparatus", "perfusion_apparatus")
    },
    displace_liqui: function() {
      var v = this.getValueStr("displace_liqui", "displace_liqui")
      return v.length == 0 ? "0" : v
    },
    anticoagulant_shouji: function() {
      var v = this.getValueStr("anticoagulant_shouji", "anticoagulant_shouji")
      return v.length == 0 ? "0" : v
    },
    kalium: function() {
      var v = this.getValueStr("kalium", "kalium")
      return v.length == 0 ? "0" : v
    },
    bicarbonate: function() {
      var v = this.getValueStr("bicarbonate", "bicarbonate")
      return v.length == 0 ? "0" : v
    },
    dialysate_flow: function() {
      var v = this.getValueStr("dialysate_flow", "dialysate_flow")
      return v.length == 0 ? "0" : v
    },
    // row2
    dialysis_duration: function() {
      var v = this.getValueStr("dialysis_duration", "dialysis_duration")
      return v.length == 0 ? "0" : v
    },
    blood_flow_volume: function() {
      var v = this.getValueStr("blood_flow_volume", "blood_flow_volume")
      return v.length == 0 ? "0" : v
    },
    replacement_way: function() {
      return this.getValueStr("replacement_way", "replacement_way")
    },
    anticoagulant_weichi: function() {
      var v = this.getValueStr("anticoagulant_weichi", "anticoagulant_weichi")
      return v.length == 0 ? "0" : v
    },
    sodium: function() {
      var v = this.getValueStr("sodium", "sodium")
      return v.length == 0 ? "0" : v
    },
    glucose: function() {
      var v = this.getValueStr("glucose", "glucose")
      return v.length == 0 ? "0" : v
    },
    dialysate_temperature: function() {
      var v = this.getValueStr("dialysate_temperature", "dialysate_temperature")
      return v.length == 0 ? "0" : v
    },
    dialyzer: function() {
      var v = this.getValueStr("dialyzer", "hemodialysis_machine")
      return v.length == 0 ? "0" : v
    },
    prescription_dewatering: function() {
      var v = this.getValueStr("prescription_dewatering", "dewater")
      return v.length == 0 ? "0" : v
    },
    anticoagulant: function() {
      return this.getValueStr("anticoagulant", "anticoagulant")
    },
    anticoagulant_zongliang: function() {
      var v = this.getValueStr("anticoagulant_zongliang", "anticoagulant_zongliang")
      return v.length == 0 ? "0" : v
    },
    calcium: function() {
      var v = this.getValueStr("calcium", "calcium")
      return v.length == 0 ? "0" : v
    },
    dry_weight: function() {
      var v = this.getValueStr("dry_weight", "dry_weight")
      return v.length == 0 ? "0" : v
    },
    conductivity: function() {
      var v = this.getValueStr("conductivity", "conductivity")
      return v.length == 0 ? "0" : v
    },
    note: function() {
      return this.getValueStr("remark", "remark")
    }
  },
  methods: {
    // setPrescription(prescription, solution) {
    //   this.prescription = prescription
    //   this.solution = solution
    // },
    getValueStr(pkey, skey) {
      // console.log(this.prescription.id)
      if ((this.prescription == null || this.prescription.id == "") && (this.solution == null || this.solution.id == "")) {
        return ""
      } else if (this.prescription != null && this.prescription.id != "") {
        if (this.prescription[pkey] == null || this.prescription[pkey] == undefined) {
          return ""
        }
        return this.prescription[pkey] + ""
      } else {
        if (this.solution[skey] == null || this.solution[skey] == undefined) {
          return ""
        }
        return this.solution[skey] + ""
      }
    },
    // setPrescription1(prescription, solution) {
    //   if (prescription == null && solution == null) {
    //     this.row1[0].content = ""
    //     this.row1[1].content = "0"
    //     this.row1[2].content = "0"
    //     this.row1[3].content = "0"
    //     this.row1[4].content = "0"
    //     this.row1[5].content = "0"
    //     this.row1[6].content = "0"

    //     this.row2[0].content = "0"
    //     this.row2[1].content = "0"
    //     this.row2[2].content = ""
    //     this.row2[3].content = "0"
    //     this.row2[4].content = "0"
    //     this.row2[5].content = "0"
    //     this.row2[6].content = "0"
        
    //     this.row3[0].content = "0"
    //     this.row3[1].content = "0"
    //     this.row3[2].content = ""
    //     this.row3[3].content = "0"
    //     this.row3[4].content = "0"
    //     this.row3[5].content = "0"
    //     this.row3[6].content = "0"

    //     this.note = ""
        
    //   } else if (prescription != null) {
    //     this.row1[0].content = prescription.mode_id
    //     this.row1[1].content = prescription.perfusion_apparatus
    //     this.row1[2].content = prescription.displace_liqui
    //     this.row1[3].content = prescription.anticoagulant_shouji
    //     this.row1[4].content = prescription.kalium
    //     this.row1[5].content = prescription.bicarbonate
    //     this.row1[6].content = prescription.dialysate_flow

    //     this.row2[0].content = prescription.dialysis_duration
    //     this.row2[1].content = prescription.blood_flow_volume
    //     this.row2[2].content = prescription.replacement_way
    //     this.row2[3].content = prescription.anticoagulant_weichi
    //     this.row2[4].content = prescription.sodium
    //     this.row2[5].content = prescription.glucose
    //     this.row2[6].content = prescription.dialysate_temperature
        
    //     this.row3[0].content = prescription.dialyzer
    //     this.row3[1].content = prescription.prescription_dewatering
    //     this.row3[2].content = prescription.anticoagulant
    //     this.row3[3].content = prescription.anticoagulant_zongliang
    //     this.row3[4].content = prescription.calcium
    //     this.row3[5].content = prescription.dry_weight
    //     this.row3[6].content = prescription.conductivity

    //     this.note = prescription.remark

    //   } else {
    //     this.row1[0].content = solution.mode_id
    //     this.row1[1].content = solution.perfusion_apparatus
    //     this.row1[2].content = solution.displace_liqui
    //     this.row1[3].content = solution.anticoagulant_shouji
    //     this.row1[4].content = solution.kalium
    //     this.row1[5].content = solution.bicarbonate
    //     this.row1[6].content = solution.dialysate_flow

    //     this.row2[0].content = solution.dialysis_duration
    //     this.row2[1].content = solution.blood_flow_volume
    //     this.row2[2].content = solution.replacement_way
    //     this.row2[3].content = solution.anticoagulant_weichi
    //     this.row2[4].content = solution.sodium
    //     this.row2[5].content = solution.glucose
    //     this.row2[6].content = solution.dialysate_temperature
        
    //     this.row3[0].content = solution.dialyzer
    //     this.row3[1].content = solution.prescription_dewatering
    //     this.row3[2].content = solution.anticoagulant
    //     this.row3[3].content = solution.anticoagulant_zongliang
    //     this.row3[4].content = solution.calcium
    //     this.row3[5].content = solution.dry_weight
    //     this.row3[6].content = solution.conductivity

    //     this.note = solution.remark
    //   }
    // }
  }
};
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
</style>



