hwy 18 jam lalu
induk
melakukan
5df34c86b5

+ 6 - 0
app/statistics/html/comprehensive-query.html

@ -841,6 +841,9 @@
                  <chest-pain-manage v-if="handleNodeId == 100"></chest-pain-manage>
                  <lasc-patient v-if="handleNodeId == 101"></lasc-patient>
                  <breast-cancer-patient v-if="handleNodeId == 102"></breast-cancer-patient>
                  <lasc-cervical v-if="handleNodeId == 103"></lasc-cervical>
                  <lasc-progress v-if="handleNodeId == 104"></lasc-progress>
                  <lasc-progress-data v-if="handleNodeId == 105"></lasc-progress-data>
                </div>
                <div v-if="handleNodeShow == 3">
                  <el-table v-if="collectCode == 1" border :data="diseaseReport" style="width: 100%" v-loading="loadingTwo" class="mt20">
@ -995,5 +998,8 @@
    <script src="../../../component/statistics/LascModifyPatient/index.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../../component/statistics/LascPatient/index.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../../component/statistics/breastCancerPatient/index.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../../component/statistics/LascCervical/index.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../../component/statistics/LascProgress/index.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../../component/statistics/LascProgressData/index.js" type="text/javascript" charset="utf-8"></script>
  </body>
</html>

+ 194 - 0
component/statistics/LascCervical/index.html

@ -0,0 +1,194 @@
<!-- css文件位置位于/component/common/jtbc.css -->
<div id="app" class="jtbc">
  <div class="copd-filter-group ui-col-1 bgc-fff" style="min-width: 900px">
    <div class="searchDiv pb20 pr20">
      <label class="c-333 c-f14">
        <el-radio v-model="yearType" label="1">按下转年份:</el-radio>
        <el-select v-model="chooseYear" class="formWidth wd160">
          <el-option v-for="(item , index) in years" :key="index" :label="item" :value="item"></el-option>
        </el-select>
      </label>
    </div>
    <div class="searchDiv pb20 pr20">
      <label class="c-333 c-f14" style="display: flex; align-items: center">
        <el-radio v-model="yearType" label="2">自定义下转时间:</el-radio>
        <el-date-picker
          v-model="chooseTime"
          type="daterange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          value-format="yyyy-MM-dd"></el-date-picker>
      </label>
    </div>
    <div class="searchDiv pb20 pr20">
      <label class="c-333 c-f14">数据范围:</label>
      <el-select class="formWidth" v-model="form.range" placeholder="请选择" @change="resetArea">
        <el-option v-for="(option, index) in rangeOptions" :label="option.label" :value="option.value" :key="option.value"></el-option>
      </el-select>
    </div>
    <div class="searchDiv pb20 pr20">
      <label class="c-333 c-f14">地区:</label>
      <el-select class="formWidth" v-model="form.area" placeholder="请选择" @change="getHospital">
        <el-option v-for="(option, index) in areaOptions" :label="option.label" :value="option.value" :key="option.value"></el-option>
      </el-select>
    </div>
    <div class="searchDiv pb20 pr20" v-if="form.range == 'hospital'||form.range == 'team'">
      <label class="c-333 c-f14">社区:</label>
      <el-select class="formWidth" v-model="form.hospital" placeholder="请选择" @change="getTeam">
        <el-option v-for="(option, index) in hospitalOptions" :label="option.name" :value="option.code" :key="option.code"></el-option>
      </el-select>
    </div>
    <div class="searchDiv pb20 pr20" v-if="form.range == 'team'">
      <label class="c-333 c-f14">团队:</label>
      <el-select class="formWidth" v-model="form.team" placeholder="请选择">
        <el-option v-for="(option, index) in teamOptions" :label="option.name" :value="option.id" :key="option.id"></el-option>
      </el-select>
    </div>
    <div class="searchDiv pb20">
      <el-button type="primary" size="mini" @click="searchFn">查询</el-button>
      <el-button type="ff9526" size="mini" @click="exportTable" :disabled="exportLoading">导出</el-button>
      <span class="eliminate" @click="eliminateClick">清除筛选条件</span>
    </div>
  </div>
  <el-table :data="tableData" style="width: 100%" v-loading="loading" row-key="code" lazy :load="load" :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
    <el-table-column :label="item.label" v-for="item in tableHeader" :min-width="item.width" :key="item.prop" :prop="item.prop">
      <template slot-scope="scope">
        <span
          :class="`${['totalTimes','mzTimes','zyTimes','totalNum','mzNum','zyNum'].includes(item.prop)&&scope.row.code?'pointer c-409eff':''}`"
          @click="openDialog(scope.row, item.prop)">
          {{scope.row[item.prop]}}
        </span>
      </template>
    </el-table-column>
  </el-table>
  <el-dialog :visible.sync="visible" :title="title" @close="closeDialog" width="1200px">
    <el-form inline size="mini">
      <el-form-item label="居民姓名:">
        <el-input v-model="query.patientName" placeholder="请输入居民姓名查询"></el-input>
      </el-form-item>
      <template v-if="title=='康复下转明细列表'">
        <el-form-item label="下转医生:">
          <el-input v-model="query.hospitalDoctor" placeholder="请输入下转医生查询"></el-input>
        </el-form-item>
        <el-form-item label="接收医生:">
          <el-input v-model="query.doctor" placeholder="请输入接收医生查询"></el-input>
        </el-form-item>
        <el-form-item label="下转状态:">
          <el-select v-model="query.status" placeholder="请选择">
            <el-option v-for="(option, index) in statusOptions" :label="option.value" :value="option.code" :key="option.code"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="下转医院:">
          <el-select v-model="query.hospitalCode" placeholder="请选择" filterable>
            <el-option v-for="(option, index) in rehabilitationHospital" :label="option.value" :value="option.code" :key="option.code"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="接收社区医院:">
          <el-select v-model="query.orgCode" placeholder="请选择" filterable>
            <el-option v-for="(option, index) in communityHospitals" :value="option.value" :label="option.label" :key="option.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="档案状态:">
          <el-select v-model="query.archiveStatus" placeholder="请选择">
            <el-option v-for="(item,index) in archiveList" :value="item.code" :label="item.value" :key="item.code"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="患者类型:">
          <el-select v-model="query.patientType" placeholder="请选择">
            <el-option v-for="(item,index) in inviteStatus" :value="item.value" :label="item.label" :key="item.value"></el-option>
          </el-select>
        </el-form-item>
      </template>
      <template v-else>
        <el-form-item label="签约医院:">
          <el-input v-model="query.signHospitalName" placeholder="请输入签约医院查询"></el-input>
        </el-form-item>
        <el-form-item label="手机号码:">
          <el-input v-model="query.mobile" placeholder="请输入手机号码查询"></el-input>
        </el-form-item>
        <el-form-item label="性别:">
          <el-select v-model="query.sex">
            <el-option label="全部" value=""></el-option>
            <el-option label="男" value="1"></el-option>
            <el-option label="女" value="2"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="是否签约:">
          <el-select v-model="query.isSign">
            <el-option label="全部" value=""></el-option>
            <el-option label="是" value="1"></el-option>
            <el-option label="否" value="2"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="下转类型:">
          <el-select v-model="query.eventType">
            <el-option label="全部" value=""></el-option>
            <el-option label="门诊" value="1"></el-option>
            <el-option label="住院" value="2"></el-option>
          </el-select>
        </el-form-item>
      </template>
      <el-form-item label="数据范围:">
        <el-select v-model="query.range" disabled>
          <el-option v-for="item in rangeOptions" :value="item.value" :label="item.label" :key="item.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="地区:" v-if="query.range == 'town'">
        <el-select v-model="query.area" disabled>
          <el-option v-for="(option, index) in dataRangeOption" :label="option.label" :value="option.value" :key="option.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="社区:" v-if="query.range == 'hospital'">
        <el-select v-model="query.hospital" disabled>
          <el-option v-for="(option, index) in dataRangeOption" :label="option.label" :value="option.value" :key="option.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="团队:" v-if="query.range == 'team'">
        <el-select v-model="query.team" disabled>
          <el-option v-for="(option, index) in dataRangeOption" :label="option.label" :value="option.value" :key="option.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="dialogSearchFn">查询</el-button>
        <el-button type="warning" @click="dialogExportFn" :disabled="dialogExportLoading">导出</el-button>
        <span @click="dialogReset" style="color: #676a6c; cursor: pointer">清除筛选条件</span>
      </el-form-item>
    </el-form>
    <el-table :data="dialogTableData" border v-loading="dialogLoading">
      <el-table-column label="序号" type="index"></el-table-column>
      <el-table-column v-for="item in dialogHeader" :label="item.label" :render-header="renderHeader">
        <template slot-scope="scope">
          <span :class="`${item.prop=='name'?'pointer c-409eff':''}`" @click="seePatientDetail(scope.row, item.prop)">{{scope.row[item.prop]}}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" width="100" v-if="title=='康复下转明细列表'">
        <template slot-scope="scope">
          <el-button type="text" v-if="scope.row.status==0" @click="operation(1,scope.row)">分配</el-button>
          <el-button type="text" @click="operation(2,scope.row)">查看签约</el-button>
          <el-button type="text" v-if="scope.row.status==5" @click="operation(3,scope.row)">同步居民</el-button>
          <el-button type="text" v-if="scope.row.status==3" @click="operation(4,scope.row)">同步病历</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div style="display: flex; justify-content: flex-end; margin-top: 10px">
      <el-pagination
        @current-change="handleCurrentChange"
        @size-change="handleSizeChange"
        :current-page.sync="page"
        :page-size="size"
        :page-sizes="[10, 20, 50]"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"></el-pagination>
    </div>
  </el-dialog>
  <el-dialog title="查看签约信息" :visible.sync="dialogVisible" width="70%" append-to-body>
    <el-table border :data="signatoryList" style="width: 100%" height="500" class="mt20">
      <el-table-column prop="hospitalName" label="签约社区医院" align="center"></el-table-column>
      <el-table-column prop="doctorName" label="签约医生" align="center"></el-table-column>
      <el-table-column prop="applyDate" label="签约时间" align="center"></el-table-column>
      <el-table-column prop="signYear" label="签约年度" align="center"></el-table-column>
    </el-table>
  </el-dialog>
</div>

+ 711 - 0
component/statistics/LascCervical/index.js

@ -0,0 +1,711 @@
var template = ''
$.ajax('../../../component/statistics/LascCervical/index.html', {
  data: {},
  dataType: 'html',
  cache: false,
  timeout: 60000,
  async: false,
  error: function (res) {},
  success: function (res) {
    template = res
  }
})
Vue.component('lasc-cervical', {
  template: template,
  props: [],
  data: function () {
    return {
      years: [],
      yearType: '1',
      chooseYear: null,
      chooseTime: null,
      rangeOptions: [
        { label: '区', value: 'town' },
        { label: '社区', value: 'hospital' },
        { label: '团队', value: 'team' }
      ],
      areaOptions: [
        { label: '思明区', value: '350203' },
        { label: '海沧区', value: '350205' },
        { label: '湖里区', value: '350206' },
        { label: '集美区', value: '350211' },
        { label: '同安区', value: '350212' },
        { label: '翔安区', value: '350213' }
      ],
      hospitalOptions: [],
      teamOptions: [],
      form: {
        range: 'town'
      },
      loading: false,
      exportLoading: false,
      tableData: [],
      tableHeader: [],
      constantHeader: [
        { label: '下转次数', prop: 'totalTimes', width: '90' },
        { label: '门诊下转次数', prop: 'mzTimes', width: '110' },
        { label: '出院下转次数', prop: 'zyTimes', width: '110' },
        { label: '下转人数', prop: 'totalNum', width: '110' },
        { label: '门诊下转人数', prop: 'mzNum', width: '110' },
        { label: '出院下转人数', prop: 'zyNum', width: '110' },
        { label: '门诊下转已评估', prop: 'mzScreenNum', width: '120' },
        { label: '门诊下转未评估', prop: 'unMzScreenNum', width: '120' },
        { label: '出院下转已评估', prop: 'zyScreenNum', width: '120' },
        { label: '出院下转未评估', prop: 'unZyScreenNum', width: '120' }
      ],
      level: 0,
      visible: false,
      query: {},
      dataRangeOption: [],
      dialogTableData: [],
      dialogHeader: [],
      page: 1,
      size: 10,
      total: 0,
      messageVisible: false,
      messInfo: null,
      remind: '',
      dialogLoading: false,
      dialogExportLoading: false,
      statusOptions: [],
      rehabilitationHospital: [],
      archiveList: [],
      inviteStatus: [
        { value: '', label: '全部' },
        { value: '1', label: '门诊患者' },
        { value: '2', label: '出院患者' }
      ],
      communityHospitals: [],
      title: '',
      dialogVisible: false,
      signatoryList: []
    }
  },
  methods: {
    init() {
      var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
      if (selectedRole.code.indexOf('350200') > -1) {
        this.level = 1 //  市卫健委
        this.areaOptions = [
          { label: '厦门市', value: '' },
          { label: '思明区', value: '350203' },
          { label: '海沧区', value: '350205' },
          { label: '湖里区', value: '350206' },
          { label: '集美区', value: '350211' },
          { label: '同安区', value: '350212' },
          { label: '翔安区', value: '350213' }
        ]
      } else if (selectedRole.code.length == 6) {
        this.level = 2 // 区管理
        this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }]
        this.form = {
          range: 'town',
          area: selectedRole.code
        }
        this.getHospital(selectedRole.code)
      } else {
        this.level = 3 // 社区管理
        this.rangeOptions = [
          { label: '社区', value: 'hospital' },
          { label: '团队', value: 'team' }
        ]
        this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }]
        this.hospitalOptions = [{ name: selectedRole.name, code: selectedRole.code }]
        this.form = {
          range: 'hospital',
          area: selectedRole.code.substring(0, 6),
          hospital: selectedRole.code
        }
        this.getTeam(selectedRole.code)
      }
      this.initTime()
      this.searchFn()
      this.getDictData()
      this.hospitalsByType()
    },
    initTime() {
      var vm = this
      var now = new Date()
      vm.nowyear = vm.chooseYear = now.getFullYear()
      vm.years = []
      for (i = vm.nowyear; i >= 2013; i--) {
        vm.years.push(i)
      }
    },
    resetArea() {
      if (this.level == 1) {
        delete this.form.area
        delete this.form.hospital
        delete this.form.team
      } else if (this.level == 2) {
        delete this.form.hospital
        delete this.form.team
      } else {
        delete this.form.team
      }
    },
    getDictData() {
      var vm = this
      statisticAPI.getDictByDictName({ name: 'rehabilitation_status' }).then(function (res) {
        vm.statusOptions = [{ value: '全部', code: '' }]
        vm.statusOptions = vm.statusOptions.concat(res.list)
      })
      statisticAPI.getDictByDictName({ name: 'rehabilitation_hospital' }).then(function (res) {
        vm.rehabilitationHospital = [{ value: '全部', code: '' }]
        vm.rehabilitationHospital = vm.rehabilitationHospital.concat(res.list)
      })
      statisticAPI.getDictByDictName({ name: 'archive_status' }).then(function (res) {
        vm.archiveList = [{ value: '全部', code: '' }]
        vm.archiveList = vm.archiveList.concat(res.list)
      })
    },
    searchFn() {
      var vm = this
      this.loading = true
      var params = {
        ...this.form,
        isTotal: 1
      }
      vm.tableData = []
      if (this.yearType == '1') {
        params.startDate = this.chooseYear + '-01-01'
        params.endDate = this.chooseYear + '-12-31'
      } else {
        if (this.chooseTime) {
          params.startDate = this.chooseTime[0]
          params.endDate = this.chooseTime[1]
        }
      }
      if (this.form.range == 'town') {
        this.tableHeader = getTownHeader().concat(this.constantHeader)
      } else if (this.form.range == 'hospital') {
        this.tableHeader = getHospitalHeader().concat(this.constantHeader)
      } else {
        this.tableHeader = getTeamHeader().concat(this.constantHeader)
      }
      httpRequest.get('statistics/collaborate/gxbTurnDownInfo', { data: params }).then(function (res) {
        if (res.status == 200) {
          vm.tableData = res.detailModelList.map(function (item) {
            var data = JSON.parse(JSON.stringify(item))
            if (vm.form.range == 'town') {
              data.town = item.name
              data.hasChildren = data.code && true
            } else if (vm.form.range == 'hospital') {
              data.hospital = item.name
              data.hasChildren = data.code && true
            } else if (vm.form.range == 'team') {
              data.team = item.name
            }
            return data
          })
        }
        vm.loading = false
      })
    },
    exportTable() {
      var vm = this
      var params = {
        ...this.form
      }
      if (this.yearType == '1') {
        params.startDate = this.chooseYear + '-01-01'
        params.endDate = this.chooseYear + '-12-31'
      } else {
        if (this.chooseTime) {
          params.startDate = this.chooseTime[0]
          params.endDate = this.chooseTime[1]
        }
      }
      this.exportLoading = true
      var fileName = `冠心病门诊下转统计表${new Date().getTime()}.xls`
      httpRequest.downLoadFileForAjax('statistics/collaborate/exportGxbTurnDownInfo', fileName, params).then(function () {
        vm.exportLoading = false
      })
    },
    eliminateClick() {
      var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
      if (this.level == 1) {
        this.form = {
          range: 'town'
        }
      } else if (this.level == 2) {
        this.form = {
          range: 'town',
          area: selectedRole.code
        }
        this.getHospital(selectedRole.code)
      } else {
        this.form = {
          range: 'hospital',
          area: selectedRole.code.substring(0, 6),
          hospital: selectedRole.code
        }
        this.getTeam(selectedRole.code)
      }
      this.yearType = '1'
      this.chooseYear = new Date().getFullYear()
      this.chooseTime = null
      this.$forceUpdate()
    },
    getHospital(code, flag = true) {
      var vm = this
      if (flag) {
        delete this.form.hospital
        delete this.form.team
      }
      var params = {
        type: 5,
        code: code
      }
      if (!code) {
        vm.hospitalOptions = [{ name: '全部', value: '' }]
        vm.teamOptions = [{ name: '全部', value: '' }]
        return false
      }
      httpRequest.post('common/district', { data: params }).then(function (res) {
        vm.hospitalOptions = res.list
      })
    },
    getTeam(code, flag = true) {
      var vm = this
      if (flag) {
        delete this.form.team
      }
      var params = {
        hospital: code
      }
      httpRequest.get('statisticsExport/teamList', { data: params }).then(function (res) {
        vm.teamOptions = res.data
      })
    },
    load(row, treeNode, resolve) {
      var params = {}
      var len = row.code.length
      if (len == 6) {
        params.range = 'hospital'
        params.area = row.code
      } else if (len == 10) {
        params.range = 'team'
        params.hospital = row.code
      }
      if (this.yearType == '1') {
        params.startDate = this.chooseYear + '-01-01'
        params.endDate = this.chooseYear + '-12-31'
      } else {
        if (this.chooseTime) {
          params.startDate = this.chooseTime[0]
          params.endDate = this.chooseTime[1]
        }
      }
      httpRequest.get('statistics/collaborate/gxbTurnDownInfo', { data: params }).then(function (res) {
        if (res.status == 200) {
          var children = res.detailModelList.map(function (item) {
            var data = JSON.parse(JSON.stringify(item))
            if (len == 6) {
              data.hospital = item.name
              data.hasChildren = true
            } else if (len == 10) {
              data.team = item.name
            }
            return data
          })
          resolve(children)
        }
      })
    },
    dialogSearchFn() {
      this.page = 1
      if (this.title == '康复下转明细列表') {
        this.rehabilitationPatientInfo()
      } else if (this.title == '下转情况数据列表') {
        this.turnDownDataPage()
      }
    },
    dialogExportFn() {
      var vm = this
      var params = {
        ...this.query
      }
      if (this.title == '康复下转明细列表') {
        if (this.yearType == '1') {
          params.startTime = this.chooseYear + '-01-01'
          params.endTime = this.chooseYear + '-12-31'
        } else {
          if (this.chooseTime) {
            params.startTime = this.chooseTime[0]
            params.endTime = this.chooseTime[1]
          }
        }
        this.dialogExportLoading = true
        var fileName = `康复下转明细列表${new Date().getTime()}.xls`
        httpRequest.downLoadFileForAjax('doctor/specialist/rehabilitation/exportRehabilitationPatientInfo', fileName, params).then(function () {
          vm.dialogExportLoading = false
        })
      } else {
        if (this.yearType == '1') {
          params.startDate = this.chooseYear + '-01-01'
          params.endDate = this.chooseYear + '-12-31'
        } else {
          if (this.chooseTime) {
            params.startDate = this.chooseTime[0]
            params.endDate = this.chooseTime[1]
          }
        }
        this.dialogExportLoading = true
        var fileName = `冠心病下转情况统计表${new Date().getTime()}.xls`
        httpRequest.downLoadFileForAjax('statistics/collaborate/exportTurnDownDataPage', fileName, params).then(function () {
          vm.dialogExportLoading = false
        })
      }
    },
    dialogReset() {
      var params = {
        ...this.query
      }
      if (this.title == '康复下转明细列表') {
        this.query = {
          status: '',
          hospitalCode: '',
          orgCode: '',
          archiveStatus: '',
          patientType: '',
          range: typeof params.range == 'undefined' ? '' : params.range,
          area: typeof params.area == 'undefined' ? '' : params.area,
          hospital: typeof params.hospital == 'undefined' ? '' : params.hospital,
          team: typeof params.team == 'undefined' ? '' : params.team
        }
      } else if (this.title == '下转情况数据列表') {
        this.query = {
          sex: '',
          isSign: '',
          eventType: '',
          range: params.range,
          area: params.area,
          hospital: params.hospital,
          team: params.team
        }
      }
    },
    handleCurrentChange(val) {
      this.page = val
      if (this.title == '康复下转明细列表') {
        this.rehabilitationPatientInfo()
      } else if (this.title == '下转情况数据列表') {
        this.turnDownDataPage()
      }
    },
    handleSizeChange(val) {
      this.size = val
      if (this.title == '康复下转明细列表') {
        this.rehabilitationPatientInfo()
      } else if (this.title == '下转情况数据列表') {
        this.turnDownDataPage()
      }
    },
    // 获取社区医院
    hospitalsByType() {
      var vm = this
      // var code
      var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
      if (selectedRole.code.indexOf('350200') > -1) {
        code = '350200' //  市卫健委
      } else if (selectedRole.code.length == 6) {
        code = selectedRole.code
      } else {
        this.level = 3 // 社区管理
      }
      if (selectedRole.code.length > 6) {
        this.communityHospitals = [{ label: selectedRole.name, value: selectedRole.code }]
      } else {
        var type = 1
        if (selectedRole.code.indexOf('350200') > -1) {
          type = 1 //  市卫健委
        } else if (selectedRole.code.length == 6) {
          type = 2
        }
        statisticAPI
          .hospitalsByType({
            type: type,
            code: selectedRole.code
          })
          .then(function (res) {
            if (res.status == 200) {
              vm.communityHospitals = [{ label: '全部', value: '' }]
              res.list.forEach(function (v) {
                vm.communityHospitals.push({
                  value: v.code,
                  label: v.name
                })
              })
            }
          })
          .catch(function (err) {
            console.log(err, 'Errr')
          })
      }
    },
    openDialog(row, prop) {
      if (!row.code) return
      this.page = 1
      if (['totalTimes', 'mzTimes', 'zyTimes'].includes(prop)) {
        this.query = {
          status: '',
          hospitalCode: '',
          orgCode: '',
          archiveStatus: '',
          patientType: ''
        }
        this.visible = true
        this.title = '康复下转明细列表'
        this.dialogHeader = [
          { label: '姓名', prop: 'name' },
          { label: '性别', prop: 'sex' },
          { label: '年龄', prop: 'age' },
          { label: '手机号', prop: 'mobile' },
          { label: '下转医院', prop: 'hospitalName' },
          { label: '下转医生', prop: 'hospitalDoctor' },
          { label: '下转时间', prop: 'createTime' },
          { label: '患者类型', prop: 'patientType' },
          { label: '下转状态', prop: 'statusName' },
          { label: '接收社区医院', prop: 'orgName' },
          { label: '接收签约医生', prop: 'doctorName' },
          { label: '接收时间', prop: 'receiveTime' },
          { label: '档案状态', prop: 'archiveStatusName' }
        ]
        switch (prop) {
          case 'mzTimes':
            this.query.patientType = '1'
            break
          case 'zyTimes':
            this.query.patientType = '2'
            break
        }
      } else if (['totalNum', 'mzNum', 'zyNum'].includes(prop)) {
        this.visible = true
        this.title = '下转情况数据列表'
        this.query = {
          sex: '',
          isSign: '',
          eventType: ''
        }
        this.dialogHeader = [
          { label: '姓名', prop: 'name' },
          { label: '性别', prop: 'sex' },
          { label: '年龄', prop: 'age' },
          { label: '手机号', prop: 'mobile' },
          { label: '是否签约', prop: 'isSign' },
          { label: '社区医院', prop: 'hospitalName' },
          { label: '下转次数', prop: 'num' },
          { label: '最近一次下转诊断', prop: 'diagnosisName' },
          { label: '最近一次下转时间', prop: 'turnDownTime' },
          { label: '最近一次下转类型', prop: 'eventType' }
        ]
        switch (prop) {
          case 'mzNum':
            this.query.eventType = '1'
            break
          case 'zyNum':
            this.query.eventType = '2'
            break
        }
      }
      var len = row.code.length
      if (len == 6) {
        this.query.range = 'town'
        this.query.area = row.code
      } else if (len == 10) {
        this.query.range = 'hospital'
        this.query.hospital = row.code
      } else {
        this.query.range = 'team'
        this.query.team = row.code
      }
      this.dataRangeOption = [{ label: row.name, value: row.code }]
      if (['totalTimes', 'mzTimes', 'zyTimes'].includes(prop)) {
        this.rehabilitationPatientInfo()
      } else if (['totalNum', 'mzNum', 'zyNum'].includes(prop)) {
        this.turnDownDataPage()
      }
    },
    // 康复下转操作
    operation(num, item) {
      var vm = this
      if (num != 2) {
        statisticAPI
          .synchronizePationSingle({ id: item.id })
          .then(function (res) {
            if (res.status == 200) {
              vm.$message.success('操作成功')
            } else {
              vm.$message.error(res.msg)
            }
          })
          .catch(function (err) {
            console.log(err, 'Errr')
          })
      } else {
        vm.signatoryList = []
        statisticAPI
          .kangfuGetSignInfo({ idcard: item.idcard })
          .then(function (res) {
            if (res.status == 200) {
              if (res.data != null) {
                vm.signatoryList.push(res.data)
              }
            }
          })
          .catch(function (err) {
            console.log(err, 'Errr')
          })
        vm.dialogVisible = true
      }
    },
    rehabilitationPatientInfo() {
      var vm = this
      var params = {
        ...this.query,
        page: this.page,
        size: this.size,
        disease: 3
      }
      if (this.yearType == '1') {
        params.startTime = this.chooseYear + '-01-01'
        params.endTime = this.chooseYear + '-12-31'
      } else {
        if (this.chooseTime) {
          params.startTime = this.chooseTime[0]
          params.endTime = this.chooseTime[1]
        }
      }
      this.dialogLoading = true
      statisticAPI.rehabilitationPatientInfo(params).then(function (res) {
        if (res.status == 200) {
          res.detailModelList.forEach(function (v) {
            v.sex = v.sex == 1 ? '男' : '女'
          })
          vm.dialogTableData = res.detailModelList
          vm.total = res.totalCount
        } else {
          vm.$message.error(res.msg)
        }
        vm.dialogLoading = false
      })
    },
    turnDownDataPage() {
      var vm = this
      var params = {
        ...this.query,
        page: this.page,
        pageSize: this.size
      }
      if (this.yearType == '1') {
        params.startDate = this.chooseYear + '-01-01'
        params.endDate = this.chooseYear + '-12-31'
      } else {
        if (this.chooseTime) {
          params.startDate = this.chooseTime[0]
          params.endDate = this.chooseTime[1]
        }
      }
      this.dialogLoading = true
      httpRequest.get('statistics/collaborate/turnDownDataPage', { data: params }).then(function (res) {
        if (res.status == 200) {
          vm.dialogTableData = res.detailModelList
          vm.total = res.totalCount
        }
        vm.dialogLoading = false
      })
    },
    closeDialog() {
      this.visible = false
    },
    closeDialog1() {
      this.dialogVisible = false
    },
    getData(data) {
      if (data) {
        this.yearType = data.yearType
        this.form.range = data.range
        this.form.area = data.area
        this.form.hospital = data.hospital
        this.form.team = data.team
        if (this.yearType == 1) {
          this.chooseYear = data.time
        } else {
          this.chooseTime = data.time
        }
        if (this.form.hospital) {
          // 如果有社区code传过来就调社区医院列表接口
          this.getHospital(data.area, false)
        }
        if (this.form.team) {
          // 如果有团队code传过来就调团队列表接口
          this.getTeam(data.hospital, false)
        }
        this.searchFn()
      } else {
        this.init()
      }
    },
    seePatientDetail(row, prop) {
      console.log('uuuuuuuuuuuuuuuuu', row, prop)
      if (prop == 'name') {
        if (row.patient && this.title == '康复下转明细列表') {
          EventBus.$emit('preview-person-info', { type: '4', code: row.patient })
        } else if (row.code && this.title == '下转情况数据列表') {
          EventBus.$emit('preview-person-info', { type: '4', code: row.code })
        } else {
          this.$message.warning('未查询到该患者信息')
        }
      }
    },
    renderHeader: function (h, item) {
      var label = item.column.label
      var column = item.column
      var tooltip = {
        '签约社区': '显示为该患者当前的签约社区医院名称',
        '社区医院': '显示为该患者当前的签约社区医院名称',
        '签约医院': '显示为该患者当前的签约社区医院名称',
        '签约医生': '显示为该患者当前的签约社区医生名称',
        '家庭医生': '显示为该患者当前的签约社区医生名称'
      }
      if (label == '签约社区' || label == '签约医生' || label == '签约医院' || label == '家庭医生' || label == '社区医院') {
        return [
          label,
          h(
            'el-tooltip',
            {
              props: {
                content: (function () {
                  return tooltip[label]
                })(),
                placement: 'top'
              }
            },
            [
              h('span', {
                class: {
                  'el-icon-question': true
                }
              })
            ]
          )
        ]
      } else {
        return [column.label]
      }
    }
  },
  mounted() {}
})

+ 194 - 0
component/statistics/LascProgress/index.html

@ -0,0 +1,194 @@
<!-- css文件位置位于/component/common/jtbc.css -->
<div id="app" class="jtbc">
  <div class="copd-filter-group ui-col-1 bgc-fff" style="min-width: 900px">
    <div class="searchDiv pb20 pr20">
      <label class="c-333 c-f14">
        <el-radio v-model="yearType" label="1">按下转年份:</el-radio>
        <el-select v-model="chooseYear" class="formWidth wd160">
          <el-option v-for="(item , index) in years" :key="index" :label="item" :value="item"></el-option>
        </el-select>
      </label>
    </div>
    <div class="searchDiv pb20 pr20">
      <label class="c-333 c-f14" style="display: flex; align-items: center">
        <el-radio v-model="yearType" label="2">自定义下转时间:</el-radio>
        <el-date-picker
          v-model="chooseTime"
          type="daterange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          value-format="yyyy-MM-dd"></el-date-picker>
      </label>
    </div>
    <div class="searchDiv pb20 pr20">
      <label class="c-333 c-f14">数据范围:</label>
      <el-select class="formWidth" v-model="form.range" placeholder="请选择" @change="resetArea">
        <el-option v-for="(option, index) in rangeOptions" :label="option.label" :value="option.value" :key="option.value"></el-option>
      </el-select>
    </div>
    <div class="searchDiv pb20 pr20">
      <label class="c-333 c-f14">地区:</label>
      <el-select class="formWidth" v-model="form.area" placeholder="请选择" @change="getHospital">
        <el-option v-for="(option, index) in areaOptions" :label="option.label" :value="option.value" :key="option.value"></el-option>
      </el-select>
    </div>
    <div class="searchDiv pb20 pr20" v-if="form.range == 'hospital'||form.range == 'team'">
      <label class="c-333 c-f14">社区:</label>
      <el-select class="formWidth" v-model="form.hospital" placeholder="请选择" @change="getTeam">
        <el-option v-for="(option, index) in hospitalOptions" :label="option.name" :value="option.code" :key="option.code"></el-option>
      </el-select>
    </div>
    <div class="searchDiv pb20 pr20" v-if="form.range == 'team'">
      <label class="c-333 c-f14">团队:</label>
      <el-select class="formWidth" v-model="form.team" placeholder="请选择">
        <el-option v-for="(option, index) in teamOptions" :label="option.name" :value="option.id" :key="option.id"></el-option>
      </el-select>
    </div>
    <div class="searchDiv pb20">
      <el-button type="primary" size="mini" @click="searchFn">查询</el-button>
      <el-button type="ff9526" size="mini" @click="exportTable" :disabled="exportLoading">导出</el-button>
      <span class="eliminate" @click="eliminateClick">清除筛选条件</span>
    </div>
  </div>
  <el-table :data="tableData" style="width: 100%" v-loading="loading" row-key="code" lazy :load="load" :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
    <el-table-column :label="item.label" v-for="item in tableHeader" :min-width="item.width" :key="item.prop" :prop="item.prop">
      <template slot-scope="scope">
        <span
          :class="`${['totalTimes','mzTimes','zyTimes','totalNum','mzNum','zyNum'].includes(item.prop)&&scope.row.code?'pointer c-409eff':''}`"
          @click="openDialog(scope.row, item.prop)">
          {{scope.row[item.prop]}}
        </span>
      </template>
    </el-table-column>
  </el-table>
  <el-dialog :visible.sync="visible" :title="title" @close="closeDialog" width="1200px">
    <el-form inline size="mini">
      <el-form-item label="居民姓名:">
        <el-input v-model="query.patientName" placeholder="请输入居民姓名查询"></el-input>
      </el-form-item>
      <template v-if="title=='康复下转明细列表'">
        <el-form-item label="下转医生:">
          <el-input v-model="query.hospitalDoctor" placeholder="请输入下转医生查询"></el-input>
        </el-form-item>
        <el-form-item label="接收医生:">
          <el-input v-model="query.doctor" placeholder="请输入接收医生查询"></el-input>
        </el-form-item>
        <el-form-item label="下转状态:">
          <el-select v-model="query.status" placeholder="请选择">
            <el-option v-for="(option, index) in statusOptions" :label="option.value" :value="option.code" :key="option.code"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="下转医院:">
          <el-select v-model="query.hospitalCode" placeholder="请选择" filterable>
            <el-option v-for="(option, index) in rehabilitationHospital" :label="option.value" :value="option.code" :key="option.code"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="接收社区医院:">
          <el-select v-model="query.orgCode" placeholder="请选择" filterable>
            <el-option v-for="(option, index) in communityHospitals" :value="option.value" :label="option.label" :key="option.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="档案状态:">
          <el-select v-model="query.archiveStatus" placeholder="请选择">
            <el-option v-for="(item,index) in archiveList" :value="item.code" :label="item.value" :key="item.code"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="患者类型:">
          <el-select v-model="query.patientType" placeholder="请选择">
            <el-option v-for="(item,index) in inviteStatus" :value="item.value" :label="item.label" :key="item.value"></el-option>
          </el-select>
        </el-form-item>
      </template>
      <template v-else>
        <el-form-item label="签约医院:">
          <el-input v-model="query.signHospitalName" placeholder="请输入签约医院查询"></el-input>
        </el-form-item>
        <el-form-item label="手机号码:">
          <el-input v-model="query.mobile" placeholder="请输入手机号码查询"></el-input>
        </el-form-item>
        <el-form-item label="性别:">
          <el-select v-model="query.sex">
            <el-option label="全部" value=""></el-option>
            <el-option label="男" value="1"></el-option>
            <el-option label="女" value="2"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="是否签约:">
          <el-select v-model="query.isSign">
            <el-option label="全部" value=""></el-option>
            <el-option label="是" value="1"></el-option>
            <el-option label="否" value="2"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="下转类型:">
          <el-select v-model="query.eventType">
            <el-option label="全部" value=""></el-option>
            <el-option label="门诊" value="1"></el-option>
            <el-option label="住院" value="2"></el-option>
          </el-select>
        </el-form-item>
      </template>
      <el-form-item label="数据范围:">
        <el-select v-model="query.range" disabled>
          <el-option v-for="item in rangeOptions" :value="item.value" :label="item.label" :key="item.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="地区:" v-if="query.range == 'town'">
        <el-select v-model="query.area" disabled>
          <el-option v-for="(option, index) in dataRangeOption" :label="option.label" :value="option.value" :key="option.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="社区:" v-if="query.range == 'hospital'">
        <el-select v-model="query.hospital" disabled>
          <el-option v-for="(option, index) in dataRangeOption" :label="option.label" :value="option.value" :key="option.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="团队:" v-if="query.range == 'team'">
        <el-select v-model="query.team" disabled>
          <el-option v-for="(option, index) in dataRangeOption" :label="option.label" :value="option.value" :key="option.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="dialogSearchFn">查询</el-button>
        <el-button type="warning" @click="dialogExportFn" :disabled="dialogExportLoading">导出</el-button>
        <span @click="dialogReset" style="color: #676a6c; cursor: pointer">清除筛选条件</span>
      </el-form-item>
    </el-form>
    <el-table :data="dialogTableData" border v-loading="dialogLoading">
      <el-table-column label="序号" type="index"></el-table-column>
      <el-table-column v-for="item in dialogHeader" :label="item.label" :render-header="renderHeader">
        <template slot-scope="scope">
          <span :class="`${item.prop=='name'?'pointer c-409eff':''}`" @click="seePatientDetail(scope.row, item.prop)">{{scope.row[item.prop]}}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" width="100" v-if="title=='康复下转明细列表'">
        <template slot-scope="scope">
          <el-button type="text" v-if="scope.row.status==0" @click="operation(1,scope.row)">分配</el-button>
          <el-button type="text" @click="operation(2,scope.row)">查看签约</el-button>
          <el-button type="text" v-if="scope.row.status==5" @click="operation(3,scope.row)">同步居民</el-button>
          <el-button type="text" v-if="scope.row.status==3" @click="operation(4,scope.row)">同步病历</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div style="display: flex; justify-content: flex-end; margin-top: 10px">
      <el-pagination
        @current-change="handleCurrentChange"
        @size-change="handleSizeChange"
        :current-page.sync="page"
        :page-size="size"
        :page-sizes="[10, 20, 50]"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"></el-pagination>
    </div>
  </el-dialog>
  <el-dialog title="查看签约信息" :visible.sync="dialogVisible" width="70%" append-to-body>
    <el-table border :data="signatoryList" style="width: 100%" height="500" class="mt20">
      <el-table-column prop="hospitalName" label="签约社区医院" align="center"></el-table-column>
      <el-table-column prop="doctorName" label="签约医生" align="center"></el-table-column>
      <el-table-column prop="applyDate" label="签约时间" align="center"></el-table-column>
      <el-table-column prop="signYear" label="签约年度" align="center"></el-table-column>
    </el-table>
  </el-dialog>
</div>

+ 711 - 0
component/statistics/LascProgress/index.js

@ -0,0 +1,711 @@
var template = ''
$.ajax('../../../component/statistics/LascProgress/index.html', {
  data: {},
  dataType: 'html',
  cache: false,
  timeout: 60000,
  async: false,
  error: function (res) {},
  success: function (res) {
    template = res
  }
})
Vue.component('lasc-progress', {
  template: template,
  props: [],
  data: function () {
    return {
      years: [],
      yearType: '1',
      chooseYear: null,
      chooseTime: null,
      rangeOptions: [
        { label: '区', value: 'town' },
        { label: '社区', value: 'hospital' },
        { label: '团队', value: 'team' }
      ],
      areaOptions: [
        { label: '思明区', value: '350203' },
        { label: '海沧区', value: '350205' },
        { label: '湖里区', value: '350206' },
        { label: '集美区', value: '350211' },
        { label: '同安区', value: '350212' },
        { label: '翔安区', value: '350213' }
      ],
      hospitalOptions: [],
      teamOptions: [],
      form: {
        range: 'town'
      },
      loading: false,
      exportLoading: false,
      tableData: [],
      tableHeader: [],
      constantHeader: [
        { label: '下转次数', prop: 'totalTimes', width: '90' },
        { label: '门诊下转次数', prop: 'mzTimes', width: '110' },
        { label: '出院下转次数', prop: 'zyTimes', width: '110' },
        { label: '下转人数', prop: 'totalNum', width: '110' },
        { label: '门诊下转人数', prop: 'mzNum', width: '110' },
        { label: '出院下转人数', prop: 'zyNum', width: '110' },
        { label: '门诊下转已评估', prop: 'mzScreenNum', width: '120' },
        { label: '门诊下转未评估', prop: 'unMzScreenNum', width: '120' },
        { label: '出院下转已评估', prop: 'zyScreenNum', width: '120' },
        { label: '出院下转未评估', prop: 'unZyScreenNum', width: '120' }
      ],
      level: 0,
      visible: false,
      query: {},
      dataRangeOption: [],
      dialogTableData: [],
      dialogHeader: [],
      page: 1,
      size: 10,
      total: 0,
      messageVisible: false,
      messInfo: null,
      remind: '',
      dialogLoading: false,
      dialogExportLoading: false,
      statusOptions: [],
      rehabilitationHospital: [],
      archiveList: [],
      inviteStatus: [
        { value: '', label: '全部' },
        { value: '1', label: '门诊患者' },
        { value: '2', label: '出院患者' }
      ],
      communityHospitals: [],
      title: '',
      dialogVisible: false,
      signatoryList: []
    }
  },
  methods: {
    init() {
      var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
      if (selectedRole.code.indexOf('350200') > -1) {
        this.level = 1 //  市卫健委
        this.areaOptions = [
          { label: '厦门市', value: '' },
          { label: '思明区', value: '350203' },
          { label: '海沧区', value: '350205' },
          { label: '湖里区', value: '350206' },
          { label: '集美区', value: '350211' },
          { label: '同安区', value: '350212' },
          { label: '翔安区', value: '350213' }
        ]
      } else if (selectedRole.code.length == 6) {
        this.level = 2 // 区管理
        this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }]
        this.form = {
          range: 'town',
          area: selectedRole.code
        }
        this.getHospital(selectedRole.code)
      } else {
        this.level = 3 // 社区管理
        this.rangeOptions = [
          { label: '社区', value: 'hospital' },
          { label: '团队', value: 'team' }
        ]
        this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }]
        this.hospitalOptions = [{ name: selectedRole.name, code: selectedRole.code }]
        this.form = {
          range: 'hospital',
          area: selectedRole.code.substring(0, 6),
          hospital: selectedRole.code
        }
        this.getTeam(selectedRole.code)
      }
      this.initTime()
      this.searchFn()
      this.getDictData()
      this.hospitalsByType()
    },
    initTime() {
      var vm = this
      var now = new Date()
      vm.nowyear = vm.chooseYear = now.getFullYear()
      vm.years = []
      for (i = vm.nowyear; i >= 2013; i--) {
        vm.years.push(i)
      }
    },
    resetArea() {
      if (this.level == 1) {
        delete this.form.area
        delete this.form.hospital
        delete this.form.team
      } else if (this.level == 2) {
        delete this.form.hospital
        delete this.form.team
      } else {
        delete this.form.team
      }
    },
    getDictData() {
      var vm = this
      statisticAPI.getDictByDictName({ name: 'rehabilitation_status' }).then(function (res) {
        vm.statusOptions = [{ value: '全部', code: '' }]
        vm.statusOptions = vm.statusOptions.concat(res.list)
      })
      statisticAPI.getDictByDictName({ name: 'rehabilitation_hospital' }).then(function (res) {
        vm.rehabilitationHospital = [{ value: '全部', code: '' }]
        vm.rehabilitationHospital = vm.rehabilitationHospital.concat(res.list)
      })
      statisticAPI.getDictByDictName({ name: 'archive_status' }).then(function (res) {
        vm.archiveList = [{ value: '全部', code: '' }]
        vm.archiveList = vm.archiveList.concat(res.list)
      })
    },
    searchFn() {
      var vm = this
      this.loading = true
      var params = {
        ...this.form,
        isTotal: 1
      }
      vm.tableData = []
      if (this.yearType == '1') {
        params.startDate = this.chooseYear + '-01-01'
        params.endDate = this.chooseYear + '-12-31'
      } else {
        if (this.chooseTime) {
          params.startDate = this.chooseTime[0]
          params.endDate = this.chooseTime[1]
        }
      }
      if (this.form.range == 'town') {
        this.tableHeader = getTownHeader().concat(this.constantHeader)
      } else if (this.form.range == 'hospital') {
        this.tableHeader = getHospitalHeader().concat(this.constantHeader)
      } else {
        this.tableHeader = getTeamHeader().concat(this.constantHeader)
      }
      httpRequest.get('statistics/collaborate/gxbTurnDownInfo', { data: params }).then(function (res) {
        if (res.status == 200) {
          vm.tableData = res.detailModelList.map(function (item) {
            var data = JSON.parse(JSON.stringify(item))
            if (vm.form.range == 'town') {
              data.town = item.name
              data.hasChildren = data.code && true
            } else if (vm.form.range == 'hospital') {
              data.hospital = item.name
              data.hasChildren = data.code && true
            } else if (vm.form.range == 'team') {
              data.team = item.name
            }
            return data
          })
        }
        vm.loading = false
      })
    },
    exportTable() {
      var vm = this
      var params = {
        ...this.form
      }
      if (this.yearType == '1') {
        params.startDate = this.chooseYear + '-01-01'
        params.endDate = this.chooseYear + '-12-31'
      } else {
        if (this.chooseTime) {
          params.startDate = this.chooseTime[0]
          params.endDate = this.chooseTime[1]
        }
      }
      this.exportLoading = true
      var fileName = `冠心病门诊下转统计表${new Date().getTime()}.xls`
      httpRequest.downLoadFileForAjax('statistics/collaborate/exportGxbTurnDownInfo', fileName, params).then(function () {
        vm.exportLoading = false
      })
    },
    eliminateClick() {
      var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
      if (this.level == 1) {
        this.form = {
          range: 'town'
        }
      } else if (this.level == 2) {
        this.form = {
          range: 'town',
          area: selectedRole.code
        }
        this.getHospital(selectedRole.code)
      } else {
        this.form = {
          range: 'hospital',
          area: selectedRole.code.substring(0, 6),
          hospital: selectedRole.code
        }
        this.getTeam(selectedRole.code)
      }
      this.yearType = '1'
      this.chooseYear = new Date().getFullYear()
      this.chooseTime = null
      this.$forceUpdate()
    },
    getHospital(code, flag = true) {
      var vm = this
      if (flag) {
        delete this.form.hospital
        delete this.form.team
      }
      var params = {
        type: 5,
        code: code
      }
      if (!code) {
        vm.hospitalOptions = [{ name: '全部', value: '' }]
        vm.teamOptions = [{ name: '全部', value: '' }]
        return false
      }
      httpRequest.post('common/district', { data: params }).then(function (res) {
        vm.hospitalOptions = res.list
      })
    },
    getTeam(code, flag = true) {
      var vm = this
      if (flag) {
        delete this.form.team
      }
      var params = {
        hospital: code
      }
      httpRequest.get('statisticsExport/teamList', { data: params }).then(function (res) {
        vm.teamOptions = res.data
      })
    },
    load(row, treeNode, resolve) {
      var params = {}
      var len = row.code.length
      if (len == 6) {
        params.range = 'hospital'
        params.area = row.code
      } else if (len == 10) {
        params.range = 'team'
        params.hospital = row.code
      }
      if (this.yearType == '1') {
        params.startDate = this.chooseYear + '-01-01'
        params.endDate = this.chooseYear + '-12-31'
      } else {
        if (this.chooseTime) {
          params.startDate = this.chooseTime[0]
          params.endDate = this.chooseTime[1]
        }
      }
      httpRequest.get('statistics/collaborate/gxbTurnDownInfo', { data: params }).then(function (res) {
        if (res.status == 200) {
          var children = res.detailModelList.map(function (item) {
            var data = JSON.parse(JSON.stringify(item))
            if (len == 6) {
              data.hospital = item.name
              data.hasChildren = true
            } else if (len == 10) {
              data.team = item.name
            }
            return data
          })
          resolve(children)
        }
      })
    },
    dialogSearchFn() {
      this.page = 1
      if (this.title == '康复下转明细列表') {
        this.rehabilitationPatientInfo()
      } else if (this.title == '下转情况数据列表') {
        this.turnDownDataPage()
      }
    },
    dialogExportFn() {
      var vm = this
      var params = {
        ...this.query
      }
      if (this.title == '康复下转明细列表') {
        if (this.yearType == '1') {
          params.startTime = this.chooseYear + '-01-01'
          params.endTime = this.chooseYear + '-12-31'
        } else {
          if (this.chooseTime) {
            params.startTime = this.chooseTime[0]
            params.endTime = this.chooseTime[1]
          }
        }
        this.dialogExportLoading = true
        var fileName = `康复下转明细列表${new Date().getTime()}.xls`
        httpRequest.downLoadFileForAjax('doctor/specialist/rehabilitation/exportRehabilitationPatientInfo', fileName, params).then(function () {
          vm.dialogExportLoading = false
        })
      } else {
        if (this.yearType == '1') {
          params.startDate = this.chooseYear + '-01-01'
          params.endDate = this.chooseYear + '-12-31'
        } else {
          if (this.chooseTime) {
            params.startDate = this.chooseTime[0]
            params.endDate = this.chooseTime[1]
          }
        }
        this.dialogExportLoading = true
        var fileName = `冠心病下转情况统计表${new Date().getTime()}.xls`
        httpRequest.downLoadFileForAjax('statistics/collaborate/exportTurnDownDataPage', fileName, params).then(function () {
          vm.dialogExportLoading = false
        })
      }
    },
    dialogReset() {
      var params = {
        ...this.query
      }
      if (this.title == '康复下转明细列表') {
        this.query = {
          status: '',
          hospitalCode: '',
          orgCode: '',
          archiveStatus: '',
          patientType: '',
          range: typeof params.range == 'undefined' ? '' : params.range,
          area: typeof params.area == 'undefined' ? '' : params.area,
          hospital: typeof params.hospital == 'undefined' ? '' : params.hospital,
          team: typeof params.team == 'undefined' ? '' : params.team
        }
      } else if (this.title == '下转情况数据列表') {
        this.query = {
          sex: '',
          isSign: '',
          eventType: '',
          range: params.range,
          area: params.area,
          hospital: params.hospital,
          team: params.team
        }
      }
    },
    handleCurrentChange(val) {
      this.page = val
      if (this.title == '康复下转明细列表') {
        this.rehabilitationPatientInfo()
      } else if (this.title == '下转情况数据列表') {
        this.turnDownDataPage()
      }
    },
    handleSizeChange(val) {
      this.size = val
      if (this.title == '康复下转明细列表') {
        this.rehabilitationPatientInfo()
      } else if (this.title == '下转情况数据列表') {
        this.turnDownDataPage()
      }
    },
    // 获取社区医院
    hospitalsByType() {
      var vm = this
      // var code
      var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
      if (selectedRole.code.indexOf('350200') > -1) {
        code = '350200' //  市卫健委
      } else if (selectedRole.code.length == 6) {
        code = selectedRole.code
      } else {
        this.level = 3 // 社区管理
      }
      if (selectedRole.code.length > 6) {
        this.communityHospitals = [{ label: selectedRole.name, value: selectedRole.code }]
      } else {
        var type = 1
        if (selectedRole.code.indexOf('350200') > -1) {
          type = 1 //  市卫健委
        } else if (selectedRole.code.length == 6) {
          type = 2
        }
        statisticAPI
          .hospitalsByType({
            type: type,
            code: selectedRole.code
          })
          .then(function (res) {
            if (res.status == 200) {
              vm.communityHospitals = [{ label: '全部', value: '' }]
              res.list.forEach(function (v) {
                vm.communityHospitals.push({
                  value: v.code,
                  label: v.name
                })
              })
            }
          })
          .catch(function (err) {
            console.log(err, 'Errr')
          })
      }
    },
    openDialog(row, prop) {
      if (!row.code) return
      this.page = 1
      if (['totalTimes', 'mzTimes', 'zyTimes'].includes(prop)) {
        this.query = {
          status: '',
          hospitalCode: '',
          orgCode: '',
          archiveStatus: '',
          patientType: ''
        }
        this.visible = true
        this.title = '康复下转明细列表'
        this.dialogHeader = [
          { label: '姓名', prop: 'name' },
          { label: '性别', prop: 'sex' },
          { label: '年龄', prop: 'age' },
          { label: '手机号', prop: 'mobile' },
          { label: '下转医院', prop: 'hospitalName' },
          { label: '下转医生', prop: 'hospitalDoctor' },
          { label: '下转时间', prop: 'createTime' },
          { label: '患者类型', prop: 'patientType' },
          { label: '下转状态', prop: 'statusName' },
          { label: '接收社区医院', prop: 'orgName' },
          { label: '接收签约医生', prop: 'doctorName' },
          { label: '接收时间', prop: 'receiveTime' },
          { label: '档案状态', prop: 'archiveStatusName' }
        ]
        switch (prop) {
          case 'mzTimes':
            this.query.patientType = '1'
            break
          case 'zyTimes':
            this.query.patientType = '2'
            break
        }
      } else if (['totalNum', 'mzNum', 'zyNum'].includes(prop)) {
        this.visible = true
        this.title = '下转情况数据列表'
        this.query = {
          sex: '',
          isSign: '',
          eventType: ''
        }
        this.dialogHeader = [
          { label: '姓名', prop: 'name' },
          { label: '性别', prop: 'sex' },
          { label: '年龄', prop: 'age' },
          { label: '手机号', prop: 'mobile' },
          { label: '是否签约', prop: 'isSign' },
          { label: '社区医院', prop: 'hospitalName' },
          { label: '下转次数', prop: 'num' },
          { label: '最近一次下转诊断', prop: 'diagnosisName' },
          { label: '最近一次下转时间', prop: 'turnDownTime' },
          { label: '最近一次下转类型', prop: 'eventType' }
        ]
        switch (prop) {
          case 'mzNum':
            this.query.eventType = '1'
            break
          case 'zyNum':
            this.query.eventType = '2'
            break
        }
      }
      var len = row.code.length
      if (len == 6) {
        this.query.range = 'town'
        this.query.area = row.code
      } else if (len == 10) {
        this.query.range = 'hospital'
        this.query.hospital = row.code
      } else {
        this.query.range = 'team'
        this.query.team = row.code
      }
      this.dataRangeOption = [{ label: row.name, value: row.code }]
      if (['totalTimes', 'mzTimes', 'zyTimes'].includes(prop)) {
        this.rehabilitationPatientInfo()
      } else if (['totalNum', 'mzNum', 'zyNum'].includes(prop)) {
        this.turnDownDataPage()
      }
    },
    // 康复下转操作
    operation(num, item) {
      var vm = this
      if (num != 2) {
        statisticAPI
          .synchronizePationSingle({ id: item.id })
          .then(function (res) {
            if (res.status == 200) {
              vm.$message.success('操作成功')
            } else {
              vm.$message.error(res.msg)
            }
          })
          .catch(function (err) {
            console.log(err, 'Errr')
          })
      } else {
        vm.signatoryList = []
        statisticAPI
          .kangfuGetSignInfo({ idcard: item.idcard })
          .then(function (res) {
            if (res.status == 200) {
              if (res.data != null) {
                vm.signatoryList.push(res.data)
              }
            }
          })
          .catch(function (err) {
            console.log(err, 'Errr')
          })
        vm.dialogVisible = true
      }
    },
    rehabilitationPatientInfo() {
      var vm = this
      var params = {
        ...this.query,
        page: this.page,
        size: this.size,
        disease: 3
      }
      if (this.yearType == '1') {
        params.startTime = this.chooseYear + '-01-01'
        params.endTime = this.chooseYear + '-12-31'
      } else {
        if (this.chooseTime) {
          params.startTime = this.chooseTime[0]
          params.endTime = this.chooseTime[1]
        }
      }
      this.dialogLoading = true
      statisticAPI.rehabilitationPatientInfo(params).then(function (res) {
        if (res.status == 200) {
          res.detailModelList.forEach(function (v) {
            v.sex = v.sex == 1 ? '男' : '女'
          })
          vm.dialogTableData = res.detailModelList
          vm.total = res.totalCount
        } else {
          vm.$message.error(res.msg)
        }
        vm.dialogLoading = false
      })
    },
    turnDownDataPage() {
      var vm = this
      var params = {
        ...this.query,
        page: this.page,
        pageSize: this.size
      }
      if (this.yearType == '1') {
        params.startDate = this.chooseYear + '-01-01'
        params.endDate = this.chooseYear + '-12-31'
      } else {
        if (this.chooseTime) {
          params.startDate = this.chooseTime[0]
          params.endDate = this.chooseTime[1]
        }
      }
      this.dialogLoading = true
      httpRequest.get('statistics/collaborate/turnDownDataPage', { data: params }).then(function (res) {
        if (res.status == 200) {
          vm.dialogTableData = res.detailModelList
          vm.total = res.totalCount
        }
        vm.dialogLoading = false
      })
    },
    closeDialog() {
      this.visible = false
    },
    closeDialog1() {
      this.dialogVisible = false
    },
    getData(data) {
      if (data) {
        this.yearType = data.yearType
        this.form.range = data.range
        this.form.area = data.area
        this.form.hospital = data.hospital
        this.form.team = data.team
        if (this.yearType == 1) {
          this.chooseYear = data.time
        } else {
          this.chooseTime = data.time
        }
        if (this.form.hospital) {
          // 如果有社区code传过来就调社区医院列表接口
          this.getHospital(data.area, false)
        }
        if (this.form.team) {
          // 如果有团队code传过来就调团队列表接口
          this.getTeam(data.hospital, false)
        }
        this.searchFn()
      } else {
        this.init()
      }
    },
    seePatientDetail(row, prop) {
      console.log('uuuuuuuuuuuuuuuuu', row, prop)
      if (prop == 'name') {
        if (row.patient && this.title == '康复下转明细列表') {
          EventBus.$emit('preview-person-info', { type: '4', code: row.patient })
        } else if (row.code && this.title == '下转情况数据列表') {
          EventBus.$emit('preview-person-info', { type: '4', code: row.code })
        } else {
          this.$message.warning('未查询到该患者信息')
        }
      }
    },
    renderHeader: function (h, item) {
      var label = item.column.label
      var column = item.column
      var tooltip = {
        '签约社区': '显示为该患者当前的签约社区医院名称',
        '社区医院': '显示为该患者当前的签约社区医院名称',
        '签约医院': '显示为该患者当前的签约社区医院名称',
        '签约医生': '显示为该患者当前的签约社区医生名称',
        '家庭医生': '显示为该患者当前的签约社区医生名称'
      }
      if (label == '签约社区' || label == '签约医生' || label == '签约医院' || label == '家庭医生' || label == '社区医院') {
        return [
          label,
          h(
            'el-tooltip',
            {
              props: {
                content: (function () {
                  return tooltip[label]
                })(),
                placement: 'top'
              }
            },
            [
              h('span', {
                class: {
                  'el-icon-question': true
                }
              })
            ]
          )
        ]
      } else {
        return [column.label]
      }
    }
  },
  mounted() {}
})

+ 194 - 0
component/statistics/LascProgressData/index.html

@ -0,0 +1,194 @@
<!-- css文件位置位于/component/common/jtbc.css -->
<div id="app" class="jtbc">
  <div class="copd-filter-group ui-col-1 bgc-fff" style="min-width: 900px">
    <div class="searchDiv pb20 pr20">
      <label class="c-333 c-f14">
        <el-radio v-model="yearType" label="1">按下转年份:</el-radio>
        <el-select v-model="chooseYear" class="formWidth wd160">
          <el-option v-for="(item , index) in years" :key="index" :label="item" :value="item"></el-option>
        </el-select>
      </label>
    </div>
    <div class="searchDiv pb20 pr20">
      <label class="c-333 c-f14" style="display: flex; align-items: center">
        <el-radio v-model="yearType" label="2">自定义下转时间:</el-radio>
        <el-date-picker
          v-model="chooseTime"
          type="daterange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          value-format="yyyy-MM-dd"></el-date-picker>
      </label>
    </div>
    <div class="searchDiv pb20 pr20">
      <label class="c-333 c-f14">数据范围:</label>
      <el-select class="formWidth" v-model="form.range" placeholder="请选择" @change="resetArea">
        <el-option v-for="(option, index) in rangeOptions" :label="option.label" :value="option.value" :key="option.value"></el-option>
      </el-select>
    </div>
    <div class="searchDiv pb20 pr20">
      <label class="c-333 c-f14">地区:</label>
      <el-select class="formWidth" v-model="form.area" placeholder="请选择" @change="getHospital">
        <el-option v-for="(option, index) in areaOptions" :label="option.label" :value="option.value" :key="option.value"></el-option>
      </el-select>
    </div>
    <div class="searchDiv pb20 pr20" v-if="form.range == 'hospital'||form.range == 'team'">
      <label class="c-333 c-f14">社区:</label>
      <el-select class="formWidth" v-model="form.hospital" placeholder="请选择" @change="getTeam">
        <el-option v-for="(option, index) in hospitalOptions" :label="option.name" :value="option.code" :key="option.code"></el-option>
      </el-select>
    </div>
    <div class="searchDiv pb20 pr20" v-if="form.range == 'team'">
      <label class="c-333 c-f14">团队:</label>
      <el-select class="formWidth" v-model="form.team" placeholder="请选择">
        <el-option v-for="(option, index) in teamOptions" :label="option.name" :value="option.id" :key="option.id"></el-option>
      </el-select>
    </div>
    <div class="searchDiv pb20">
      <el-button type="primary" size="mini" @click="searchFn">查询</el-button>
      <el-button type="ff9526" size="mini" @click="exportTable" :disabled="exportLoading">导出</el-button>
      <span class="eliminate" @click="eliminateClick">清除筛选条件</span>
    </div>
  </div>
  <el-table :data="tableData" style="width: 100%" v-loading="loading" row-key="code" lazy :load="load" :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
    <el-table-column :label="item.label" v-for="item in tableHeader" :min-width="item.width" :key="item.prop" :prop="item.prop">
      <template slot-scope="scope">
        <span
          :class="`${['totalTimes','mzTimes','zyTimes','totalNum','mzNum','zyNum'].includes(item.prop)&&scope.row.code?'pointer c-409eff':''}`"
          @click="openDialog(scope.row, item.prop)">
          {{scope.row[item.prop]}}
        </span>
      </template>
    </el-table-column>
  </el-table>
  <el-dialog :visible.sync="visible" :title="title" @close="closeDialog" width="1200px">
    <el-form inline size="mini">
      <el-form-item label="居民姓名:">
        <el-input v-model="query.patientName" placeholder="请输入居民姓名查询"></el-input>
      </el-form-item>
      <template v-if="title=='康复下转明细列表'">
        <el-form-item label="下转医生:">
          <el-input v-model="query.hospitalDoctor" placeholder="请输入下转医生查询"></el-input>
        </el-form-item>
        <el-form-item label="接收医生:">
          <el-input v-model="query.doctor" placeholder="请输入接收医生查询"></el-input>
        </el-form-item>
        <el-form-item label="下转状态:">
          <el-select v-model="query.status" placeholder="请选择">
            <el-option v-for="(option, index) in statusOptions" :label="option.value" :value="option.code" :key="option.code"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="下转医院:">
          <el-select v-model="query.hospitalCode" placeholder="请选择" filterable>
            <el-option v-for="(option, index) in rehabilitationHospital" :label="option.value" :value="option.code" :key="option.code"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="接收社区医院:">
          <el-select v-model="query.orgCode" placeholder="请选择" filterable>
            <el-option v-for="(option, index) in communityHospitals" :value="option.value" :label="option.label" :key="option.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="档案状态:">
          <el-select v-model="query.archiveStatus" placeholder="请选择">
            <el-option v-for="(item,index) in archiveList" :value="item.code" :label="item.value" :key="item.code"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="患者类型:">
          <el-select v-model="query.patientType" placeholder="请选择">
            <el-option v-for="(item,index) in inviteStatus" :value="item.value" :label="item.label" :key="item.value"></el-option>
          </el-select>
        </el-form-item>
      </template>
      <template v-else>
        <el-form-item label="签约医院:">
          <el-input v-model="query.signHospitalName" placeholder="请输入签约医院查询"></el-input>
        </el-form-item>
        <el-form-item label="手机号码:">
          <el-input v-model="query.mobile" placeholder="请输入手机号码查询"></el-input>
        </el-form-item>
        <el-form-item label="性别:">
          <el-select v-model="query.sex">
            <el-option label="全部" value=""></el-option>
            <el-option label="男" value="1"></el-option>
            <el-option label="女" value="2"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="是否签约:">
          <el-select v-model="query.isSign">
            <el-option label="全部" value=""></el-option>
            <el-option label="是" value="1"></el-option>
            <el-option label="否" value="2"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="下转类型:">
          <el-select v-model="query.eventType">
            <el-option label="全部" value=""></el-option>
            <el-option label="门诊" value="1"></el-option>
            <el-option label="住院" value="2"></el-option>
          </el-select>
        </el-form-item>
      </template>
      <el-form-item label="数据范围:">
        <el-select v-model="query.range" disabled>
          <el-option v-for="item in rangeOptions" :value="item.value" :label="item.label" :key="item.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="地区:" v-if="query.range == 'town'">
        <el-select v-model="query.area" disabled>
          <el-option v-for="(option, index) in dataRangeOption" :label="option.label" :value="option.value" :key="option.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="社区:" v-if="query.range == 'hospital'">
        <el-select v-model="query.hospital" disabled>
          <el-option v-for="(option, index) in dataRangeOption" :label="option.label" :value="option.value" :key="option.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="团队:" v-if="query.range == 'team'">
        <el-select v-model="query.team" disabled>
          <el-option v-for="(option, index) in dataRangeOption" :label="option.label" :value="option.value" :key="option.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="dialogSearchFn">查询</el-button>
        <el-button type="warning" @click="dialogExportFn" :disabled="dialogExportLoading">导出</el-button>
        <span @click="dialogReset" style="color: #676a6c; cursor: pointer">清除筛选条件</span>
      </el-form-item>
    </el-form>
    <el-table :data="dialogTableData" border v-loading="dialogLoading">
      <el-table-column label="序号" type="index"></el-table-column>
      <el-table-column v-for="item in dialogHeader" :label="item.label" :render-header="renderHeader">
        <template slot-scope="scope">
          <span :class="`${item.prop=='name'?'pointer c-409eff':''}`" @click="seePatientDetail(scope.row, item.prop)">{{scope.row[item.prop]}}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" width="100" v-if="title=='康复下转明细列表'">
        <template slot-scope="scope">
          <el-button type="text" v-if="scope.row.status==0" @click="operation(1,scope.row)">分配</el-button>
          <el-button type="text" @click="operation(2,scope.row)">查看签约</el-button>
          <el-button type="text" v-if="scope.row.status==5" @click="operation(3,scope.row)">同步居民</el-button>
          <el-button type="text" v-if="scope.row.status==3" @click="operation(4,scope.row)">同步病历</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div style="display: flex; justify-content: flex-end; margin-top: 10px">
      <el-pagination
        @current-change="handleCurrentChange"
        @size-change="handleSizeChange"
        :current-page.sync="page"
        :page-size="size"
        :page-sizes="[10, 20, 50]"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"></el-pagination>
    </div>
  </el-dialog>
  <el-dialog title="查看签约信息" :visible.sync="dialogVisible" width="70%" append-to-body>
    <el-table border :data="signatoryList" style="width: 100%" height="500" class="mt20">
      <el-table-column prop="hospitalName" label="签约社区医院" align="center"></el-table-column>
      <el-table-column prop="doctorName" label="签约医生" align="center"></el-table-column>
      <el-table-column prop="applyDate" label="签约时间" align="center"></el-table-column>
      <el-table-column prop="signYear" label="签约年度" align="center"></el-table-column>
    </el-table>
  </el-dialog>
</div>

+ 711 - 0
component/statistics/LascProgressData/index.js

@ -0,0 +1,711 @@
var template = ''
$.ajax('../../../component/statistics/LascProgressData/index.html', {
  data: {},
  dataType: 'html',
  cache: false,
  timeout: 60000,
  async: false,
  error: function (res) {},
  success: function (res) {
    template = res
  }
})
Vue.component('lasc-progress-data', {
  template: template,
  props: [],
  data: function () {
    return {
      years: [],
      yearType: '1',
      chooseYear: null,
      chooseTime: null,
      rangeOptions: [
        { label: '区', value: 'town' },
        { label: '社区', value: 'hospital' },
        { label: '团队', value: 'team' }
      ],
      areaOptions: [
        { label: '思明区', value: '350203' },
        { label: '海沧区', value: '350205' },
        { label: '湖里区', value: '350206' },
        { label: '集美区', value: '350211' },
        { label: '同安区', value: '350212' },
        { label: '翔安区', value: '350213' }
      ],
      hospitalOptions: [],
      teamOptions: [],
      form: {
        range: 'town'
      },
      loading: false,
      exportLoading: false,
      tableData: [],
      tableHeader: [],
      constantHeader: [
        { label: '下转次数', prop: 'totalTimes', width: '90' },
        { label: '门诊下转次数', prop: 'mzTimes', width: '110' },
        { label: '出院下转次数', prop: 'zyTimes', width: '110' },
        { label: '下转人数', prop: 'totalNum', width: '110' },
        { label: '门诊下转人数', prop: 'mzNum', width: '110' },
        { label: '出院下转人数', prop: 'zyNum', width: '110' },
        { label: '门诊下转已评估', prop: 'mzScreenNum', width: '120' },
        { label: '门诊下转未评估', prop: 'unMzScreenNum', width: '120' },
        { label: '出院下转已评估', prop: 'zyScreenNum', width: '120' },
        { label: '出院下转未评估', prop: 'unZyScreenNum', width: '120' }
      ],
      level: 0,
      visible: false,
      query: {},
      dataRangeOption: [],
      dialogTableData: [],
      dialogHeader: [],
      page: 1,
      size: 10,
      total: 0,
      messageVisible: false,
      messInfo: null,
      remind: '',
      dialogLoading: false,
      dialogExportLoading: false,
      statusOptions: [],
      rehabilitationHospital: [],
      archiveList: [],
      inviteStatus: [
        { value: '', label: '全部' },
        { value: '1', label: '门诊患者' },
        { value: '2', label: '出院患者' }
      ],
      communityHospitals: [],
      title: '',
      dialogVisible: false,
      signatoryList: []
    }
  },
  methods: {
    init() {
      var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
      if (selectedRole.code.indexOf('350200') > -1) {
        this.level = 1 //  市卫健委
        this.areaOptions = [
          { label: '厦门市', value: '' },
          { label: '思明区', value: '350203' },
          { label: '海沧区', value: '350205' },
          { label: '湖里区', value: '350206' },
          { label: '集美区', value: '350211' },
          { label: '同安区', value: '350212' },
          { label: '翔安区', value: '350213' }
        ]
      } else if (selectedRole.code.length == 6) {
        this.level = 2 // 区管理
        this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }]
        this.form = {
          range: 'town',
          area: selectedRole.code
        }
        this.getHospital(selectedRole.code)
      } else {
        this.level = 3 // 社区管理
        this.rangeOptions = [
          { label: '社区', value: 'hospital' },
          { label: '团队', value: 'team' }
        ]
        this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }]
        this.hospitalOptions = [{ name: selectedRole.name, code: selectedRole.code }]
        this.form = {
          range: 'hospital',
          area: selectedRole.code.substring(0, 6),
          hospital: selectedRole.code
        }
        this.getTeam(selectedRole.code)
      }
      this.initTime()
      this.searchFn()
      this.getDictData()
      this.hospitalsByType()
    },
    initTime() {
      var vm = this
      var now = new Date()
      vm.nowyear = vm.chooseYear = now.getFullYear()
      vm.years = []
      for (i = vm.nowyear; i >= 2013; i--) {
        vm.years.push(i)
      }
    },
    resetArea() {
      if (this.level == 1) {
        delete this.form.area
        delete this.form.hospital
        delete this.form.team
      } else if (this.level == 2) {
        delete this.form.hospital
        delete this.form.team
      } else {
        delete this.form.team
      }
    },
    getDictData() {
      var vm = this
      statisticAPI.getDictByDictName({ name: 'rehabilitation_status' }).then(function (res) {
        vm.statusOptions = [{ value: '全部', code: '' }]
        vm.statusOptions = vm.statusOptions.concat(res.list)
      })
      statisticAPI.getDictByDictName({ name: 'rehabilitation_hospital' }).then(function (res) {
        vm.rehabilitationHospital = [{ value: '全部', code: '' }]
        vm.rehabilitationHospital = vm.rehabilitationHospital.concat(res.list)
      })
      statisticAPI.getDictByDictName({ name: 'archive_status' }).then(function (res) {
        vm.archiveList = [{ value: '全部', code: '' }]
        vm.archiveList = vm.archiveList.concat(res.list)
      })
    },
    searchFn() {
      var vm = this
      this.loading = true
      var params = {
        ...this.form,
        isTotal: 1
      }
      vm.tableData = []
      if (this.yearType == '1') {
        params.startDate = this.chooseYear + '-01-01'
        params.endDate = this.chooseYear + '-12-31'
      } else {
        if (this.chooseTime) {
          params.startDate = this.chooseTime[0]
          params.endDate = this.chooseTime[1]
        }
      }
      if (this.form.range == 'town') {
        this.tableHeader = getTownHeader().concat(this.constantHeader)
      } else if (this.form.range == 'hospital') {
        this.tableHeader = getHospitalHeader().concat(this.constantHeader)
      } else {
        this.tableHeader = getTeamHeader().concat(this.constantHeader)
      }
      httpRequest.get('statistics/collaborate/gxbTurnDownInfo', { data: params }).then(function (res) {
        if (res.status == 200) {
          vm.tableData = res.detailModelList.map(function (item) {
            var data = JSON.parse(JSON.stringify(item))
            if (vm.form.range == 'town') {
              data.town = item.name
              data.hasChildren = data.code && true
            } else if (vm.form.range == 'hospital') {
              data.hospital = item.name
              data.hasChildren = data.code && true
            } else if (vm.form.range == 'team') {
              data.team = item.name
            }
            return data
          })
        }
        vm.loading = false
      })
    },
    exportTable() {
      var vm = this
      var params = {
        ...this.form
      }
      if (this.yearType == '1') {
        params.startDate = this.chooseYear + '-01-01'
        params.endDate = this.chooseYear + '-12-31'
      } else {
        if (this.chooseTime) {
          params.startDate = this.chooseTime[0]
          params.endDate = this.chooseTime[1]
        }
      }
      this.exportLoading = true
      var fileName = `冠心病门诊下转统计表${new Date().getTime()}.xls`
      httpRequest.downLoadFileForAjax('statistics/collaborate/exportGxbTurnDownInfo', fileName, params).then(function () {
        vm.exportLoading = false
      })
    },
    eliminateClick() {
      var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
      if (this.level == 1) {
        this.form = {
          range: 'town'
        }
      } else if (this.level == 2) {
        this.form = {
          range: 'town',
          area: selectedRole.code
        }
        this.getHospital(selectedRole.code)
      } else {
        this.form = {
          range: 'hospital',
          area: selectedRole.code.substring(0, 6),
          hospital: selectedRole.code
        }
        this.getTeam(selectedRole.code)
      }
      this.yearType = '1'
      this.chooseYear = new Date().getFullYear()
      this.chooseTime = null
      this.$forceUpdate()
    },
    getHospital(code, flag = true) {
      var vm = this
      if (flag) {
        delete this.form.hospital
        delete this.form.team
      }
      var params = {
        type: 5,
        code: code
      }
      if (!code) {
        vm.hospitalOptions = [{ name: '全部', value: '' }]
        vm.teamOptions = [{ name: '全部', value: '' }]
        return false
      }
      httpRequest.post('common/district', { data: params }).then(function (res) {
        vm.hospitalOptions = res.list
      })
    },
    getTeam(code, flag = true) {
      var vm = this
      if (flag) {
        delete this.form.team
      }
      var params = {
        hospital: code
      }
      httpRequest.get('statisticsExport/teamList', { data: params }).then(function (res) {
        vm.teamOptions = res.data
      })
    },
    load(row, treeNode, resolve) {
      var params = {}
      var len = row.code.length
      if (len == 6) {
        params.range = 'hospital'
        params.area = row.code
      } else if (len == 10) {
        params.range = 'team'
        params.hospital = row.code
      }
      if (this.yearType == '1') {
        params.startDate = this.chooseYear + '-01-01'
        params.endDate = this.chooseYear + '-12-31'
      } else {
        if (this.chooseTime) {
          params.startDate = this.chooseTime[0]
          params.endDate = this.chooseTime[1]
        }
      }
      httpRequest.get('statistics/collaborate/gxbTurnDownInfo', { data: params }).then(function (res) {
        if (res.status == 200) {
          var children = res.detailModelList.map(function (item) {
            var data = JSON.parse(JSON.stringify(item))
            if (len == 6) {
              data.hospital = item.name
              data.hasChildren = true
            } else if (len == 10) {
              data.team = item.name
            }
            return data
          })
          resolve(children)
        }
      })
    },
    dialogSearchFn() {
      this.page = 1
      if (this.title == '康复下转明细列表') {
        this.rehabilitationPatientInfo()
      } else if (this.title == '下转情况数据列表') {
        this.turnDownDataPage()
      }
    },
    dialogExportFn() {
      var vm = this
      var params = {
        ...this.query
      }
      if (this.title == '康复下转明细列表') {
        if (this.yearType == '1') {
          params.startTime = this.chooseYear + '-01-01'
          params.endTime = this.chooseYear + '-12-31'
        } else {
          if (this.chooseTime) {
            params.startTime = this.chooseTime[0]
            params.endTime = this.chooseTime[1]
          }
        }
        this.dialogExportLoading = true
        var fileName = `康复下转明细列表${new Date().getTime()}.xls`
        httpRequest.downLoadFileForAjax('doctor/specialist/rehabilitation/exportRehabilitationPatientInfo', fileName, params).then(function () {
          vm.dialogExportLoading = false
        })
      } else {
        if (this.yearType == '1') {
          params.startDate = this.chooseYear + '-01-01'
          params.endDate = this.chooseYear + '-12-31'
        } else {
          if (this.chooseTime) {
            params.startDate = this.chooseTime[0]
            params.endDate = this.chooseTime[1]
          }
        }
        this.dialogExportLoading = true
        var fileName = `冠心病下转情况统计表${new Date().getTime()}.xls`
        httpRequest.downLoadFileForAjax('statistics/collaborate/exportTurnDownDataPage', fileName, params).then(function () {
          vm.dialogExportLoading = false
        })
      }
    },
    dialogReset() {
      var params = {
        ...this.query
      }
      if (this.title == '康复下转明细列表') {
        this.query = {
          status: '',
          hospitalCode: '',
          orgCode: '',
          archiveStatus: '',
          patientType: '',
          range: typeof params.range == 'undefined' ? '' : params.range,
          area: typeof params.area == 'undefined' ? '' : params.area,
          hospital: typeof params.hospital == 'undefined' ? '' : params.hospital,
          team: typeof params.team == 'undefined' ? '' : params.team
        }
      } else if (this.title == '下转情况数据列表') {
        this.query = {
          sex: '',
          isSign: '',
          eventType: '',
          range: params.range,
          area: params.area,
          hospital: params.hospital,
          team: params.team
        }
      }
    },
    handleCurrentChange(val) {
      this.page = val
      if (this.title == '康复下转明细列表') {
        this.rehabilitationPatientInfo()
      } else if (this.title == '下转情况数据列表') {
        this.turnDownDataPage()
      }
    },
    handleSizeChange(val) {
      this.size = val
      if (this.title == '康复下转明细列表') {
        this.rehabilitationPatientInfo()
      } else if (this.title == '下转情况数据列表') {
        this.turnDownDataPage()
      }
    },
    // 获取社区医院
    hospitalsByType() {
      var vm = this
      // var code
      var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
      if (selectedRole.code.indexOf('350200') > -1) {
        code = '350200' //  市卫健委
      } else if (selectedRole.code.length == 6) {
        code = selectedRole.code
      } else {
        this.level = 3 // 社区管理
      }
      if (selectedRole.code.length > 6) {
        this.communityHospitals = [{ label: selectedRole.name, value: selectedRole.code }]
      } else {
        var type = 1
        if (selectedRole.code.indexOf('350200') > -1) {
          type = 1 //  市卫健委
        } else if (selectedRole.code.length == 6) {
          type = 2
        }
        statisticAPI
          .hospitalsByType({
            type: type,
            code: selectedRole.code
          })
          .then(function (res) {
            if (res.status == 200) {
              vm.communityHospitals = [{ label: '全部', value: '' }]
              res.list.forEach(function (v) {
                vm.communityHospitals.push({
                  value: v.code,
                  label: v.name
                })
              })
            }
          })
          .catch(function (err) {
            console.log(err, 'Errr')
          })
      }
    },
    openDialog(row, prop) {
      if (!row.code) return
      this.page = 1
      if (['totalTimes', 'mzTimes', 'zyTimes'].includes(prop)) {
        this.query = {
          status: '',
          hospitalCode: '',
          orgCode: '',
          archiveStatus: '',
          patientType: ''
        }
        this.visible = true
        this.title = '康复下转明细列表'
        this.dialogHeader = [
          { label: '姓名', prop: 'name' },
          { label: '性别', prop: 'sex' },
          { label: '年龄', prop: 'age' },
          { label: '手机号', prop: 'mobile' },
          { label: '下转医院', prop: 'hospitalName' },
          { label: '下转医生', prop: 'hospitalDoctor' },
          { label: '下转时间', prop: 'createTime' },
          { label: '患者类型', prop: 'patientType' },
          { label: '下转状态', prop: 'statusName' },
          { label: '接收社区医院', prop: 'orgName' },
          { label: '接收签约医生', prop: 'doctorName' },
          { label: '接收时间', prop: 'receiveTime' },
          { label: '档案状态', prop: 'archiveStatusName' }
        ]
        switch (prop) {
          case 'mzTimes':
            this.query.patientType = '1'
            break
          case 'zyTimes':
            this.query.patientType = '2'
            break
        }
      } else if (['totalNum', 'mzNum', 'zyNum'].includes(prop)) {
        this.visible = true
        this.title = '下转情况数据列表'
        this.query = {
          sex: '',
          isSign: '',
          eventType: ''
        }
        this.dialogHeader = [
          { label: '姓名', prop: 'name' },
          { label: '性别', prop: 'sex' },
          { label: '年龄', prop: 'age' },
          { label: '手机号', prop: 'mobile' },
          { label: '是否签约', prop: 'isSign' },
          { label: '社区医院', prop: 'hospitalName' },
          { label: '下转次数', prop: 'num' },
          { label: '最近一次下转诊断', prop: 'diagnosisName' },
          { label: '最近一次下转时间', prop: 'turnDownTime' },
          { label: '最近一次下转类型', prop: 'eventType' }
        ]
        switch (prop) {
          case 'mzNum':
            this.query.eventType = '1'
            break
          case 'zyNum':
            this.query.eventType = '2'
            break
        }
      }
      var len = row.code.length
      if (len == 6) {
        this.query.range = 'town'
        this.query.area = row.code
      } else if (len == 10) {
        this.query.range = 'hospital'
        this.query.hospital = row.code
      } else {
        this.query.range = 'team'
        this.query.team = row.code
      }
      this.dataRangeOption = [{ label: row.name, value: row.code }]
      if (['totalTimes', 'mzTimes', 'zyTimes'].includes(prop)) {
        this.rehabilitationPatientInfo()
      } else if (['totalNum', 'mzNum', 'zyNum'].includes(prop)) {
        this.turnDownDataPage()
      }
    },
    // 康复下转操作
    operation(num, item) {
      var vm = this
      if (num != 2) {
        statisticAPI
          .synchronizePationSingle({ id: item.id })
          .then(function (res) {
            if (res.status == 200) {
              vm.$message.success('操作成功')
            } else {
              vm.$message.error(res.msg)
            }
          })
          .catch(function (err) {
            console.log(err, 'Errr')
          })
      } else {
        vm.signatoryList = []
        statisticAPI
          .kangfuGetSignInfo({ idcard: item.idcard })
          .then(function (res) {
            if (res.status == 200) {
              if (res.data != null) {
                vm.signatoryList.push(res.data)
              }
            }
          })
          .catch(function (err) {
            console.log(err, 'Errr')
          })
        vm.dialogVisible = true
      }
    },
    rehabilitationPatientInfo() {
      var vm = this
      var params = {
        ...this.query,
        page: this.page,
        size: this.size,
        disease: 3
      }
      if (this.yearType == '1') {
        params.startTime = this.chooseYear + '-01-01'
        params.endTime = this.chooseYear + '-12-31'
      } else {
        if (this.chooseTime) {
          params.startTime = this.chooseTime[0]
          params.endTime = this.chooseTime[1]
        }
      }
      this.dialogLoading = true
      statisticAPI.rehabilitationPatientInfo(params).then(function (res) {
        if (res.status == 200) {
          res.detailModelList.forEach(function (v) {
            v.sex = v.sex == 1 ? '男' : '女'
          })
          vm.dialogTableData = res.detailModelList
          vm.total = res.totalCount
        } else {
          vm.$message.error(res.msg)
        }
        vm.dialogLoading = false
      })
    },
    turnDownDataPage() {
      var vm = this
      var params = {
        ...this.query,
        page: this.page,
        pageSize: this.size
      }
      if (this.yearType == '1') {
        params.startDate = this.chooseYear + '-01-01'
        params.endDate = this.chooseYear + '-12-31'
      } else {
        if (this.chooseTime) {
          params.startDate = this.chooseTime[0]
          params.endDate = this.chooseTime[1]
        }
      }
      this.dialogLoading = true
      httpRequest.get('statistics/collaborate/turnDownDataPage', { data: params }).then(function (res) {
        if (res.status == 200) {
          vm.dialogTableData = res.detailModelList
          vm.total = res.totalCount
        }
        vm.dialogLoading = false
      })
    },
    closeDialog() {
      this.visible = false
    },
    closeDialog1() {
      this.dialogVisible = false
    },
    getData(data) {
      if (data) {
        this.yearType = data.yearType
        this.form.range = data.range
        this.form.area = data.area
        this.form.hospital = data.hospital
        this.form.team = data.team
        if (this.yearType == 1) {
          this.chooseYear = data.time
        } else {
          this.chooseTime = data.time
        }
        if (this.form.hospital) {
          // 如果有社区code传过来就调社区医院列表接口
          this.getHospital(data.area, false)
        }
        if (this.form.team) {
          // 如果有团队code传过来就调团队列表接口
          this.getTeam(data.hospital, false)
        }
        this.searchFn()
      } else {
        this.init()
      }
    },
    seePatientDetail(row, prop) {
      console.log('uuuuuuuuuuuuuuuuu', row, prop)
      if (prop == 'name') {
        if (row.patient && this.title == '康复下转明细列表') {
          EventBus.$emit('preview-person-info', { type: '4', code: row.patient })
        } else if (row.code && this.title == '下转情况数据列表') {
          EventBus.$emit('preview-person-info', { type: '4', code: row.code })
        } else {
          this.$message.warning('未查询到该患者信息')
        }
      }
    },
    renderHeader: function (h, item) {
      var label = item.column.label
      var column = item.column
      var tooltip = {
        '签约社区': '显示为该患者当前的签约社区医院名称',
        '社区医院': '显示为该患者当前的签约社区医院名称',
        '签约医院': '显示为该患者当前的签约社区医院名称',
        '签约医生': '显示为该患者当前的签约社区医生名称',
        '家庭医生': '显示为该患者当前的签约社区医生名称'
      }
      if (label == '签约社区' || label == '签约医生' || label == '签约医院' || label == '家庭医生' || label == '社区医院') {
        return [
          label,
          h(
            'el-tooltip',
            {
              props: {
                content: (function () {
                  return tooltip[label]
                })(),
                placement: 'top'
              }
            },
            [
              h('span', {
                class: {
                  'el-icon-question': true
                }
              })
            ]
          )
        ]
      } else {
        return [column.label]
      }
    }
  },
  mounted() {}
})