WXL (wul)
23 小时以前 feb5a669dced68415bc7e32f237f77bf9842fe8b
src/views/sfstatistics/percentage/index.vue
@@ -2,10 +2,25 @@
  <div class="follow-up-statistics">
    <!-- 搜索表单区域 -->
    <div class="search-section">
      <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="98px">
      <el-form
        :model="queryParams"
        ref="queryForm"
        size="small"
        :inline="true"
        v-show="showSearch"
        label-width="98px"
      >
        <el-form-item label="统计类型" prop="userName">
          <el-select v-model="queryParams.statisticaltype" placeholder="请选择统计类型">
            <el-option v-for="item in Statisticallist" :key="item.value" :label="item.label" :value="item.value" />
          <el-select
            v-model="queryParams.statisticaltype"
            placeholder="请选择统计类型"
          >
            <el-option
              v-for="item in Statisticallist"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
          <el-select
            style="margin-left: 10px"
@@ -16,7 +31,12 @@
            filterable
            placeholder="请选择病区"
          >
            <el-option v-for="item in flatArrayhospit" :key="item.value" :label="item.label" :value="item.value" />
            <el-option
              v-for="item in flatArrayhospit"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
          <el-select
            v-else-if="queryParams.statisticaltype == 2"
@@ -26,13 +46,27 @@
            filterable
            placeholder="请选择科室"
          >
            <el-option v-for="item in flatArraydept" :key="item.value" :label="item.label" :value="item.value" />
            <el-option
              v-for="item in flatArraydept"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="服务类型" prop="userName">
          <el-select v-model="queryParams.serviceType" multiple placeholder="请选择">
            <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
          <el-select
            v-model="queryParams.serviceType"
            multiple
            placeholder="请选择"
          >
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
        </el-form-item>
@@ -41,20 +75,44 @@
            v-model="queryParams.dateRange"
            value-format="yyyy-MM-dd HH:mm:ss"
            type="daterange"
            unlink-panels
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            :default-time="['00:00:00', '23:59:59']"
            :picker-options="pickerOptions"
          />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="medium" @click="handleQuery">搜索</el-button>
          <el-button icon="el-icon-refresh" size="medium" @click="resetQuery">重置</el-button>
          <el-button
            type="primary"
            icon="el-icon-search"
            size="medium"
            @click="handleQuery"
            >搜索</el-button
          >
          <el-button icon="el-icon-refresh" size="medium" @click="resetQuery"
            >重置</el-button
          >
        </el-form-item>
        <el-button type="warning" plain icon="el-icon-download" size="medium" @click="handleExport">导出</el-button>
        <el-button type="primary" plain icon="el-icon-data-line" size="medium" @click="showChartDialog">统计趋势图</el-button>
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="medium"
          @click="handleExport"
          >导出</el-button
        >
        <el-button
          type="primary"
          plain
          icon="el-icon-data-line"
          size="medium"
          @click="showChartDialog"
          >统计趋势图</el-button
        >
      </el-form>
    </div>
@@ -86,7 +144,11 @@
          />
        </el-tab-pane>
        <el-tab-pane label="延续护理统计" name="continued" v-if="orgname == '省立同德翠苑院区'">
        <el-tab-pane
          label="延续护理统计"
          name="continued"
          v-if="orgname == '省立同德翠苑院区'"
        >
          <ContinuedCare
            ref="continuedCare"
            :query-params="queryParams"
@@ -132,39 +194,71 @@
</template>
<script>
import FirstFollowUp from './components/FirstFollowUp.vue'
import SecondFollowUp from './components/SecondFollowUp.vue'
import ContinuedCare from './components/ContinuedCare.vue'
import ChartDialog from './components/ChartDialog.vue'
import DetailDialog from './components/DetailDialog.vue'
import TimelyRateDialog from './components/TimelyRateDialog.vue'
import FirstFollowUp from "./components/FirstFollowUp.vue";
import SecondFollowUp from "./components/SecondFollowUp.vue";
import ContinuedCare from "./components/ContinuedCare.vue";
import ChartDialog from "./components/ChartDialog.vue";
import DetailDialog from "./components/DetailDialog.vue";
import TimelyRateDialog from "./components/TimelyRateDialog.vue";
import { getSfStatisticsHyperlink } from "@/api/AiCentre/index";
export default {
  name: 'FollowUpStatistics',
  name: "FollowUpStatistics",
  components: {
    FirstFollowUp,
    SecondFollowUp,
    ContinuedCare,
    ChartDialog,
    DetailDialog,
    TimelyRateDialog
    TimelyRateDialog,
  },
  data() {
    return {
      activeTab: 'first',
      orgname: localStorage.getItem('orgname') || '',
      activeTab: "first",
      orgname: localStorage.getItem("orgname") || "",
      Statisticallist: [
        { label: '病区统计', value: 1 },
        { label: '科室统计', value: 2 }
        { label: "病区统计", value: 1 },
        { label: "科室统计", value: 2 },
      ],
      options: this.$store.getters.tasktypes,
      queryParams: {
        serviceType: [2],
        dateRange: [],
        dateRange: this.getLastMonthRange(),
        statisticaltype: 1,
        leavehospitaldistrictcodes: ['all'],
        deptcodes: []
        leavehospitaldistrictcodes: ["all"],
        deptcodes: [],
      },
      pickerOptions: {
        shortcuts: [
          {
            text: "最近一周",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "最近一个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "最近三个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit("pick", [start, end]);
            },
          },
        ],
      },
      flatArrayhospit: [],
      flatArraydept: [],
@@ -177,21 +271,21 @@
      chartData: [],
      infotitleVisible: false,
      SeedetailsVisible: false,
      searchName: '',
      infotitle: '',
      searchName: "",
      infotitle: "",
      infotitlelist: [],
      patienttotal: 0,
      logsheetlist: [],
      Seedloading: false,
      patientqueryParams: {
        pageNum: 1,
        pageSize: 10
      }
    }
        pageSize: 10,
      },
    };
  },
  created() {
    this.getDeptTree()
    this.loadCurrentTabData()
    this.getDeptTree();
    this.loadCurrentTabData();
  },
  methods: {
    getDeptTree() {
@@ -199,146 +293,196 @@
      this.flatArraydept = this.$store.getters.belongDepts.map((dept) => {
        return {
          label: dept.deptName,
          value: dept.deptCode
        }
      })
      this.allDeptCodes = this.$store.getters.belongDepts.map((dept) => dept.deptCode)
          value: dept.deptCode,
        };
      });
      this.allDeptCodes = this.$store.getters.belongDepts.map(
        (dept) => dept.deptCode
      );
      // 病区列表
      this.flatArrayhospit = this.$store.getters.belongWards.map((ward) => {
        return {
          label: ward.districtName,
          value: ward.districtCode
        }
      })
      this.allWardCodes = this.$store.getters.belongWards.map((ward) => ward.districtCode)
          value: ward.districtCode,
        };
      });
      this.allWardCodes = this.$store.getters.belongWards.map(
        (ward) => ward.districtCode
      );
      this.flatArraydept.push({ label: '全部', value: 'all' })
      this.flatArrayhospit.push({ label: '全部', value: 'all' })
      this.flatArraydept.push({ label: "全部", value: "all" });
      this.flatArrayhospit.push({ label: "全部", value: "all" });
    },
    // 添加获取最近一个月时间范围的方法
    getLastMonthRange() {
      const end = new Date();
      const start = new Date();
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
      // 格式化为 yyyy-MM-dd HH:mm:ss
      const formatDate = (date) => {
        const year = date.getFullYear();
        const month = String(date.getMonth() + 1).padStart(2, "0");
        const day = String(date.getDate()).padStart(2, "0");
        return `${year}-${month}-${day} 00:00:00`;
      };
      const formatEndDate = (date) => {
        const year = date.getFullYear();
        const month = String(date.getMonth() + 1).padStart(2, "0");
        const day = String(date.getDate()).padStart(2, "0");
        return `${year}-${month}-${day} 23:59:59`;
      };
      return [formatDate(start), formatEndDate(end)];
    },
    handleTabClick(tab) {
      this.activeTab = tab.name
      this.loadCurrentTabData()
      this.activeTab = tab.name;
      this.loadCurrentTabData();
    },
    loadCurrentTabData() {
      switch (this.activeTab) {
        case 'first':
          this.$refs.firstFollowUp.loadData()
          break
        case 'second':
          this.$refs.secondFollowUp.loadData()
          break
        case 'continued':
          this.$refs.continuedCare.loadData()
          break
        case "first":
          this.$refs.firstFollowUp.loadData();
          break;
        case "second":
          this.$refs.secondFollowUp.loadData();
          break;
        case "continued":
          this.$refs.continuedCare.loadData();
          break;
      }
    },
    handleQuery() {
      this.queryParams.startTime = this.parseTime(this.queryParams.dateRange[0])
      this.queryParams.endTime = this.parseTime(this.queryParams.dateRange[1])
      this.queryParams.startTime = this.parseTime(
        this.queryParams.dateRange[0]
      );
      this.queryParams.endTime = this.parseTime(this.queryParams.dateRange[1]);
      if (this.queryParams.statisticaltype == 1) {
        this.queryParams.deptcodes = []
        this.queryParams.deptcodes = [];
      } else if (this.queryParams.statisticaltype == 2) {
        this.queryParams.leavehospitaldistrictcodes = []
        this.queryParams.leavehospitaldistrictcodes = [];
      }
      this.loadCurrentTabData()
      this.loadCurrentTabData();
    },
    resetQuery() {
      this.queryParams.dateRange = []
      this.queryParams.leavehospitaldistrictcodes = []
      this.handleQuery()
      this.queryParams.dateRange = [];
      this.queryParams.leavehospitaldistrictcodes = [];
      this.handleQuery();
    },
    async handleExport() {
      switch (this.activeTab) {
        case 'first':
          await this.$refs.firstFollowUp.exportTable()
          break
        case 'second':
          await this.$refs.secondFollowUp.exportTable()
          break
        case 'continued':
          await this.$refs.continuedCare.exportTable()
          break
        case "first":
          await this.$refs.firstFollowUp.exportTable();
          break;
        case "second":
          await this.$refs.secondFollowUp.exportTable();
          break;
        case "continued":
          await this.$refs.continuedCare.exportTable();
          break;
      }
    },
    showChartDialog() {
      this.chartData = this.getCurrentTabData()
      this.chartDialogVisible = true
      this.chartData = this.getCurrentTabData();
      this.chartDialogVisible = true;
    },
    getCurrentTabData() {
      switch (this.activeTab) {
        case 'first':
          return this.$refs.firstFollowUp.tableData
        case 'second':
          return this.$refs.secondFollowUp.tableData
        case 'continued':
          return this.$refs.continuedCare.tableData
        case "first":
          return this.$refs.firstFollowUp.tableData;
        case "second":
          return this.$refs.secondFollowUp.tableData;
        case "continued":
          return this.$refs.continuedCare.tableData;
        default:
          return []
          return [];
      }
    },
    viewDetails(row, title) {
      this.infotitle = title
      this.infotitlelist = row
      this.infotitleVisible = true
    viewDetails(row, infoKey, title, type) {
      this.infotitle = title;
      let obj = {
        hyperLinkInfoType: infoKey,
        leavehospitaldistrictcodes: this.queryParams.leavehospitaldistrictcodes,
        serviceType: this.queryParams.serviceType,
      };
      if (type == 1) {
        obj.drcode = row.drcode;
      }
      if (this.queryParams.statisticaltype == 1) {
        obj.leavehospitaldistrictcodes = [row.leavehospitaldistrictcode];
        obj.deptcodes = [];
      } else {
        obj.deptcodes = [row.deptcode];
        obj.leavehospitaldistrictcodes = [];
      }
      getSfStatisticsHyperlink(obj).then((response) => {
        this.infotitlelist = response.data;
      });
      this.infotitleVisible = true;
    },
    Seedetails(row) {
      this.SeedetailsVisible = true
      this.Seedloading = true
      this.SeedetailsVisible = true;
      this.Seedloading = true;
      this.$refs.firstFollowUp.selectTimelyRate(row, this.queryParams.dateRange)
        .then(response => {
          this.logsheetlist = response.data.detail
          this.patienttotal = response.data.total
          this.Seedloading = false
        })
      this.$refs.firstFollowUp
        .selectTimelyRate(row, this.queryParams)
        .then((response) => {
          this.logsheetlist = response.data.detail;
          this.patienttotal = response.data.total;
          this.Seedloading = false;
        });
    },
    Seedetailstion() {
      console.log(this.patientqueryParams);
      this.$refs.firstFollowUp.selectTimelyRates(this.patientqueryParams)
        .then(response => {
          this.logsheetlist = response.data.detail
          this.patienttotal = response.data.total
        })
      this.$refs.firstFollowUp
        .selectTimelyRates(this.patientqueryParams)
        .then((response) => {
          this.logsheetlist = response.data.detail;
          this.patienttotal = response.data.total;
        });
    },
    SeedetailsgGo(row) {
      this.SeedetailsVisible = false
      let type = ''
      if (row.preachformson && row.preachformson.includes('3')) {
        type = 1
      this.SeedetailsVisible = false;
      let type = "";
      if (row.preachformson && row.preachformson.includes("3")) {
        type = 1;
      }
      setTimeout(() => {
        this.$router.push({
          path: '/followvisit/record/detailpage/',
          path: "/followvisit/record/detailpage/",
          query: {
            taskid: row.taskid,
            patid: row.patid,
            id: row.id,
            Voicetype: type
          }
        })
      }, 300)
            Voicetype: type,
          },
        });
      }, 300);
    },
    handleSearch() {
      // 搜索逻辑
    }
  }
}
    },
  },
};
</script>
<style lang="scss" scoped>