<template>
  <div class="fastProvince">
    <el-dialog
      title="提示"
      :visible.sync="dialogVisible"
      width="40%"
    >
      <div style="text-align: center">
        <p>您选择的区域酷医云暂未对接，请联系酷医云客服，我们将免费为您实现对接</p>
        <img style="width: 150px;height: 150px" src="../../../assets/home/kuyi_wechat.jpg"/>
        <p>服务热线</p>
        <p style="font-size: 16px">18682078150</p>
      </div>


      <span slot="footer" class="dialog-footer">
    <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  </span>
    </el-dialog>

    
    
    
    <div style="flex:1">
      <div class="newContainer">
        <div style="width:270px">
          <div class="cell clearfix">
            <el-form :model="form" ref="ruleForm" class="demo-ruleForm" style="text-align: center">
              <el-form-item>
                <el-select v-model="form.province" clearable filterable placeholder="请选择省份" @change="changeProvince" style="width:270px;">
                  <el-option
                    v-for="item in provinces"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-form>
          </div>
          <div v-if="this.form.province == 13">
            <div class="cell clearfix" style="margin-bottom:10px;" >
              <el-date-picker v-model="selected_date" prefix-icon="el-icon-date" @change="handleScheduleDateChange" :editable="false" :clearable="false" style="width: 130px;margin-right:10px;" type="date" placeholder="选择日期时间" align="right" ></el-date-picker>
              <el-input size="small" style="width:80px;" v-model.trim="search_input" class="filter-item"/>
              <el-button size="small" class="filter-item" type="primary" @click="searchAction">搜索</el-button>
            </div>
            <div class="cell clearfix" style="margin-bottom:10px;">
              <el-select v-model="patientStateVal" placeholder="全部患者状态" style="width:130px;margin-right:10px;" @change="handleStateChange">
                <el-option
                  v-for="item in patient_state"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
              <el-select v-model="treatStateVal" placeholder="全部治疗状态" style="width:130px;" @change="handleTreatChange">
                <el-option
                  v-for="item in treat_state"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </div>
            <div class="cell clearfix" style="margin-bottom:10px;">
              <el-select v-model="scheduleStateVal" placeholder="班次" style="width:130px;margin-right:10px;" @change="handletimeType">
                <el-option
                  v-for="item in schedule_options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
              <el-select v-model="zoneVal" placeholder="分区" style="width:130px;" @change="handleZoneChange">
                <el-option
                  v-for="item in zone_options"
                  :key="item.id"
                  :label="item.text"
                  :value="item.id">
                </el-option>
              </el-select>
            </div>
            <div>
              <el-table
                ref="tab"
                @row-click="changePatient"
                highlight-current-row
                :data="tableData"
                height="300"
                border
                style="width: 100%"
                :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}">
                <el-table-column
                  label="患者"
                  >
                  <template slot-scope="scope">
                    {{ scope.row.patient ? scope.row.patient.name : '' }}
                  </template>
                </el-table-column>
                <el-table-column
                  label="透析号"
                  >
                  <template slot-scope="scope">
                    {{ scope.row.patient ? scope.row.patient.dialysis_no : '' }}
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </div>
        </div>
        <div style="flex:1;width:0;margin-left:20px;height: calc(100vh - 178px);overflow-y: auto;" v-if="this.form.province == 13">
          <!-- <div class="cell clearfix" style="margin-bottom:0px;">
            <el-form :inline="true" :model="listQuery">
              <el-form-item label>
                <el-input v-model.trim="listQuery.search" placeholder="姓名/透析号" style="width:120px"></el-input>
                <el-button type="primary" style="padding: 10px 6px;" @click="onSearch" icon="el-icon-search">搜索</el-button>
              </el-form-item>
            </el-form>
            <div class="time" style="margin-left:40px;">
              <ul class="newUl">
                <li
                  :class="item.state == wayType ? 'active' : ''"
                  @click="chooseWay(item.state)"
                  v-for="item in way"
                  :key="item.value"
                >{{ item.label }}</li>
              </ul>
            </div>
          </div> -->
          <el-tabs type="border-card">
            <el-tab-pane label="基本信息">
              <basic-info :patient='patient'></basic-info>
            </el-tab-pane>
            <el-tab-pane label="治疗信息">
              <treat-info :patient='patient' :prescription='prescription' :predialysis_evaluation='predialysis_evaluation' :assessment_after_dislysis='assessment_after_dislysis' :monitor_records='monitor_records' :admin_users='admin_users' :dialysis_order="dialysis_order" :double_check="double_check" :selected_date='selected_date'></treat-info>
            </el-tab-pane>
            <el-tab-pane label="透析参数">
              <dialysis-params :prescription='prescription' :doctor_advices='doctor_advices' :monitor_records='monitor_records' :patient='patient'></dialysis-params>
            </el-tab-pane>
            <el-tab-pane label="治疗小结">
              <dialysis-summary :treatment_summary='treatment_summary' :patient='patient'></dialysis-summary>
            </el-tab-pane>
            <el-tab-pane label="抢救记录">
              <rescue-record :doctor_advices='doctor_advices' :patient='patient' :prescription='prescription'></rescue-record>
            </el-tab-pane>
          </el-tabs>
        </div>
      </div>
    </div>
    

  </div>
</template>

<script>
  import { GetDistrictsByUpid } from '@/api/district'
  import { getIsDocking } from '@/api/config'
  import basicInfo from "../fast/basicInfo"
  import treatInfo from "../fast/treatInfo"
  import dialysisParams from "../fast/dialysisParams"
  import dialysisSummary from "../fast/dialysisSummary"
  import rescueRecord from "../fast/rescueRecord"

  import {
  getDialysisRecordInitData,
  getDialysisSchedules,
  getDialysisScheduleDetail,
} from "@/api/dialysis_record";
import { parseTime } from "@/utils";

  export default {
    name: 'FastProvince',
    components:{
      basicInfo,
      treatInfo,
      dialysisParams,
      dialysisSummary,
      rescueRecord
    },
    data() {
      return {
        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
        start_time: '',
        dialogVisible: false,
        end_time: '',
        provinces: [],
        citys:[],
        form: {
          province: '',
          city: ''
        },
        listQuery: {
          start_time: "",
          end_time: "",
          page: 1,
          limit: 10
        },
        way: [
          { value: 0, label: "基本信息", state: 0 },
          { value: 1, label: "治疗信息", state: 1 },
          { value: 2, label: "透析参数", state: 2 },
          { value: 3, label: "治疗小结", state: 3 },
          { value: 4, label: "抢救记录", state: 4 },
        ],
        wayType: 0,

        //
        tableData: [],
        selected_date: new Date(),
        // search_input 和 search_keyword，使输入关键字时不会经常刷新 filtedSchedules
        search_keyword: '', // 确定用于搜索的关键字
        search_input: '', // 输入中的关键字
        patient_state:[
            {value: 0,label: '全部'},
            {value: 1,label: '已签到'},
            {value: 2,label: '未签到'},
            {value: 3,label: '已上机'},
            {value: 4,label: '已下机'},
        ],
        patientStateVal: 0,
        treat_state:[
            {value: 0,label: '全部'},
            {value: 1,label: '待开处方'},
            {value: 2,label: '待开小结'},
        ],
        treatStateVal: 0,
        schedule_options:[
            {value: 0,label: '全部'},
            {value: 1,label: '上午'},
            {value: 2,label: '下午'},
            {value: 3,label: '晚上'},
        ],
        scheduleStateVal: 0,
        zone_options:[
            { id: 0, text: '全部' }
        ],
        zoneVal:0,

        patient: { id: 0 }, // 患者信息
        schedual: { id: 0 }, // 患者排班信息
        prescription: { id: 0 }, // 透析处方
        solution: { id: 0 }, // 透析方案
        system_prescribe: { id: 0 },
        receiver_treatment_access: { id: 0 }, // 接诊评估
        predialysis_evaluation: { id: 0 }, // 透前评估
        doctor_advices: [], // 临时医嘱
        double_check: { id: 0 }, // 双人核对
        assessment_after_dislysis: { id: 0 }, // 透后评估
        treatment_summary: { id: 0 }, // 治疗小结
        monitor_records: [], // 透析监测
        dialysis_order: { id: 0 }, // 透析记录
        admin_users: [], // 系统用户列表
        devices: [], // 设备
        device_numbers: [], // 床位号

        admin_user_map: {}, // {user_id: admin_user object}
        device_map: {}, // {device_id: device}
        device_number_map: {}, // {device_number_id: device_number}

        niprocart_info: [],
        jms_info: [],
        fistula_needle_set_info: [],
        fistula_needle_set_16_info: [],
        hemoperfusion_info: [],
        dialyser_sterilised_info: [],
        filtryzer_info: [],
        dialyzers_info: [],
        injector_info: [],
        bloodlines_info: [],
        tubingHemodialysis_info: [],
        safe_package_info: [],
        aliquid_info: [],
        config: {},

        lastPredialysisEvaluation: { id: 0 },
        lastMonitorRecord: { id: 0 },
        lastAssessmentAfterDislysis: { id: 0 },
        lastDryWeightDislysis: { id: 0 },
        headNurses: [],
        lastDialysisPrescribe: { id: 0 },

      }
    }, 
    computed:{
      filtedSchedules: function() {
        var search_keyword = this.search_keyword
        if (search_keyword.length > 0) {
          var schedules = []
          for (let o_i = 0; o_i < this.zone_schedules.length; o_i++) {
            const scheduleInfo = this.zone_schedules[o_i]
            var originSchedules = scheduleInfo.schedules
            if (originSchedules.length == 0) {
              continue
            }
            var filtedSchedules = []
            for (let s_i = 0; s_i < originSchedules.length; s_i++) {
              const schedule = originSchedules[s_i]
              if (schedule.patient.name.indexOf(search_keyword) != -1) {
                filtedSchedules.push(schedule)
                // break
              }
            }
            if (filtedSchedules.length > 0) {
              schedules.push({ zone_id: scheduleInfo.zone_id, zone_name: scheduleInfo.zone_name, schedules: filtedSchedules })
            }
          }
          return schedules
        }
      }
    },
    created() {
      this.getDistricts()
      var province = sessionStorage.getItem('province')
      if (province == null) {
        this.form.province = ''
      } else {
        this.form.province = parseInt(province)
      }

      

      this.getInitData()
      
    }, methods: {
      getDistricts: function() {
        GetDistrictsByUpid({ id: 0 }).then(response => {
          var res = response.data
          if (res.state === 1) {
            this.provinces = res.data.citys
          }
        }).catch(e => {

        })

      }, changeProvince(id) {
        getIsDocking({ config_type: 2, province: id, city: 0 }).then(response => {
          var res = response.data
          if (res.state == 1) {
            if (res.data.is_docking == 2) {
              this.$message.error('该地区尚未对接,请联系客服')
              this.dialogVisible = true
              this.form.province = ''

            } else {
              this.form.province = id
              this.dialogVisible = false
              sessionStorage.setItem('province', id)
            }
          } else {
            this.$message.error(res.msg)
          }
        }).catch(e => {
        })
      },
      chooseWay(way) {
        this.wayType = way;
      },
      onSearch(){},
      //日期
        handleScheduleDateChange: function() {
            this.treatStateVal = 0
            this.patientStateVal = 0
            this.zoneVal = 0
            this.scheduleStateVal = 0
            this.search_keyword = this.search_input = ''
            // this.$store.dispatch("SaveDialysisAreaSelectIndexs", {
            //   zone: this.zone_selected,
            //   schedule_type: this.schedule_type_selected,
            //   schedule_date: this.selected_date,
            // })
            this.requestDialysisSchedules()
        },
        //初始化数据
        getInitData: function() {
          getDialysisRecordInitData().then(rs => {
            var resp = rs.data
            if (resp.state == 1) {
            var zones = resp.data.zones
            var schedules = resp.data.schedules
            var zone_options = [{ id: 0, text: '全部' }]
            for (let z_i = 0; z_i < zones.length; z_i++) {
                const zone = zones[z_i]
                zone_options.push({ id: zone.id, text: zone.name })
            }
            this.zone_options = zone_options
            this.zone_schedules = this.processedDialysisSchedules(schedules, this.zone_options)
            this.arr = this.processedDialysisSchedules(schedules, this.zone_options)
            this.getData()
            setTimeout(()=>{
              this.$refs.tab.setCurrentRow(this.tableData[0]);
            },10)
            let id = this.tableData[0].patient_id
            let date = this.tableData[0].schedule_date
            this.getScheduleDetail(id,date);
            } else {
              this.$message.error(resp.msg)
            }
          })
        },
        // 班次
        handletimeType: function(index) {
            this.scheduleStateVal = index
            // this.$store.dispatch('SetScheduleTypeSelected', { schedule_type_selected: index })
            this.search_keyword = this.search_input = ''
            this.getData()
        },
        //分区
        handleZoneChange: function(index) {
            this.zoneVal = index
            // this.$store.dispatch('SetZoneSelected', { zone_selected: index })
            this.search_keyword = this.search_input = ''
            this.getData()
        },
        //患者状态
        handleStateChange: function(index) {
            this.patientStateVal = index
            // this.$store.dispatch('SetPatientStateSelected', { patient_state_selected: index })
            this.search_keyword = this.search_input = ''
            this.getData()
        },
        handleTreatChange: function(index) {
            this.treatStateVal = index
            // this.$store.dispatch('SetTreatStateSelected', { treat_state_selected: index })
            this.search_keyword = this.search_input = ''
            this.getData()
        },
        processedDialysisSchedules: function(schedules, zone_options) {
            var zoneMap = {}
            var scheduleMap = {}
            for (let z_i = 0; z_i < zone_options.length; z_i++) {
                const zone = zone_options[z_i]
                if (zone.id == 0) {
                continue
                }
                scheduleMap[zone.id] = []
            }
            for (let index = 0; index < schedules.length; index++) {
                const schedule = schedules[index]
                scheduleMap[schedule.device_number.zone.id].push(schedule)
            }
            var zone_schedules = []
            for (let index = 0; index < zone_options.length; index++) {
                const zone = zone_options[index]
                if (zone.id == 0) {
                continue
                }
                var schedules = scheduleMap[zone.id]
                zone_schedules.push({ zone_id: zone.id, zone_name: zone.text, schedules: schedules })
            }
            return zone_schedules
        },
        searchAction: function() {
            this.search_keyword = this.search_input
            this.scheduleStateVal = 0
            this.zoneVal = 0
            this.treatStateVal = 0
            this.patientStateVal = 0
            if(this.search_input != ''){
              let arr = []
              this.filtedSchedules.map(item => {
                arr.push(...item.schedules)
              })
              this.tableData = arr
            }else{
                this.getData()
            }
        },
        requestDialysisSchedules: function() {
            var ymd = parseTime(this.selected_date, '{y}-{m}-{d}')
            getDialysisSchedules(ymd).then(rs => {
                var resp = rs.data
                if (resp.state == 1) {
                var schedules = resp.data.schedules
                this.zone_schedules = this.processedDialysisSchedules(schedules, this.zone_options)
                let newArr = []
                this.zone_schedules.map(item => {
                    newArr.push(...item.schedules)
                })
                this.tableData = newArr
                } else {
                this.$message.error(resp.msg)
                }
            })
        },
        changePatient(schedual){
          let id = schedual.patient_id
          let date = schedual.schedule_date
          this.getScheduleDetail(id,date);
        },
        getData(){
            let patientArr = []
            patientArr = JSON.parse(JSON.stringify(this.zone_schedules))
            console.log('patientArr',patientArr)
            let arr1 = []
            if(this.patientStateVal == 0){
                arr1 = patientArr
                console.log(arr1)
            }else if(this.patientStateVal == 1){
                let arr = []
                arr = patientArr
                for (let i = 0; i <arr.length; i++) {
                    for (let j = 0; j < arr[i].schedules.length; j++) {
                        if (arr[i].schedules.length > 0 && (arr[i].schedules[j].assessment_before_dislysis == null || (arr[i].schedules[j].assessment_before_dislysis.weight_before == '' && arr[i].schedules[j].assessment_before_dislysis.diastolic_blood_pressure == '' && arr[i].schedules[j].assessment_before_dislysis.systolic_blood_pressure == ''))) {
                            // 删除元素后改变i的值
                            arr[i].schedules.splice(j--, 1);
                        }
                    }
                }
                console.log("执行1",arr)
                arr1 = arr
            }else if(this.patientStateVal == 2){
                let arr = []
                arr = patientArr
                for (let i = 0; i < arr.length; i++) {
                    for (let j = 0; j < arr[i].schedules.length; j++) {
                        if (arr[i].schedules.length > 0 && (arr[i].schedules[j].assessment_before_dislysis != null && (arr[i].schedules[j].assessment_before_dislysis.weight_before != 0 || arr[i].schedules[j].assessment_before_dislysis.diastolic_blood_pressure != 0 || arr[i].schedules[j].assessment_before_dislysis.systolic_blood_pressure != 0))) {
                            // 删除元素后改变i的值
                            console.log('几次')
                            arr[i].schedules.splice(j--, 1);
                        }
                    }
                }
                console.log("执行2",arr)
                arr1 = arr
            }else if(this.patientStateVal == 3){
                let arr = []
                arr = patientArr
                for (let i = 0; i <arr.length; i++) {
                    for (let j = 0; j < arr[i].schedules.length; j++) {
                        if (arr[i].schedules.length > 0 && (arr[i].schedules[j].dialysis_order == null || (arr[i].schedules[j].dialysis_order != null && arr[i].schedules[j].dialysis_order.stage != 1))) {
                            // 删除元素后改变i的值
                            arr[i].schedules.splice(j--, 1);
                        }
                    }
                }
                console.log("执行1",arr)
                arr1 = arr
            }else if(this.patientStateVal == 4){
                let arr = []
                arr = patientArr
                for (let i = 0; i < arr.length; i++) {
                    for (let j = 0; j < arr[i].schedules.length; j++) {
                        if (arr[i].schedules.length > 0 && (arr[i].schedules[j].dialysis_order == null || (arr[i].schedules[j].dialysis_order != null && arr[i].schedules[j].dialysis_order.stage != 2))) {
                            // 删除元素后改变i的值
                            arr[i].schedules.splice(j--, 1);
                        }
                    }
                }
                console.log("执行2",arr)
                arr1 = arr
            }

            let arr2 = []
            if(this.treatStateVal == 0){
                arr2 = JSON.parse(JSON.stringify(arr1))
            }else if(this.treatStateVal == 1){
                let arr = []
                arr = JSON.parse(JSON.stringify(arr1))
                for (let i = 0; i < arr.length; i++) {
                    for (let j = 0; j < arr[i].schedules.length; j++) {
                        if (arr[i].schedules.length > 0 && (arr[i].schedules[j].prescription != null || arr[i].schedules[j].prescription != null ? arr[i].schedules[j].prescription.creater != 0 : false)) {
                            // 删除元素后改变i的值
                            arr[i].schedules.splice(j--, 1);
                        }
                    }
                }
                arr2 = arr
            }else if(this.treatStateVal == 2){
                let arr = []
                arr = JSON.parse(JSON.stringify(arr1))
                for (let i = 0; i < arr.length; i++) {
                    for (let j = 0; j < arr[i].schedules.length; j++) {
                        if (arr[i].schedules.length > 0 && arr[i].schedules[j].treatment_summary != null && arr[i].schedules[j].treatment_summary.dialysis_summary != '') {
                            // 删除元素后改变i的值
                            arr[i].schedules.splice(j--, 1);
                        }
                    }
                }
                arr2 = arr
            }
            

            let arr3 = []
            if(this.scheduleStateVal == 0){
                arr3 = JSON.parse(JSON.stringify(arr2))
            }else{
                let arr = []
                arr = JSON.parse(JSON.stringify(arr2))
                for (let i = 0; i < arr.length; i++) {
                    for (let j = 0; j < arr[i].schedules.length; j++) {
                        if (this.scheduleStateVal != arr[i].schedules[j].schedule_type) {
                            // 删除元素后改变i的值
                            arr[i].schedules.splice(j--, 1);
                        }
                    }
                }
                arr3 = arr
                console.log("上午",arr)
            }
            

            let arr4 = []
            if(this.zoneVal == 0){
                arr4 = JSON.parse(JSON.stringify(arr3))
            }else{
                let arr = []
                arr = JSON.parse(JSON.stringify(arr3))
                for (let i = 0; i < arr.length; i++) {
                    if (this.zoneVal != arr[i].zone_id) {
                    // 删除元素后改变i的值
                    arr.splice(i--, 1);
                    }
                }
                arr4 = arr
            }
            let newArr = []
            arr4.map(item => {
            newArr.push(...item.schedules)
            })
            this.tableData = newArr
            console.log('table',this.tableData)
        },
        getScheduleDetail: function(id,date) {
          var dateStr = parseTime(date, '{y}-{m}-{d}')
          this.doctor_advices = []
          getDialysisScheduleDetail(id, dateStr).then(rs => {
            var resp = rs.data
            if (resp.state == 1) {
              var patient = resp.data.patient // 患者信息
              var schedual = resp.data.schedual // 患者排班信息
              var prescription = resp.data.prescription // 透析处方
              if (prescription != null) {
                if (prescription.body_fluid == -2) {
                  prescription.body_fluid = 0
                }

              }
              console.log('透析处方', prescription)
              var solution = resp.data.solution // 透析方案
              var receiver_treatment_access = resp.data.receiver_treatment_access // 接诊评估
              console.log('receiver_treatment_access', receiver_treatment_access)
              var predialysis_evaluation = resp.data.predialysis_evaluation // 透前评估
              console.log('透前评估', predialysis_evaluation)
              if (predialysis_evaluation != null) {
                if (predialysis_evaluation.blood_access_part_id == -2) {
                  predialysis_evaluation.blood_access_part_id = 0
                }
              }
              var doctor_advices = resp.data.doctor_advices // 临时医嘱
              // console.log("力气-------", doctor_advices);
              var double_check = resp.data.double_check // 双人核对
              var assessment_after_dislysis = resp.data.assessment_after_dislysis // 透后评估
              // console.log("透后品谷数", assessment_after_dislysis);
              var treatment_summary = resp.data.treatment_summary // 治疗小结
              var monitor_records = resp.data.monitor_records // 透析监测
              var dialysis_order = resp.data.dialysis_order // 透析记录

              var niprocart_info = resp.data.niprocart_info
              var jms_info = resp.data.jms_info
              var fistula_needle_set_info = resp.data.fistula_needle_set_info
              var fistula_needle_set_16_info = resp.data.fistula_needle_set_16_info
              var hemoperfusion_info = resp.data.hemoperfusion_info
              var dialyser_sterilised_info = resp.data.dialyser_sterilised_info
              var filtryzer_info = resp.data.filtryzer_info
              var dialyzers_info = resp.data.dialyzers_info
              var injector_info = resp.data.injector_info
              var bloodlines_info = resp.data.bloodlines_info
              var tubingHemodialysis_info = resp.data.tubingHemodialysis_info
              var safe_package_info = resp.data.safe_package_info
              var aliquid_info = resp.data.aliquid_info

              var lastPredialysisEvaluation = resp.data.lastPredialysisEvaluation
              console.log('上次透前评估', lastPredialysisEvaluation)
              if (lastPredialysisEvaluation != null) {
                if (lastPredialysisEvaluation.blood_access_part_id == -2) {
                  lastPredialysisEvaluation.blood_access_part_id = 0
                }
              }
              var lastMonitorRecord = resp.data.lastMonitorRecord
              var lastAssessmentAfterDislysis =
                resp.data.lastAssessmentAfterDislysis
              var lastDialysisPrescribe = resp.data.lastDialysisPrescribe
              var lastDryWeightDislysis = resp.data.lastDryWeightDislysis

              var system_prescribe = resp.data.system_prescribe

              // this.$refs.nav.setLastRecord(
              //   lastPredialysisEvaluation,
              //   lastMonitorRecord,
              //   lastAssessmentAfterDislysis,
              //   lastDialysisPrescribe,
              //   lastDryWeightDislysis,
              //   schedual,
              //   system_prescribe
              // )
              

              var headNurses = resp.data.headNurse

              var config = resp.data.config
              this.lastPredialysisEvaluation = lastPredialysisEvaluation
              this.lastMonitorRecord = lastMonitorRecord
              this.lastAssessmentAfterDislysis = lastAssessmentAfterDislysis
              this.lastDialysisPrescribe = lastDialysisPrescribe
              this.lastDryWeightDislysis = lastDryWeightDislysis
              this.headNurses = headNurses
              this.system_prescribe = system_prescribe

              this.niprocart_info = niprocart_info
              this.jms_info = jms_info
              this.fistula_needle_set_info = fistula_needle_set_info
              this.fistula_needle_set_16_info = fistula_needle_set_16_info
              this.hemoperfusion_info = hemoperfusion_info
              this.dialyser_sterilised_info = dialyser_sterilised_info
              this.filtryzer_info = filtryzer_info
              this.dialyzers_info = dialyzers_info
              this.injector_info = injector_info
              this.bloodlines_info = bloodlines_info
              this.tubingHemodialysis_info = tubingHemodialysis_info
              this.safe_package_info = safe_package_info
              this.aliquid_info = aliquid_info
              this.config = config

              this.patient = patient
              this.schedual = schedual == null ? { id: 0 } : schedual
              this.prescription = prescription == null ? { id: 0 } : prescription
              this.solution = solution == null ? { id: 0 } : solution
              this.receiver_treatment_access =
                receiver_treatment_access == null
                  ? { id: 0 }
                  : receiver_treatment_access
              this.predialysis_evaluation =
                predialysis_evaluation == null ? { id: 0 } : predialysis_evaluation
              this.doctor_advices = doctor_advices == null ? [] : doctor_advices
              this.double_check = double_check == null ? { id: 0 } : double_check
              this.assessment_after_dislysis =
                assessment_after_dislysis == null
                  ? { id: 0 }
                  : assessment_after_dislysis
              this.treatment_summary =
                treatment_summary == null ? { id: 0 } : treatment_summary
              this.monitor_records = monitor_records == null ? [] : monitor_records
              this.dialysis_order =
                dialysis_order == null ? { id: 0 } : dialysis_order

              // this.$refs.stat_order.setAdvices(this.doctor_advices)
              // this.$refs.monitoring.setRecords(this.monitor_records)

              this.admin_users = resp.data.doctors
              this.devices = resp.data.devices
              this.device_numbers = resp.data.device_numbers

              var device_map = {}
              for (let index = 0; index < this.devices.length; index++) {
                const device = this.devices[index]
                device_map[device.id] = device
              }
              this.device_map = device_map

              var admin_map = {}
              for (let index = 0; index < this.admin_users.length; index++) {
                const admin = this.admin_users[index]
                admin_map[admin.id] = admin
              }
              this.admin_user_map = admin_map

              var device_number_map = {}
              for (let index = 0; index < this.device_numbers.length; index++) {
                const device_number = this.device_numbers[index]
                device_number_map[device_number.id] = device_number
              }
              this.device_number_map = device_number_map
            } else {
              this.$message.error(resp.msg)
            }

            if (this.lastDialysisPrescribe != null) {
              delete this.lastDialysisPrescribe.target_ultrafiltration
            }
            if (this.solution != null) {
              delete this.solution.target_ultrafiltration
            }
          })
        },
    },
  }
</script>

<style lang="scss" scoped>
.fastProvince{
  .newUl{
    li{
      padding:10px 20px !important;
    }
  }
}
.tableTitle {
  font-size: 16px;
  color: #000;
  font-weight: bold;
  line-height: 40px;
}
</style>
<style lang="scss">
.fastProvince{
  .el-form-item{
    margin-bottom: 0;
  }
  // .el-button--medium{
  //   padding: 10px 6px;
  // }
}
.newContainer{
  display: flex;
    .el-date-editor{
        .el-input__inner{
            padding-right:0px;
        }
    }
    .el-table td, .el-table th{
      text-align: center;
    }
    .el-tabs--border-card{
      box-shadow:none;
    }
}
.el-tabs--border-card>.el-tabs__header .el-tabs__item.is-active{
  font-weight: bold;
}
</style>
