<template>
    <div class="page_consumables">
      <div class="cell clearfix">
        <label class="title"> <span class="name">排班班次</span> : </label>
        <div class="time">
          <ul class>
            <li
              :class="item.value == schedulType ? 'active' : ''"
              @click="selectSchedulType(item.value)"
              v-for="item in schedulArr"
              :key="item.value"
            >
              {{ item.label }}
            </li>
          </ul>
        </div>
  
        <label class="title"><span class="name">日期查询</span> : </label>
        <el-date-picker size="small" v-model="selected_date" prefix-icon="el-icon-date" @change="handleScheduleDateChange"
                        :editable="false" :clearable="false" style="width: 196px;margin-right:10px;" type="date"
                        format="yyyy-MM-dd"
                        value-format="yyyy-MM-dd"
                        placeholder="选择日期时间" align="right"
                        ></el-date-picker>
        <el-input size="small" style="width: 180px;" @keyup.enter.native='searchAction' v-model.trim="search_input"
                  class="filter-item" v-model="query.keywords"/>
        <el-button size="small" class="filter-item" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
      </div>
      <div class="cell clearfix" style="justify-content: space-between;">
        <label class="title"><span class="name">分区</span> : </label>
        <el-select v-model="partition_id" multiple  placeholder="请选择分区" style="margin-left:-400px"  @change="selectPartitionType">
          <el-option
            v-for="item in partitionArrOne"
            :key="item.id"
            :label="item.name"
            :value="item.id">
          </el-option>
        </el-select>
        <div>
          <el-button size="small" icon="el-icon-printer" @click="toDialog" type="primary">设置</el-button>
          <el-button size="small"  @click="toStatic" type="primary">汇总</el-button>
          <el-button size="small"  @click="toPrint" icon="el-icon-printer" type="primary">打印</el-button>
          <!-- <el-button size="small" type="primary" @click="statistics">统计表</el-button> -->
          
        </div>
      </div>
    
      <div>
        <el-table
          :data="list"
          border
          :row-style="{ color: '#303133' }"
          :header-cell-style="{
            backgroundColor: 'rgb(245, 247, 250)',
            color: '#606266'
          }"
         @selection-change="handleSelectionChange"
        >
          <el-table-column align="center"  type="selection" width="55">
          </el-table-column>
          <el-table-column align="center" label="序号" width="55" v-if="gatherSetting.index_number == 1">
             <template slot-scope="scope">
               {{scope.$index + 1}}
             </template>
          </el-table-column>
          <el-table-column align="center" label="姓名" v-if="gatherSetting.name==1">
             <template slot-scope="scope">
              {{scope.row.patient.name}}
             </template>
          </el-table-column>

          <el-table-column align="center" label="透析号" v-if="gatherSetting.dialysis_no==1">
             <template slot-scope="scope">
              {{scope.row.patient.dialysis_no}}
             </template>
          </el-table-column>

        
          <el-table-column align="center" label="住院(门诊)号"  v-if="gatherSetting.admission_number==1">
             <template slot-scope="scope">
               {{scope.row.patient.admission_number}}
             </template>
          </el-table-column>

      
          <el-table-column align="center" label="透析模式" v-if="gatherSetting.mode_type==1">
             <template slot-scope="scope">
              <span v-if="scope.row.mode_id == 1">HD</span>
              <span v-if="scope.row.mode_id == 2">HDF</span>
              <span v-if="scope.row.mode_id == 3">HD+HP</span>
              <span v-if="scope.row.mode_id == 4">HP</span>
              <span v-if="scope.row.mode_id == 5">HF</span>
              <span v-if="scope.row.mode_id == 6">SCUF</span>
              <span v-if="scope.row.mode_id == 7">IUF</span>
              <span v-if="scope.row.mode_id == 8">HFHD</span>
              <span v-if="scope.row.mode_id == 9">HFHD+HP</span>
              <span v-if="scope.row.mode_id == 10">PHF</span>
              <span v-if="scope.row.mode_id == 11">HFR</span>
              <span v-if="scope.row.mode_id == 12">HDF+HP</span>
              <span v-if="scope.row.mode_id == 13">CRRT</span>
              <span v-if="scope.row.mode_id == 19">IUF+HD</span>
              <span v-if="scope.row.mode_id == 20">UF</span>
              <span v-if="scope.row.mode_id == 21">HD+</span>
              <span v-if="scope.row.mode_id == 22">血浆胆红素吸附+HDF</span>
              <span v-if="scope.row.mode_id == 23">血浆胆红素吸附</span>
              <span v-if="scope.row.mode_id == 24">I-HDF</span>
              <span v-if="scope.row.mode_id == 25">HD高通F</span>
              <span v-if="scope.row.mode_id == 26">CVVH</span>
              <span v-if="scope.row.mode_id == 27">CVVHD</span>
              <span v-if="scope.row.mode_id == 28">CVVHDF</span>
              <span v-if="scope.row.mode_id == 29">PE</span>
              <span v-if="scope.row.mode_id == 30">血浆胆红素吸附+HP</span>
              <span v-if="scope.row.mode_id == 31">HPD</span>
              <span v-if="scope.row.mode_id == 32">HDP</span>
              <span v-if="scope.row.mode_id == 33">HFD</span>
              <span v-if="scope.row.mode_id == 34">HDF100</span>
              <span v-if="scope.row.mode_id == 35">HDF600</span>
              <span v-if="scope.row.mode_id == 36">HDF800</span>
              <span v-if="scope.row.mode_id == 37">HDF1000</span>
             </template>
          </el-table-column>
             
          <el-table-column align="center" label="透析器"  v-if="gatherSetting.dialysis_dialyszers == 1">
             <template slot-scope="scope">
               <span v-if="scope.row.schedule_date == timenow">{{scope.row.dialysis_prescription.dialysis_dialyszers}}</span>

               <span v-if="scope.row.schedule_date < timenow">{{scope.row.dialysis_solution.dialysis_dialyszers}}</span>

               <span v-if="scope.row.schedule_date > timenow">{{scope.row.dialysis_solution.dialysis_dialyszers}}</span>
             </template>
          </el-table-column>
  
           <el-table-column align="center" label="灌流器"  v-if="gatherSetting.dialysis_irrigation ==1">
             <template slot-scope="scope">

               <span v-if="scope.row.schedule_date == timenow">{{scope.row.dialysis_prescription.dialysis_irrigation}}</span>
               <span v-if="scope.row.schedule_date < timenow">{{scope.row.dialysis_solution.dialysis_irrigation}}</span>
               <span v-if="scope.row.schedule_date > timenow">{{scope.row.dialysis_solution.dialysis_irrigation}}</span>

             </template>
          </el-table-column>
  
          <el-table-column align="center" label="滤过器"  v-if="gatherSetting.dialysis_strainer ==1">
             <template slot-scope="scope">
              
               <span v-if="scope.row.schedule_date == timenow">{{scope.row.dialysis_prescription.dialysis_strainer}}</span>
               <span v-if="scope.row.schedule_date<timenow">{{ scope.row.dialysis_solution.dialysis_strainer }}</span>
               <span v-if="scope.row.schedule_date>timenow">{{ scope.row.dialysis_solution.dialysis_strainer }}</span>
             </template>
          </el-table-column>


          <el-table-column align="center" label="换药包/穿刺针"  v-if="gatherSetting.change_nurse ==1">
             <template slot-scope="scope">
              
               <span v-if="(getBloodAccessOption(scope.row.dialysis_prescription.blood_access)).indexOf('导管')!=-1">1</span>
               <span v-if="(getBloodAccessOption(scope.row.dialysis_prescription.blood_access)).indexOf('导管')==-1">0</span>
                /
               <span v-if="(getBloodAccessOption(scope.row.dialysis_prescription.blood_access)).indexOf('内瘘')==-1">0</span>
               <span v-if="(getBloodAccessOption(scope.row.dialysis_prescription.blood_access)).indexOf('内瘘')!=-1">1</span>
             </template>
          </el-table-column>




          <el-table-column align="center" label="抗凝剂(首剂)(维持)(总量)"  v-if="gatherSetting.anticoagulant==1">
             <template slot-scope="scope">
               <span>{{getAnticoagualnt(scope.row.dialysis_prescription.anticoagulant)}}</span>
               <span v-if="scope.row.dialysis_prescription.anticoagulant_shouji > 0">({{scope.row.dialysis_prescription.anticoagulant_shouji}})</span>
               <span v-if="scope.row.dialysis_prescription.anticoagulant_weichi > 0">({{scope.row.dialysis_prescription.anticoagulant_weichi}})</span>
               <span v-if="scope.row.dialysis_prescription.anticoagulant_zongliang > 0">({{scope.row.dialysis_prescription.anticoagulant_zongliang}})</span>
             </template>
          </el-table-column>

          <el-table-column align="center" label="封管液" v-if="gatherSetting.tube==1">
             <template slot-scope="scope">
               <span v-if="getBloodAccessOption(scope.row.dialysis_prescription.blood_access).indexOf('导管')!==-1">1</span>
             </template>
          </el-table-column>
          
  
          <el-table-column align="center" label="钾"  v-if="gatherSetting.kalium==1">
             <template slot-scope="scope">
               <span v-if="scope.row.dialysis_prescription.kalium>0">{{scope.row.dialysis_prescription.kalium}}</span>
             </template>
          </el-table-column>
  
      
          <el-table-column align="center" label="钙" v-if="gatherSetting.calcium==1">
             <template slot-scope="scope">
               <span v-if="scope.row.dialysis_prescription.calcium>0">{{scope.row.dialysis_prescription.calcium}}</span>
             </template>
          </el-table-column>
  
  
          <el-table-column align="center" label="促红素" v-if="gatherSetting.cuhong == 1">
             <template slot-scope="scope">
                {{ scope.row.advice_spc }}
             </template>
          </el-table-column>

          <el-table-column align="center" label="左卡" v-if="gatherSetting.zuoka == 1">
             <template slot-scope="scope">
                {{ scope.row.advice_spc_one }}
             </template>
          </el-table-column>

          <el-table-column align="center" label="尿激酶" v-if="gatherSetting.niaojimei == 1">
             <template slot-scope="scope">
                {{ scope.row.advice_spc_two }}
             </template>
          </el-table-column>


          <el-table-column align="center" label="葡萄糖酸钙" v-if="gatherSetting.putaosuangai == 1">
             <template slot-scope="scope">
                {{ scope.row.advice_spc_three }}
             </template>
          </el-table-column>
        
  
          
        </el-table>
  
        <el-dialog
          title="统计类型设置"
          :visible.sync="dialogVisible"
          width="30%">
          <span>
             <el-checkbox v-model="index_number" label="序号"></el-checkbox>
             <el-checkbox v-model="zone" label="分区"></el-checkbox>
             <el-checkbox v-model="number" label="机号"></el-checkbox>
             <el-checkbox v-model="birth" label="出生日期"></el-checkbox>
             <el-checkbox v-model="name" label="姓名"></el-checkbox>
             <el-checkbox v-model="age" label="年龄"></el-checkbox>
             <el-checkbox v-model="mode_type" label="透析方式"></el-checkbox>
             <el-checkbox v-model="prescription_status" label="处方状态"></el-checkbox>
             <el-checkbox v-model="admission_number" label="住院号(门诊号)"></el-checkbox>
          
             <el-checkbox v-model="dialysis_no" label="透析号"></el-checkbox>
             <el-checkbox v-model="dry_weight" label="干体重"></el-checkbox>
             <el-checkbox v-model="dialysis_dialyszers" label="透析器"></el-checkbox>
             <el-checkbox v-model="dialysis_strainer" label="滤过器"></el-checkbox>
             <el-checkbox v-model="dialysis_irrigation" label="灌流器"></el-checkbox>
             <el-checkbox v-model="calcium" label="钙"></el-checkbox>
             <el-checkbox v-model="kalium" label="钾"></el-checkbox>
           
             <el-checkbox v-model="change_nurse" label="换药包"></el-checkbox>
             <el-checkbox v-model="puncture_needle" label="穿刺针"></el-checkbox>
             <el-checkbox v-model="anticoagulant" label="抗凝剂"></el-checkbox>
             <el-checkbox v-model="tube" label="封管液"></el-checkbox>
             <el-checkbox v-model="cuhong" label="促红素(医嘱)"></el-checkbox>
             <el-checkbox v-model="zuoka" label="左卡尼汀(医嘱)"></el-checkbox>
             <el-checkbox v-model="zhetangtie" label="蔗糖铁(医嘱)"></el-checkbox>
             <el-checkbox v-model="paligu" label="帕立骨化醇(医嘱)"></el-checkbox>
             <el-checkbox v-model="guhuachun" label="骨化三醇(医嘱)"></el-checkbox>
             <el-checkbox v-model="niaojimei" label="尿激酶(医嘱)"></el-checkbox>
             <el-checkbox v-model="putaosuangai" label="葡萄糖酸钙(医嘱)"></el-checkbox>
             <el-checkbox v-model="jiaguan" label="甲钴胺注射液(医嘱)"></el-checkbox>
             <el-checkbox v-model="xiongxiewutai" label="胸腺五肽(医嘱)"></el-checkbox>
          </span>
          <span slot="footer" class="dialog-footer">
            <el-button @click="dialogVisible = false">取 消</el-button>
            <el-button type="primary" @click="saveGatherSetting">确 定</el-button>
         </span>
        </el-dialog>
  
  
 
  
      </div>
  
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :page-sizes="[100, 200, 300,500,1000]"
        :page-size="100"
        background
        align="right"
        style="margin-top:20px;"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      >
      </el-pagination>
  
  
     <el-dialog
        title="透析参数统计表"
        :visible.sync="startdialogVisible"
        width="70%">
        <span>
          <div class="cell clearfix">
            <label class="title"> <span class="name">排班班次</span> : </label>
             <el-select v-model="schedule_type" placeholder="请选择" @change="changeScheduleType">
              <el-option
                v-for="item in schedulArr"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
             </el-select>
             <label class="title"> <span class="name">病区选择</span> : </label>
             <el-select v-model="partion_type" placeholder="请选择" @change="changePartionType">
              <el-option
                v-for="item in partitionArr"
                :key="item.id"
                :label="item.name"
                :value="item.id">
              </el-option>
             </el-select>
             <el-button size="small" @click="toPrintOne" icon="el-icon-printer" type="primary">打印</el-button>
             <el-button size="small"  @click="exportListOne" type="primary">导出</el-button>
          </div> 
         <el-table
          :data="tableList"
          border
          :row-style="{ color: '#303133' }"
          :header-cell-style="{
            backgroundColor: 'rgb(245, 247, 250)',
            color: '#606266'
          }"
        >
           <el-table-column  align="center"  label="序号">
             <template slot-scope="scope">
                {{scope.$index+1}}
             </template>
          </el-table-column>
          <el-table-column  align="center"   label="名称">
           <template slot-scope="scope">
               {{scope.row.name}}
           </template>
          </el-table-column>
          <el-table-column  align="center"  label="规格">
             <template slot-scope="scope">
               {{scope.row.specification_name}}
             </template>
          </el-table-column>
         
          <el-table-column  align="center"   label="数量">
             <template slot-scope="scope">
              {{scope.row.count}}
             </template>
          </el-table-column>
          
       
  
        </el-table>
        </span>
        <span slot="footer" class="dialog-footer">
          <el-button @click="startdialogVisible = false">取 消</el-button>
          <el-button type="primary" @click="startdialogVisible = false">确 定</el-button>
        </span>
      </el-dialog>

      <el-dialog
          title="统计"
          :visible.sync="startDialogVisibleOne"
          width="50%">
          <span>
            <div>
              <el-button size="small" @click="printThisInfo" icon="el-icon-printer" type="primary" style="float:right;margin-bottom: 10px;">打印</el-button>
            </div>
            <el-table
              :data="tableListOne"
              border
              style="width: 100%">
              <el-table-column prop="date" label="序号" align="center">
                <template slot-scope="scope">
                  {{scope.$index+1}}
                </template>
              </el-table-column>
              <el-table-column prop="name" label="名称" align="center">
                <template slot-scope="scope">
                    {{ scope.row.name }}
                </template>
              </el-table-column>

              <el-table-column prop="name" label="数量" align="center">
                <template slot-scope="scope">
                  {{ scope.row.count }}
                </template>
              </el-table-column>
            </el-table>
          </span>
          <span slot="footer" class="dialog-footer">
            <el-button @click="startDialogVisibleOne = false">取 消</el-button>
            <el-button type="primary" @click="startDialogVisibleOne = false">确 定</el-button>
          </span>
      </el-dialog>


      <div style="display: none">
      <div id="print-info-box">
        <div class="print_main_content" >
          <div >
            <table >
              <tbody>
                <tr>
                 
                  <td style="width:8%;padding: 3px 0px;font-size: 17px;font-weight: 500;">
                    序号
                 
                  </td> 
                  <td style="padding: 3px 0px;font-size: 17px;">
                    名称
                  </td>
                  <td style="padding: 3px 0px;font-size: 17px;">
                    数量
                  </td>
                 
                </tr>

                <tr  v-for="(it,index) in tableListOne">
                 
                 <td style="width:8%;padding: 3px 0px;font-size: 17px;font-weight: 500;">
                    {{ index +1 }}
                 </td> 
                 <td style="padding: 3px 0px;font-size: 17px;">
                    {{ it.name }}
                 </td>
                 <td style="padding: 3px 0px;font-size: 17px;">
                     {{it.count }}
                 </td>
                
               </tr>

              </tbody>
            </table>
     
          </div>
        </div>
      </div>
    </div>
    </div>
  </template>
  
  
  <script>
    import { GetAllZone,saveGatherSetting,getGatherSetting,getDialysisGatherList,getDialysisParameterGoodList } from '@/api/dialysis'
    import { uParseTime } from "@/utils/tools";
    import {getRemindPrintList,saveRemindPrint} from '@/api/schedule'
    import { getDataConfig } from '@/utils/data'
    const moment = require('moment')
    import store from "@/store";
    export default {
      components: {
        
      },
      data() {
        return {
          query:{
            total:"",
            schedule_date:"",
            schedule_type:0,
            partition_id:0,
            page:1,
            limit:100,
            keywords:"",
            good_type:0,
            ids:"",
          },
          schedulType: 0,
          schedulArr: [
            { value: 0, label: '全部' },
            { value: 1, label: '上午' },
            { value: 2, label: '下午' },
            { value: 3, label: '晚上' }
          ],
          selected_date: "",
          partitionArr: [],
          goodList:[
            { id: 0, name: '全部' },
            { id: 1, name: '已出库' },
            { id: 2, name: '未出库' },
          ],
          partitionType: 0,
          goodType:0,
          tableData: [{
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1518 弄'
          }
          ],
          search_input: '',
          searchAction: '',
          allGoodInfo:[],
          list:[],
          new_list:[],
  
          good_types: [],
          arrKey:[],
          arrList:[],
          total:0,
          dialogVisible:false,
          predialysisConditionOptions:[],
          index_number:false,
          prescription_status:false,
          admission_number:false,
          dialysis_no:false,
          dry_weight:false,
          dialysis_dialyszers:false,
          dialysis_strainer:false,
          dialysis_irrigation:false,
          calcium:false,
          age:false,
          mode_type:false,
          zone:false,
          number:false,
          birth:false,
          name:false,
          age:false,
          change_nurse:false,
          puncture_needle:false,
          anticoagulant:false,
          anticoagulant:false,
          zhetangtie:false,
          paligu:false,
          cuhong:false,
          zuoka:false,
          zhetangtie:false,
          niaojimei:false,
          guhuachun:false,
          jiaguan:false,
          putaosuangai:false,
          xiongxiewutai:false,
          paligu:false,
          tube:false,
          schedule_type:0,
          partion_type:0,
          tableList:[],
          tableListOne:[
            {name:"换药包",count:0},
            {name:"穿刺包",count:0}
          ],
          dialysisSett:{},
          partitionArrOne:[],
          dialogVisibleOne: false,
          prescription_status: false,
          week: false,
          name: false,
          zone_name: false,
          classes: false,
          number: false,
          mode: false,
          dialyzers: false,
          perfusion_apparatus: false,
          anticoagulant: false,
          anticoagulant_zongliang: false,
          doctor_advice: false,
          kalium:false,
          startdialogVisible:false,
          displace_liqui_part_option:[],
          ids:"",
        
          form: {
            id: 0,
            prescription_status: '',
            week: '',
            name: '',
            zone: '',
            classes: '',
            number: '',
            mode: '',
            dialyzers: '',
            perfusion_apparatus: '',
            anticoagulant: '',
            anticoagulant_zongliang: '',
            doctor_advice: ''
          },
          pickerOptions:{ //禁用当前日期之前的日期
             disabledDate(v) {
              //Date.now()是javascript中的内置函数，它返回自1970年1月1日00:00:00 UTC以来经过的毫秒数。
              return v.getTime() < new Date().getTime() - 86400000;
            },
          },
          partition_id:0,
          zoneList:[],
          gatherSetting:{},
          timenow:0,
          startDialogVisibleOne:false,
        }
      },
      open(){
        console.log("寄哪里地方到付阿道夫")
      },
      created() {
         this.blood_access_option  = getDataConfig('hemodialysis', 'vascular_access_desc')
         this.displace_liqui_part_option = this.$store.getters.displace_liqui
      
         var filedList = store.getters.xt_user.fileds
         var newArr = [
          {value:999999,filed_name_cn:"姓名"},
          {value:888888,filed_name_cn:"透析号"},
          {value:777777,filed_name_cn:"透析机号"}
          ]
         for (let i = 0; i < filedList.length; i++) {
          if (filedList[i].module == 1 && filedList[i].is_show == 1) {
             newArr.push(filedList[i])
          }
          if (filedList[i].module == 3 && filedList[i].is_show == 1 &&(filedList[i].filed_name_cn == "干体重"  || filedList[i].filed_name_cn == "透前称重" || filedList[i].filed_name_cn == "收缩压" || filedList[i].filed_name_cn == "舒张压" )) {
             newArr.push(filedList[i])
          }
          this.predialysisConditionOptions = newArr
         }
        let date = uParseTime(new Date(), "{y}-{m}-{d}")
        var newDate = new Date();
        var y = newDate.getFullYear();
        var m = newDate.getMonth() + 1;
        var d = newDate.getDate();
        var schedule_date =
          y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d);
  
        this.selected_date = date
        this.query.schedule_date = schedule_date
        this.query.schedule_type = 0
        this.query.partition_id = 0
        this.query.page = 1
        this.getAllZone()
        
        let dateone =  moment().format('YYYY-MM-DD')//获取标准时间 //Tue Aug 16 2022 15:06:24 GMT+0800 (中国标准时间)
        //方式一
        let timeStampOne = Date.parse(dateone)
        
        var arrDateTwo = (timeStampOne/1000)-28800

        console.log("时间搓2222",arrDateTwo)

        this.timenow = arrDateTwo
       
       
      },
      methods: {
        getlist(){
        
          
          var str = ""
           if(this.partition_id==0){
              str = this.zoneList.join(",")
           }
  
           if(this.partition_id!=0){
             str = this.partition_id.join(",")
           }
           this.query.partition_id = ""
           this.query.partition_id = str 
        
           getDialysisGatherList(this.query).then(response=>{
              if(response.data.state == 1){
                var list = response.data.data.list
                this.gatherSetting = response.data.data.gatherSetting
                console.log("设置",this.gatherSetting)
                if(list!=null &&list.length>0){
                  var total_one =0
                  var total_two =0
                  for(let i=0;i<list.length;i++){
                    list[i].sort = 0
                    list[i].sort = list[i].device_number.sort
                    if(this.getBloodAccessOption(list[i].dialysis_prescription.blood_access).indexOf("导管")!=-1){
                         total_one ++
                    }
                    if(this.getBloodAccessOption(list[i].dialysis_prescription.blood_access).indexOf('内瘘')==-1){
                        total_two ++
                    }
                  }

                  this.tableListOne[0].count =total_one
                  this.tableListOne[1].count = total_two
        
                }
                list.sort(this.compare('sort'))
              
  
                for(let i=0;i<list.length;i++){
                  list[i].advice_spc =""
                  list[i].advice_spc_one =""
                  list[i].advice_spc_two =""
                  list[i].advice_spc_three = ""
                   for(let j=0;j<list[i].advice.length;j++){
                       if((list[i].advice[j].advice_name).indexOf("促红")!=-1){
                          list[i].advice_spc+= (list[i].advice[j].single_dose + list[i].advice[j].single_dose_unit+"/"+ list[i].advice[j].prescribing_number_unit)+","
                       }

                       if((list[i].advice[j].advice_name).indexOf("左卡")!=-1){
                          list[i].advice_spc_one+= (list[i].advice[j].single_dose + list[i].advice[j].single_dose_unit+"/"+ list[i].advice[j].prescribing_number_unit)+","
                       }

                       if((list[i].advice[j].advice_name).indexOf("尿激酶")!=-1){
                          list[i].advice_spc_two+= (list[i].advice[j].single_dose + list[i].advice[j].single_dose_unit+"/"+ list[i].advice[j].prescribing_number_unit)+","
                       }

                       if((list[i].advice[j].advice_name).indexOf("葡萄糖酸钙")!=-1){
                          list[i].advice_spc_three+= (list[i].advice[j].single_dose + list[i].advice[j].single_dose_unit+"/"+ list[i].advice[j].prescribing_number_unit)+","
                       }

                   }
                }
                console.log("listwowowowowowo日本",this.list)
                this.list = list
                this.total = response.data.data.total
              
              }
          }) 
        },
        compare(p) { //这是比较函数
          return function (m, n) {
            var a = m[p];
            var b = n[p];
            return a - b; //升序
          }
        },
        handleSizeChange(val) {
          this.query.limit = val;
          this.getlist();
        },
        handleCurrentChange(val) {
          this.query.page = val;
          this.getlist();
        },
  
        calCount(query_warehouseout_info) {
          let total = 0
          var array = []
          array = query_warehouseout_info
          for (let i = 0; i < array.length; i++) {
            total = total + array[i].count
          }
          return total
  
        },
        getGoodUserInfo(good_type_id,good_user,last_good_user) {
          var arrlist =[]
          if (good_user != null && good_user.length > 0) {
            let desc = ""
            for (let b = 0; b < good_user.length; b++){
              if(good_type_id == good_user[b].good_type_id)
                desc = desc + "\n" + good_user[b].info.specification_name +"*" +good_user[b].count
            }
            arrlist.push(desc)
            return desc
          }
          return ""

        },
     
        selectSchedulType(scheduleType) {
          this.schedulType = scheduleType
          this.query.schedule_type = scheduleType
          this.query.page = 1
          this.getlist()
  
        },
        selectPartitionType(partitionType) {
          // this.partitionType = partitionType
          this.query.partition_id = partitionType
          this.query.page = 1
  
          this.getlist()
  
        },
        selectGoodType(goodType){
          this.goodType = goodType
          this.query.good_type = goodType
          this.getlist()
        },
        getAllZone: function() {
          GetAllZone().then(response => {
            if (response.data.state == 0) {
              this.$message.error(response.data.msg)
              return false
            } else {
             
  
              for(let i=0;i<response.data.data.zone.length;i++){
                 this.partitionArrOne.push(response.data.data.zone[i])
                 this.zoneList.push(response.data.data.zone[i].id)
              }
              this.partitionArr = response.data.data.zone
             
              console.log("全部中",this.partitionArrOne)
              this.partitionArr.unshift({ id: 0, name: '全部' })
              this.getlist()
              
            }
          })
        },
        statistics() {
           this.tableList = []
         
           var params = {
            schedule_type:this.schedule_type,
            partion_type:this.partitionType,
            selected_date:this.query.schedule_date,
          }
          getDialysisParameterGoodList(params).then(response=>{
             if(response.data.state == 1){
              this.startdialogVisible = true
              var list = response.data.data.list
              var anticoagulantList = []
              if(list!=null && list.length>0){
                for(let i=0;i<list.length;i++){
                   list[i].dialysis_dialyszers_arr = []
                   list[i].dialyzer_perfusion_apparatus_arr = []
                   list[i].dialysis_irrigation_arr = []
                   list[i].dialysis_strainer_arr =[]
                   if(list[i].dialysis_solution.dialysis_dialyszers!=""){
                     list[i].dialysis_dialyszers_arr = list[i].dialysis_solution.dialysis_dialyszers.split(",")
                   }
                   if(list[i].dialysis_solution.dialyzer_perfusion_apparatus!=""){
                     list[i].dialyzer_perfusion_apparatus_arr = list[i].dialysis_solution.dialyzer_perfusion_apparatus.split(",")
                   }
                   if(list[i].dialysis_solution.dialysis_irrigation!=""){
                     list[i].dialysis_irrigation_arr = list[i].dialysis_solution.dialysis_irrigation.split(",")
                   }
                   if(list[i].dialysis_solution.dialysis_strainer!=""){
                      list[i].dialysis_strainer_arr = list[i].dialysis_solution.dialysis_strainer.split(",")
                   }
  
                  
                   if(list[i].dialysis_solution.anticoagulant == 1){
                      anticoagulantList.push(list[i].dialysis_solution)
                   }
                   if(list[i].dialysis_solution.anticoagulant == 2){
                      anticoagulantList.push(list[i].dialysis_solution)
                   }
                  if(list[i].dialysis_solution.anticoagulant == 3){
                      anticoagulantList.push(list[i].dialysis_solution)
                   }
                   if(list[i].dialysis_solution.anticoagulant == 4){
                      anticoagulantList.push(list[i].dialysis_solution)
                   }
                  if(list[i].dialysis_solution.anticoagulant == 5){
                     anticoagulantList.push(list[i].dialysis_solution)
                   }
                    if(list[i].dialysis_solution.anticoagulant == 6){
                      anticoagulantList.push(list[i].dialysis_solution)
                   }
                    if(list[i].dialysis_solution.anticoagulant == 7){
                     anticoagulantList.push(list[i].dialysis_solution)
                   }
                    if(list[i].dialysis_solution.anticoagulant == 8){
                     anticoagulantList.push(list[i].dialysis_solution)
                   }
                   if(list[i].dialysis_solution.anticoagulant == 9){
                     anticoagulantList.push(list[i].dialysis_solution)
                   }
                    if(list[i].dialysis_solution.anticoagulant == 10){
                      anticoagulantList.push(list[i].dialysis_solution)
                   }
                    if(list[i].dialysis_solution.anticoagulant == 11){
                      anticoagulantList.push(list[i].dialysis_solution)
                   }
                    if(list[i].dialysis_solution.anticoagulant == 12){
                      anticoagulantList.push(list[i].dialysis_solution)
                   }
                   if(list[i].dialysis_solution.anticoagulant == 13){
                     anticoagulantList.push(list[i].dialysis_solution)
                   }
                }
              }
              console.log("anticoagulantList",anticoagulantList)
             this.tableList = []
             if(anticoagulantList!=null && anticoagulantList.length > 0){
                  let dataInfoOne = {}
                  anticoagulantList.forEach((item, index) => {
                  let { anticoagulant } = item
                  if (!dataInfoOne[anticoagulant]) {
                    dataInfoOne[anticoagulant] = {
                      anticoagulant:item.anticoagulant,
                      name: "抗凝剂",
                      specification_name:this.getAnticoagualnt(item.anticoagulant),
                      count:0,
                      child:[]
                    }
                  }
                })
              let hisarr = Object.values(dataInfoOne)
              if(hisarr!=null && hisarr.length > 0){
                for(let i=0;i<anticoagulantList.length;i++){
                  for(let j=0;j<hisarr.length;j++){
                    if(anticoagulantList[i].anticoagulant == hisarr[j].anticoagulant){
                       hisarr[j].child.push(anticoagulantList[i])
                    }
                  }
                }
              }
              for(let i=0;i<hisarr.length;i++){
                hisarr[i].count = hisarr[i].child.length
                this.tableList.push(hisarr[i])
              }
              console.log("hisarr",hisarr)
             }
              var dialysisDialyszersArr = []
              var dialyzerPerfusionApparaArr = []
              var dialysisIrrigationArr = []
  
              var dialysisStrainerArr = []
              for(let i=0;i<list.length;i++){
               for(let j=0;j<list[i].dialysis_dialyszers_arr.length;j++){
                 dialysisDialyszersArr.push(list[i].dialysis_dialyszers_arr[j])  
               }
               for(let z=0;z<list[i].dialyzer_perfusion_apparatus_arr.length;z++){
                dialyzerPerfusionApparaArr.push(list[i].dialyzer_perfusion_apparatus_arr[z])
               }
               for(let y=0;y<list[i].dialysis_irrigation_arr.length;y++){
                dialysisIrrigationArr.push(list[i].dialysis_irrigation_arr[y])
               }
               for(let p=0;p<list[i].dialysis_strainer_arr.length;p++){
                dialysisStrainerArr.push(list[i].dialysis_strainer_arr[p])
               }
              }
             let obj = {}
             let objOne = {}
             let objTwo = {}
             let objThree = {}
             for(let i = 0 ; i < dialysisDialyszersArr.length; i++){
              if(obj[dialysisDialyszersArr[i]]){
                 obj[dialysisDialyszersArr[i]] +=1
              }else{
                obj[dialysisDialyszersArr[i]] = 1
              }
             }
             let Arr = [];
              for (let i in obj) {
                let a = {};
                a[i] = obj[i];
                a.name = "透析器"
                a.count = obj[i]
                a.specification_name = i
                Arr.push(a);
              }
            
             for(let i=0;i<dialyzerPerfusionApparaArr.length;i++){
              if(objOne[dialyzerPerfusionApparaArr[i]]){
                  objOne[dialyzerPerfusionApparaArr[i]] +=1
               }else{
                objOne[dialyzerPerfusionApparaArr[i]] = 1
               }   
             }
             
             for (let i in objOne) {
                let a = {};
                a[i] = objOne[i];
                a.name = "透析器/灌流器"
                a.count = objOne[i]
                a.specification_name = i
                Arr.push(a);
              }
  
           
  
             for(let i=0;i<dialysisIrrigationArr.length;i++){
              if(objTwo[dialysisIrrigationArr[i]]){
                objTwo[dialysisIrrigationArr[i]] +=1
               }else{
                objTwo[dialysisIrrigationArr[i]] = 1
               }   
             }
  
             for (let i in objTwo) {
                let a = {};
                a[i] = objTwo[i];
                a.name = "灌流器"
                a.count = objTwo[i]
                a.specification_name = i
                Arr.push(a);
              }
              console.log("newa",Arr)
  
             for (let i in objThree) {
                let a = {};
                a[i] = objThree[i];
                a.name = "滤过器"
                a.count = objThree[i]
                a.specification_name = i
                Arr.push(a);
              }
  
              for(let i=0;i<dialysisStrainerArr.length;i++){
              if(objThree[dialysisStrainerArr[i]]){
                objThree[dialysisStrainerArr[i]] +=1
               }else{
                objThree[dialysisStrainerArr[i]] = 1
               }   
             }
  
             for (let i in objThree) {
                let a = {};
                a[i] = objThree[i];
                a.name = "滤过器"
                a.count = objThree[i]
                a.specification_name = i
                Arr.push(a);
              }
  
  
              if(Arr.length >0){
                for(let i=0;i<Arr.length;i++){
                   this.tableList.push(Arr[i])
                }
              }
             }
          })
        },
  
      
        getModeName(id){
           var mode_name =""
           if(id == 1){
            mode_name = "HD"
           }
           if(id == 2){
            mode_name = "HDF"
           }
           if(id == 3){
            mode_name = "HD+HP"
           }
           if(id == 4){
            mode_name = "HP"
           }
           if(id == 5){
            mode_name = "HF"
           }
           if(id == 6){
            mode_name = "SCUF"
           }
           if(id == 7){
            mode_name = "IUF"
           }
           if(id == 8){
            mode_name = "HFHD"
           }
           if(id == 9){
            mode_name = "HFHD+HP"
           }
           if(id == 10){
            mode_name = "PHF"
           }
           if(id ==11){
             mode_name ="HFR"
           }
           if(id ==12){
             mode_name ="HDF+HP"
           }
           if(id ==25){
             mode_name ="HD高通"
           }
           if(id ==31){
             mode_name ="HPD"
           }
           if(id ==32){
             mode_name ="HDP"
           }
           if(id ==33){
             mode_name ="HFD"
           }
           if(id ==34){
             mode_name ="HDF100"
           }
           if(id ==35){
             mode_name ="HDF600"
           }
           if(id ==36){
             mode_name ="HDF800"
           }
           if(id ==37){
             mode_name ="HDF1000"
           }
          
           return mode_name
        },
        getAnticoagulantName(id){
           var name = ""
           if(id ==1){
              name ="无肝素"
           }
           if(id == 2){
              name ="普通肝素"
           }
           if(id ==3){
              name ="低分子肝素"
           }
           if(id == 6){
             name ="低分子肝素钙"
           }
           if(id == 7){
             name ="低分子肝素钠"
           }
           return name
        },
        handleScheduleDateChange(val) {
          this.query.schedule_date = val
          this.query.page = 1
          this.getlist()
        },
        search() {
          this.query.page = 1
          this.getlist()
        },
  
         exportList(){
           import('@/vendor/Export2Excel').then(excel => {
        
           if(this.list!=null && this.list.length > 0){
              console.log("hhhahhah",this.list)
              for(let i=0;i<this.list.length;i++){
                this.list[i].index = i+1
                this.list[i].mode_name = this.getModeName(this.list[i].mode_id)
                this.list[i].device_number_one =  this.list[i].device_number.zone.name + this.list[i].device_number.number
                this.list[i].patient_name = this.list[i].patient.name
                this.list[i].dialysis_no = this.list[i].patient.dialysis_no
                this.list[i].admission_number = this.list[i].xt_receive_treatment_asses.admission_number
                this.list[i].weight_before = this.list[i].assessment_befor_dislysis.weight_before?this.list[i].assessment_befor_dislysis.weight_before:"",
                this.list[i].dry_weight = this.list[i].assessment_befor_dislysis.dry_weight?this.list[i].assessment_befor_dislysis.dry_weight:""
                this.list[i].blood_pressure = this.list[i].assessment_befor_dislysis.systolic_blood_pressure?this.list[i].assessment_befor_dislysis.systolic_blood_pressure:"" + "/" + this.list[i].assessment_befor_dislysis.diastolic_blood_pressure? this.list[i].assessment_befor_dislysis.diastolic_blood_pressure:""
                if(this.list[i].blood_pressure == 0){
                  this.list[i].blood_pressure = ""
                }
                this.list[i].ultrafiltration_volume = this.list[i].dialysis_solution.target_ultrafiltration?this.list[i].dialysis_solution.target_ultrafiltration:""
               
                
                this.list[i].anticoagulant_one=""
                this.list[i].anticoagulant_one = (this.getAnticoagualnt(this.list[i].dialysis_solution.anticoagulant)) + "(" + (this.list[i].dialysis_solution.anticoagulant_shouji) +")" + "("+(this.list[i].dialysis_solution.anticoagulant_weichi) +")"+"("+(this.list[i].dialysis_solution.anticoagulant_zongliang)+")"
               
                this.list[i].dialysis_time = this.list[i].dialysis_solution.dialysis_duration_hour?this.list[i].dialysis_solution.dialysis_duration_hour:"" + "时"+ this.list[i].dialysis_solution.dialysis_duration_minute?this.list[i].dialysis_solution.dialysis_duration_minute:"" + "分"
                if(this.list[i].dialysis_time == 0){
                 this.list[i].dialysis_time = ""
                }
                this.list[i].device_type = this.list[i].assessment_befor_dislysis.machine_type
                this.list[i].dialyzer_perfusion_apparatus = this.list[i].dialysis_solution.dialyzer_perfusion_apparatus
                this.list[i].dialysis_dialyszers = this.list[i].dialysis_solution.dialysis_dialyszers
                this.list[i].dialysis_irrigation = this.list[i].dialysis_solution.dialysis_irrigation
                this.list[i].displace_liqui_part = this.getDisplaceLiquiPart(this.list[i].dialysis_solution.displace_liqui_part)
                this.list[i].displace_liqui_value = this.list[i].dialysis_solution.displace_liqui_value? this.list[i].dialysis_solution.displace_liqui_value:""
                this.list[i].kalium = this.list[i].dialysis_solution.kalium?this.list[i].dialysis_solution.kalium:""
                this.list[i].sodium = this.list[i].dialysis_solution.sodium?this.list[i].dialysis_solution.sodium:""
                this.list[i].calcium = this.list[i].dialysis_solution.calcium?this.list[i].dialysis_solution.calcium:""
                this.list[i].blood_access = this.getBloodAccessOption(this.list[i].dialysis_solution.blood_access)
                this.list[i].sealing_fluid_dispose =this.list[i].xt_assesment_after_dislysis.sealing_fluid_dispose
                this.list[i].glucose = this.list[i].dialysis_solution.glucose?this.list[i].dialysis_solution.glucose:""
                this.list[i].blood_flow_volume = this.list[i].dialysis_solution.blood_flow_volume?this.list[i].dialysis_solution.blood_flow_volume:""
                this.list[i].bicarbonate = this.list[i].dialysis_solution.bicarbonate? this.list[i].dialysis_solution.bicarbonate:""
                this.list[i].count =0
                if(this.getBloodAccessOption(this.list[i].dialysis_solution.blood_access).indexOf("导管")!=-1){
                  this.list[i].count =1
                }
              }
           }
  
           console.log("list23323232322323wode",this.list)
           
           var arr= []
           var arrTwo = []
           arr.push('序号')
           arrTwo.push("index")
           if(this.dialysisSett.device_number == 1){
             arr.push("透析机号")
             arrTwo.push("device_number_one")
           }
           if(this.dialysisSett.name == 1){
             arr.push("姓名")
             arrTwo.push("patient_name")
           }
           arr.push("透析模式")
           arrTwo.push("mode_name")
           if(this.dialysisSett.dialysis_no == 1){
             arr.push("透析号")
             arrTwo.push("dialysis_no")
           }
           if(this.dialysisSett.admission_number == 1){
             arr.push("住院(门诊)号")
             arrTwo.push("admission_number")
           }
           if(this.dialysisSett.weight_befor == 1){
             arr.push("透前体重")
             arrTwo.push("weight_before")
           }
           if(this.dialysisSett.dry_weight == 1){
             arr.push("干体重")
             arrTwo.push("dry_weight")
           }
           if(this.dialysisSett.blood_pressure == 1){
              arr.push("透前血压")
              arrTwo.push("blood_pressure")
           }
           if(this.dialysisSett.ultrafiltration_volume == 1){
             arr.push("目标脱水量")
             arrTwo.push("ultrafiltration_volume")
           }
           if(this.dialysisSett.anticoagulant == 1){
             arr.push("抗凝剂(首剂)(维持)(总量)")
             arrTwo.push("anticoagulant_one")
           }
           if(this.dialysisSett.dialysis_time == 1){
             arr.push("透析时长")
             arrTwo.push("dialysis_time")
           }
           if(this.dialysisSett.device_type == 1){
             arr.push("设备型号")
             arrTwo.push("device_type")
           } 
           if(this.dialysisSett.dialyzer_perfusion_apparatus == 1){
              arr.push("透析器/灌流器")
              arrTwo.push("dialyzer_perfusion_apparatus")
           }
           if(this.dialysisSett.dialysis_dialyszers == 1){
             arr.push("透析器")
             arrTwo.push("dialysis_dialyszers")
           }
           if(this.dialysisSett.dialysis_irrigation == 1){
             arr.push("灌流器")
             arrTwo.push("dialysis_irrigation")
           }
           if(this.dialysisSett.displace_liqui_part == 1){
             arr.push("置换液")
             arrTwo.push("displace_liqui_part")
           }
           if(this.dialysisSett.displace_liqui_value == 1){
             arr.push("置换液总量")
             arrTwo.push("displace_liqui_value")
           }
           if(this.dialysisSett.kalium == 1){
             arr.push("钾")
             arrTwo.push("kalium")
           }
           if(this.dialysisSett.sodium == 1){
             arr.push("钠")
             arrTwo.push("sodium")
           }
           if(this.dialysisSett.calcium == 1){
             arr.push("钙")
             arrTwo.push("calcium")
           }
           if(this.dialysisSett.bicarbonate == 1){
             arr.push("碳酸氢盐")
             arrTwo.push("bicarbonate")
           }
           if(this.dialysisSett.blood_access == 1){
             arr.push("血管通路")
             arrTwo.push("blood_access")
           }
  
          if(this.dialysisSett.sealing_fluid_dispose == 1){
             arr.push("封管液")
             arrTwo.push("sealing_fluid_dispose")
           }
  
          if(this.dialysisSett.glucose == 1){
             arr.push("葡萄糖")
             arrTwo.push("glucose")
          }
         if(this.dialysisSett.blood_flow_volume == 1){
             arr.push("血流量")
             arrTwo.push("blood_flow_volume")
          }
           
          arr.push("封管液")
          arrTwo.push("count")
  
          arr.push("促红")
          arrTwo.push("advice_spc")
         
          const tHeader = arr
          const filterVal = arrTwo
          
          const data = this.formatJson(filterVal, this.list)
          console.log("DATWOWOWOWO",data)
         
           excel.export_json_to_excel({
             header: tHeader,
             data,
             filename: '透析参数查询'
           })
            this.downloadLoading = false
          })
         },
        formatJson(filterVal, jsonData) {
          return jsonData.map(v => filterVal.map(j => v[j]));
        },
        exportListOne(){
          import('@/vendor/Export2Excel').then(excel => { 
          if(this.tableList!=null && this.tableList.length > 0){
             for(let i=0;i<this.tableList.length;i++){
               this.tableList[i].index = i+1
             }
          }
          const tHeader = ['序号','名称','规格','数量']
          const filterVal = ['index', 'name','specification_name','count']
  
          const data = this.formatJson(filterVal, this.tableList)
           excel.export_json_to_excel({
             header: tHeader,
             data,
             filename: '透析参数统计'
           })
            this.downloadLoading = false
          })  
        },
       toDialog(){
        getGatherSetting().then(response=>{
          if(response.data.state == 1){
             this.dialogVisible = true
             var gatherSetting = response.data.data.gatherSetting
             if(gatherSetting!=null){
               if(gatherSetting.index_number == 1){
                   this.index_number = true
               }else{
                  this.index_number = false
               }

               if(gatherSetting.zone == 1){
                   this.zone = true
               }else{
                  this.zone = false
               }

               if(gatherSetting.number == 1){
                   this.number = true
               }else{
                  this.number = false
               }

               if(gatherSetting.birth == 1){
                   this.birth = true
               }else{
                  this.birth = false
               }

               if(gatherSetting.name == 1){
                   this.name = true
               }else{
                  this.name = false
               }

               if(gatherSetting.age == 1){
                   this.age = true
               }else{
                  this.age = false
               }

               if(gatherSetting.mode_type == 1){
                   this.mode_type = true
               }else{
                  this.mode_type = false
               }

               if(gatherSetting.prescription_status == 1){
                   this.prescription_status = true
               }else{
                  this.prescription_status = false
               }

               if(gatherSetting.admission_number == 1){
                   this.admission_number = true
               }else{
                  this.admission_number = false
               }

               if(gatherSetting.dialysis_no == 1){
                   this.dialysis_no = true
               }else{
                  this.dialysis_no = false
               }

               if(gatherSetting.dry_weight == 1){
                   this.dry_weight = true
               }else{
                  this.dry_weight = false
               }

               if(gatherSetting.dialysis_dialyszers == 1){
                   this.dialysis_dialyszers = true
               }else{
                  this.dialysis_dialyszers = false
               }

               if(gatherSetting.dialysis_strainer == 1){
                   this.dialysis_strainer = true
               }else{
                  this.dialysis_strainer = false
               }

               if(gatherSetting.dialysis_irrigation == 1){
                   this.dialysis_irrigation = true
               }else{
                  this.dialysis_irrigation = false
               }

               if(gatherSetting.calcium == 1){
                   this.calcium = true
               }else{
                  this.calcium = false
               }

               if(gatherSetting.kalium == 1){
                   this.kalium = true
               }else{
                  this.kalium = false
               }

               if(gatherSetting.change_nurse == 1){
                   this.change_nurse = true
               }else{
                  this.change_nurse = false
               }

               if(gatherSetting.puncture_needle == 1){
                   this.puncture_needle = true
               }else{
                  this.puncture_needle = false
               }

               if(gatherSetting.anticoagulant == 1){
                   this.anticoagulant = true
               }else{
                  this.anticoagulant = false
               }

               
               if(gatherSetting.tube == 1){
                   this.tube = true
               }else{
                  this.tube = false
               }

               if(gatherSetting.cuhong == 1){
                   this.cuhong = true
               }else{
                  this.cuhong = false
               }

               if(gatherSetting.zuoka == 1){
                   this.zuoka = true
               }else{
                  this.zuoka = false
               }

               
               if(gatherSetting.zhetangtie == 1){
                   this.zhetangtie = true
               }else{
                  this.zhetangtie = false
               }

                 
               if(gatherSetting.paligu == 1){
                   this.paligu = true
               }else{
                  this.paligu = false
               }

               if(gatherSetting.guhuachun == 1){
                   this.guhuachun = true
               }else{
                  this.guhuachun = false
               }

               if(gatherSetting.niaojimei == 1){
                   this.niaojimei = true
               }else{
                  this.niaojimei = false
               }

               if(gatherSetting.putaosuangai == 1){
                   this.putaosuangai = true
               }else{
                  this.putaosuangai = false
               }

               if(gatherSetting.jiaguan == 1){
                   this.jiaguan = true
               }else{
                  this.jiaguan = false
               }

               if(gatherSetting.xiongxiewutai == 1){
                   this.xiongxiewutai = true
               }else{
                  this.xiongxiewutai = false
               }

              
             }
       
          }
        })
        
       },
       saveGatherSetting(){
         var is_index_number = 2
         var is_zone = 2
         var is_age =2
         var is_number = 2
         var is_birth = 2
         var is_name = 2
         var is_mode_type = 2
         var is_prescription_status = 2
         var is_admission_number = 2
         var is_dialysis_no= 2
         var is_dry_weight = 2
         var is_dialysis_dialyszers = 2
         var is_dialysis_strainer = 2
         var is_dialysis_irrigation = 2
         var is_calcium =2
         var is_kalium =2
         var is_change_nurse =2
         var is_puncture_needle =2
         var is_anticoagulant = 2
         var is_tube = 2
         var is_cuhong =2
         var is_zuoka =2
         var is_zhetangtie = 2
         var is_paligu = 2
         var is_guhuachun =2
         var is_niaojimei =2
         var is_putaosuangai =2
         var is_jiaguan =2
         var is_xiongxiewutai =2


         
         if(this.index_number == false){
          is_index_number = 2
         }
         if(this.index_number == true){
           is_index_number = 1
         }
  
         if(this.zone ==false){
           is_zone = 2
         }
         if(this.zone == true){
            is_zone = 1
         }
  
        if(this.number ==false){
           is_number = 2
         }
         if(this.number == true){
            is_number = 1
         }
  
         if(this.birth == false){
           is_birth = 2
         }
         if(this.birth == true){
           is_birth =1
         }
  
         if(this.name == false){
            is_name = 2
         }
         
         if(this.name == true){
            is_name = 1
         }
         
         if(this.mode_type == false){
            is_mode_type =2
         }
         if(this.mode_type == true){
             is_mode_type = 1
         }

         if(this.prescription_status == false){
            is_prescription_status =2
         }
         if(this.prescription_status == true){
             is_prescription_status = 1
         }

         if(this.admission_number == false){
          is_admission_number =2
         }
         if(this.admission_number == true){
             is_admission_number = 1
         }

         if(this.dialysis_no == false){
          is_dialysis_no =2
         }
         if(this.dialysis_no == true){
             is_dialysis_no = 1
         }

         if(this.dry_weight == false){
          is_dry_weight =2
         }
         if(this.dry_weight == true){
             is_dry_weight = 1
         }

         if(this.dialysis_dialyszers == false){
          is_dialysis_dialyszers =2
         }
         if(this.dialysis_dialyszers == true){
             is_dialysis_dialyszers = 1
         }

         if(this.dialysis_strainer == false){
          is_dialysis_strainer =2
         }
         if(this.dialysis_strainer == true){
             is_dialysis_strainer = 1
         }


         if(this.dialysis_irrigation == false){
          is_dialysis_irrigation =2
         }
         if(this.dialysis_irrigation == true){
          is_dialysis_irrigation = 1
         }


         if(this.calcium == false){
          is_calcium =2
         }
         if(this.calcium == true){
          is_calcium = 1
         }

         if(this.kalium == false){
              is_kalium =2
         }

         if(this.kalium == true){
             is_kalium =1
         }

         if(this.change_nurse == false){
              is_change_nurse =2
         }

         if(this.change_nurse == true){
             is_change_nurse =1
         }

         if(this.puncture_needle == false){
             is_puncture_needle =2
         }

         if(this.puncture_needle == true){
             is_puncture_needle =1
         }


         if(this.anticoagulant == false){
             is_anticoagulant =2
         }

         if(this.anticoagulant == true){
             is_anticoagulant =1
         }


         if(this.tube == false){
             is_tube =2
         }

         if(this.tube == true){
             is_tube =1
         }

         if(this.cuhong == false){
             is_cuhong =2
         }

         if(this.cuhong == true){
             is_cuhong =1
         }


         if(this.zuoka == false){
             is_zuoka =2
         }

         if(this.zuoka == true){
             is_zuoka =1
         }


         if(this.zhetangtie == false){
             is_zhetangtie =2
         }

         if(this.zhetangtie == true){
             is_zhetangtie =1
         }

         if(this.paligu == false){
             is_paligu =2
         }

         if(this.paligu == true){
             is_paligu =1
         }

         if(this.guhuachun == false){
             is_guhuachun =2
         }

         if(this.guhuachun == true){
             is_guhuachun =1
         }


         if(this.niaojimei == false){
             is_niaojimei =2
         }

         if(this.niaojimei == true){
             is_niaojimei =1
         }

         if(this.putaosuangai == false){
             is_putaosuangai =2
         }

         if(this.putaosuangai == true){
             is_putaosuangai =1
         }

         if(this.jiaguan == false){
             is_jiaguan =2
         }

         if(this.jiaguan == true){
             is_jiaguan =1
         }

         if(this.xiongxiewutai == false){
             is_xiongxiewutai =2
         }

         if(this.xiongxiewutai == true){
             is_xiongxiewutai =1
         }

         if(this.age == true){
            is_age = 1
         }
         if(this.age == false){
            is_age = 2
         }

         if(this.birth == true){
            is_birth = 1
         }

         if(this.birth == false){
             is_birth = 2
         }

          var params = {
            is_index_number:is_index_number,
            is_number:is_number,
            is_name:is_name,
            is_zone:is_zone,
            is_age:is_age,
            is_birth:is_birth,
            is_mode_type:is_mode_type,
            is_prescription_status:is_prescription_status,
            is_admission_number:is_admission_number,
            is_dialysis_no:is_dialysis_no,
            is_dry_weight:is_dry_weight,
            is_dialysis_dialyszers:is_dialysis_dialyszers,
            is_dialysis_strainer:is_dialysis_strainer,
            is_dialysis_irrigation:is_dialysis_irrigation,
            is_calcium:is_calcium,
            is_kalium:is_kalium,
            is_change_nurse:is_change_nurse,
            is_puncture_needle:is_puncture_needle,
            is_anticoagulant:is_anticoagulant,
            is_tube:is_tube,
            is_cuhong:is_cuhong,
            is_zuoka:is_zuoka,
            is_zhetangtie:is_zhetangtie,
            is_paligu:is_paligu,
            is_guhuachun:is_guhuachun,
            is_niaojimei:is_niaojimei,
            is_putaosuangai:is_putaosuangai,
            is_jiaguan:is_jiaguan,
            is_xiongxiewutai:is_xiongxiewutai,
           
          }
          console.log("paramswoowowo",params)
        
          saveGatherSetting(params).then(response=>{
           if(response.data.state == 1){
             var dialysisSetting = response.data.data.dialysisSetting
             this.$message.success("保存成功!")
             this.dialogVisible = false
          
           }
         })
       },
       getAnticoagualnt(id){
         var name = ""
         if(id == 1){
           name = "无肝素"
         }
         if(id == 2){
          name = "普通肝素"
         }
         if(id == 3){
           name ="低分子肝素"
         }
         if(id == 4){
           name ="阿加曲班"
         }
         if(id == 5){
           name ="枸橼酸钠"
         }
         if(id == 6){
           name ="低分子肝素钙"
         }
         if(id == 7){
           name ="低分子肝素钠"
         }
         if(id == 8){
           name ="依诺肝素"
         }
         if(id == 9){
           name ="达肝素"
         }
         if(id == 10){
           name ="体外抗凝"
         }
         if(id == 11){
           name ="那屈肝素"
         }
         if(id == 12){
           name ="无抗凝剂"
         }
         if(id == 13){
           name ="那屈肝素钙"
         }
         return name
       },
       getBloodAccessOption(id){
         var name = ""
         for(let i=0;i<this.blood_access_option.length;i++){
           if(id == this.blood_access_option[i].id){
              name = this.blood_access_option[i].name
           }
         }
         return name
       },
       toSign(){
         this.$router.push({path: '/dialysis/consumable/dialysis/print?schedule_type='+this.query.schedule_type+"&partion_id="+this.query.partition_id+"&schedule_date="+this.query.schedule_date+"&keyword="+this.query.keywords+"&page="+this.query.page+"&limit="+this.query.limit})
       },
       printAction(){
        this.getRemindPrintList()
        this.dialogVisibleOne = true
  
       },
      getRemindPrintList() {
          getRemindPrintList().then(response => {
            if (response.data.state == 1) {
              var list = response.data.data.list
              console.log('list222332', list)
              if (list.anticoagulant == 1) {
                // console.log('进来22222')
                this.anticoagulant = true
              }
              if (list.anticoagulant == 2) {
                this.anticoagulant = false
              }
              if (list.anticoagulant_zongliang == 1) {
                this.anticoagulant_zongliang = true
              }
              if (list.anticoagulant_zongliang == 2) {
                this.anticoagulant_zongliang = false
              }
              if (list.classes == 1) {
                this.classes = true
              }
              if (list.classes == 2) {
                this.classes = false
              }
              if (list.dialyzers == 1) {
                this.dialyzers = true
              }
              if (list.dialyzers == 2) {
                this.dialyzers = false
              }
              if (list.doctor_advice == 1) {
                this.doctor_advice = true
              }
              if (list.doctor_advice == 2) {
                this.doctor_advice = false
              }
              if (list.name == 1) {
                this.name = true
              }
              if (list.name == 2) {
                this.name = false
              }
              if (list.number == 1) {
                this.number = true
              }
              if (list.number == 2) {
                this.number = false
              }
              if (list.perfusion_apparatus == 1) {
                this.perfusion_apparatus = true
              }
              if (list.perfusion_apparatus == 2) {
                this.perfusion_apparatus = false
              }
              if (list.prescription_status == 1) {
                this.prescription_status = true
              }
              if (list.prescription_status == 2) {
                this.prescription_status = false
              }
              if (list.week == 1) {
                this.week = true
              }
              if (list.week == 2) {
                this.week = false
              }
              if (list.zone == 1) {
                this.zone_name = true
              }
              if (list.zone == 2) {
                this.zone_name = false
              }
              if (list.mode == 1) {
                this.mode = true
              }
              if (list.mode == 2) {
                this.mode = false
              }
              this.form.id = list.id
            }
          })
        },
      
        saveRemindPrint() {
         
  
          if (this.perfusion_apparatus == true) {
            // console.log('3333')
            this.form.perfusion_apparatus = 1
          }
          if (this.perfusion_apparatus == false) {
            this.form.perfusion_apparatus = 2
          }
          if (this.prescription_status == true) {
            this.form.prescription_status = 1
          }
          if (this.prescription_status == false) {
            this.form.prescription_status = 2
          }
          if (this.week == true) {
            this.form.week = 1
          }
          if (this.week == false) {
            this.form.week = 2
          }
          if (this.name == true) {
            this.form.name = 1
          }
          if (this.name == false) {
            this.form.name = 2
          }
          if (this.zone_name == true) {
            this.form.zone = 1
          }
          if (this.zone_name == false) {
            this.form.zone = 2
          }
          if (this.classes == true) {
            this.form.classes = 1
          }
          if (this.classes == false) {
            this.form.classes = 2
          }
          if (this.number == true) {
            this.form.number = 1
          }
          if (this.number == false) {
            this.form.number = 2
          }
          if (this.mode == true) {
            this.form.mode = 1
          }
          if (this.mode == false) {
            this.form.mode = 2
          }
          if (this.dialyzers == true) {
            this.form.dialyzers = 1
          }
          if (this.dialyzers == false) {
            this.form.dialyzers = 2
          }
  
          if (this.anticoagulant == true) {
            this.form.anticoagulant = 1
          }
          if (this.anticoagulant == false) {
            this.form.anticoagulant = 2
          }
          if (this.anticoagulant_zongliang == true) {
            this.form.anticoagulant_zongliang = 1
          }
          if (this.anticoagulant_zongliang == false) {
            this.form.anticoagulant_zongliang = 2
          }
          if (this.doctor_advice == true) {
            this.form.doctor_advice = 1
          }
          if (this.doctor_advice == false) {
            this.form.doctor_advice = 2
          }
          // console.log('555555555', this.form.prescription_status)
          var params = {
            id: this.form.id,
            prescription_status: this.form.prescription_status,
            week: this.form.week,
            name: this.form.name,
            zone: this.form.zone,
            classes: this.form.classes,
            number: this.form.number,
            mode: this.form.mode,
            dialyzers: this.form.dialyzers,
            perfusion_apparatus: this.form.perfusion_apparatus,
            anticoagulant: this.form.anticoagulant,
            anticoagulant_zongliang: this.form.anticoagulant_zongliang,
            doctor_advice: this.form.doctor_advice
          }
          // console.log('params', params)
          saveRemindPrint(params).then(response => {
            if (response.data.state == 1) {
              var settting = response.data.data.setting
              this.$message.success('保存成功')
              this.dialogVisibleOne = false
              this.getRemindPrintList()
            }
          })
        },
        toPrint(){
          this.$router.push({path: '/dialysis/consumable/dialysis/gather/print?schedule_type='+this.query.schedule_type+"&partion_id="+this.query.partition_id+"&schedule_date="+this.query.schedule_date+"&keyword="+this.query.keywords+"&page="+this.query.page+"&limit="+this.query.limit+"&ids="+this.ids})
        },
        toPrintOne(){
          this.$router.push({path:"/dialysis/consumable/dialysis/count/print?schedule_type="+this.schedule_type+"&partion_type="+this.partion_type+"&schedule_date="+this.query.schedule_date})
        },

        printThisInfo() {
          var ptime = Math.round(new Date().getTime() / 1000);
          this.print_time = uParseTime(ptime, "{y}年{m}月{d}日");

          const style =
            "@page {margin-top:10px;}@media print { .print_main_content { background-color: white; width:960px; margin:0 auto; padding: 0 0 20px 0; } .print_main_content .order_title { text-align: center; font-size: 23px; line-height: 50px; font-weight: 500; } .print_main_content table { width: 100%; border-collapse: collapse; padding: 2px; }  .print_main_content table tbody tr{page-break-inside:avoid;} .print_main_content table tbody tr td { border: 1px solid; text-align: center; padding: 10px 8px; } .td_proj_title { font-size: 18px; line-height: 25px; font-weight: 500; } .td_proj_content { font-size: 18px; line-height: 25px; } .td_align_left { text-align: left; } .print_footnote_panel { font-size: 17px; line-height: 40px; } .print_footnote_panel .proj { display: inline-block; width: 49%; } .print_footnote_panel .proj .proj_title { font-weight: 500;} }";

          setTimeout(() => {
            printJS({
              printable: "print-info-box",
              type: "html",
              style: style,
              scanStyles: false,
            });
          }, 1);
        },
        handleSelectionChange(val){
          
          var arr = []
          for(let i=0;i<val.length;i++){
            arr.push(val[i].id)
          }
          this.ids = arr.join(",")
       }, 
       changeScheduleType(){
        this.tableList = []
        this.statistics()
       },
       changePartionType(){
        this.tableList = []
        this.statistics()
       },
       getDisplaceLiquiPart(id){
         var name = ""
         for(let i=0;i<this.displace_liqui_part_option.length;i++){
           if(id == this.displace_liqui_part_option[i].id){
              name = this.displace_liqui_part_option[i].name
           }
         }
         return name
       },
       getHuanYao(){

       },
       toStatic(){
        
        this.startDialogVisibleOne = true
       }
      }
    }
  </script>
  
  
  <style lang="scss" scoped>
    .page_consumables {
  
    .clearfix:after {
      content: none;
    }
  
    }
  </style>
  

  
<style scoped>
/* 打印表格的样式 */
.print_main_content {
  background-color: white;
  width: 960px;
  margin: 0 auto;
  padding: 0 0 0 0;
  page-break-after: always;
}
.print_main_content .order_title {
  text-align: center;
  font-size: 23px;
  line-height: 50px;
  font-weight: 500;
}
.print_main_content table {
  width: 100%;
  border: 1px solid;
  border-collapse: collapse;
  padding: 2px;
}
.print_main_content table tbody tr td {
  border: 1px solid;
  text-align: center;
  /* font-size: 17px; */
  /* padding: 10px 8px; */
}
.td_proj_title {
  font-size: 17px;
  /* line-height: 20px; */
  font-weight: 500;
}
.td_proj_content {
  font-size: 17px;
  /* line-height: 20px; */
}
.td_align_left {
  text-align: left;
}
.print_footnote_panel {
  font-size: 17px;
  line-height: 40px;
}
.print_footnote_panel .proj {
  display: inline-block;
  width: 49%;
}
.print_footnote_panel .proj .proj_title {
  font-weight: 500;
}
.el-select-dropdown {
  z-index: 998 !important;
}
</style>