123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- <template>
- <div class="page_checkPersonal">
- <div class="cell clearfix">
- <el-form :inline="true" :model="listQuery">
- <el-form-item label>
- <el-input v-model.trim="listQuery.search" placeholder="姓名/透析号" style="width:150px"></el-input>
- <el-button type="primary" @click="onSearch" icon="el-icon-search">搜索</el-button>
- </el-form-item>
- </el-form>
- <label class="title">
- <span class="name">日期查询</span> :
- </label>
- <el-date-picker
- v-model="listQuery.start_time"
- prefix-icon="el-icon-date"
- @change="changeTime"
- :editable="false"
- style="width: 196px;"
- type="date"
- placeholder="选择日期时间"
- align="right"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- :picker-options="pickerOptions"
- ></el-date-picker>
- <span class>-</span>
- <el-date-picker
- v-model="listQuery.end_time"
- prefix-icon="el-icon-date"
- @change="changeEndTime"
- :editable="false"
- style="width: 196px;"
- type="date"
- placeholder="选择日期时间"
- align="right"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- :picker-options="pickerOptions"
- ></el-date-picker>
- </div>
- <el-container>
- <div style="width:150px">
- <div class="tableTitle">患者列表</div>
- <el-table :data="patientsData" border style="width: 100%;"
- height="500" :row-style="{ color: '#303133' }"
- :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
- highlight-current-row
- @current-change="handleChange"
- >
- <el-table-column prop="dialysis_no" label="透析号" width="80">
- <template slot-scope="scope">{{scope.row.dialysis_no}}</template>
- </el-table-column>
- <el-table-column prop="name" label="姓名" width="80">
- <template slot-scope="scope">{{ scope.row.name }}</template>
- </el-table-column>
- </el-table>
- </div>
- <div style="padding-left:10px;flex:1">
- <div class="tableTitle">统计图</div>
- <div>
- <line-chart :options="chart"></line-chart>
- </div>
- </div>
- </el-container>
- </div>
- </template>
-
-
- <script>
- import echarts from "echarts";
- import LineChart from "../../components/LineChart";
- import { getCurrentOrgPatients,getInspectionTotalCount,getInspectionDetailById,getSearchPatientInfo } from "@/api/common/common";
- export default {
- components: {
- LineChart
- },
- data() {
- return {
- listQuery: {
- start_time: "",
- end_time: "",
- page: 1,
- limit: 10
- },
- value: "请选项",
- patientsData:[],
- tableData:[],
- chart: {
- tooltip: {},
- // legend: {
- // data: ["次数"],
- // left: 0
- // },
- xAxis: {
- data: []
- },
- yAxis: {
- axisLabel: {
- formatter: "{value} %"
- },
- show: false
- },
- series: [
- {
- name: "次数",
- type: "bar",
- data: [],
- barWidth: 30,
- label: {
- normal: {
- show: true,
- position: "top",
- formatter: "{c}次"
- }
- },
- //配置样式
- itemStyle: {
- //通常情况下:
-
- //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
- normal: {
- color: function(params) {
- //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
- var colorList = [
- ["#A9E0F3", "#9FBDFC"],
- ["#A9E0F3", "#9FBDFC"],
- ["#A9E0F3", "#9FBDFC"],
-
- ["#FFD7C0", "#FF9994"],
- ["#FFD7C0", "#FF9994"],
- ["#FFD7C0", "#FF9994"],
- ["#D7C3FD", "#B3A8F7"],
- ["#D7C3FD", "#B3A8F7"],
- ["#D7C3FD", "#B3A8F7"]
- ];
-
- var index = params.dataIndex;
- if (params.dataIndex >= colorList.length) {
- index = params.dataIndex % colorList.length;
- }
-
- return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- { offset: 0, color: colorList[index][0] },
- // { offset: 0.5, color: colorList[index][1] },
- { offset: 1, color: colorList[index][1] }
- ]);
- },
- barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
- },
-
- //鼠标悬停时:
- emphasis: {
- shadowBlur: 10,
- shadowOffsetX: 0,
- shadowColor: "rgba(0, 0, 0, 0.5)"
- }
- }
- }
- ]
- },
- pickerOptions: {
- disabledDate(time) {
- let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear()-1)).getTime() - 24 * 3600 * 1000;
- return time.getTime() > Date.now() || time.getTime() < threeMonths;;
- }
- },
- modesData: {
- xAxis: [],
- series: []
- },
- };
- },
- methods: {
- changeTime() {},
- changeEndTime(val) {
- var time =
- this.getTimestamp(val) - this.getTimestamp(this.listQuery.start_time);
- if (time < 0) {
- this.$message.error("结束时间不能小于开始时间");
- this.listQuery.end_time = "";
- } else {
- }
- },
- getCurrentOrgPatients(){
- getCurrentOrgPatients().then(response=>{
- var patients = response.data.data.patients
- this.patientsData = patients
- })
- },
- getInspectionTotalCount(){
- getInspectionTotalCount(this.listQuery.start_time,this.listQuery.end_time).then(response=>{
- if(response.data.state === 1){
- var Inspection = response.data.data.Inspection
- this.tableData = Inspection
- console.log("Inspection",Inspection)
- var counts = response.data.data.counts
- console.log("counts",counts)
- var arr = []
- for(let i=0;i<Inspection.length;i++){
- for(let j=0;j<counts.length;j++){
- if(Inspection[i].inspection_major == counts[j].ProjectId){
- arr.push(counts[j])
- }
- }
- }
- console.log("arr",arr)
- var hash = {};
- var i = 0;
- var res = [];
- arr.forEach(function(item) {
- var ProjectName = item.ProjectName;
- hash[ProjectName] ? res[hash[ProjectName] - 1].Count.push(item.Count) : hash[ProjectName] = ++i && res.push({
- Count: [item.Count],
- ProjectName: ProjectName,
- ProjectId: item.ProjectId,
- })
- });
-
- res.map(item => {
- item.Count = eval(item.Count.join('+'))
- })
- console.log(11111,res)
-
- for (const key in this.tableData) {
- this.modesData.xAxis.push(this.tableData[key].project_name);
- if (key in res) {
- this.modesData.series.push(parseInt(res[key].Count));
- // batotal += parseInt(res[key].Count);
- } else {
- this.modesData.series.push(0);
- }
- }
- this.chart.series[0].data = this.modesData.series
- this.chart.xAxis.data = this.modesData.xAxis
- console.log(2222,this.modesData)
- }
- })
- },
-
- //获取单个病人数据
- handleChange(val){
- getInspectionDetailById(val.id,this.listQuery.start_time,this.listQuery.end_time).then(response=>{
- if(response.data.state === 1){
- var patientdetail = response.data.data.patientdetail
- console.log("patientdetail",patientdetail)
- var arr=[]
- for(let i=0;i<this.tableData.length;i++){
- for(let j=0;j<patientdetail.length;j++){
- if(this.tableData[i].inspection_major == patientdetail[j].ProjectId){
- arr.push(patientdetail[j])
- }
- }
- }
- console.log("arr",arr)
- }
- })
- },
-
- //搜索功能
- onSearch(){
- getSearchPatientInfo(this.listQuery.search,this.listQuery.start_time,this.listQuery.end_time).then(response=>{
- if(response.data.state === 1){
- var PatientsInfo = response.data.data.PatientsInfo
- console.log("PatientsInfo",PatientsInfo)
- var arr = []
- for(let i=0;i<this.tableData.length;i++){
- for(let j=0;j<PatientsInfo.length;j++){
- if(this.tableData[i].inspection_major == PatientsInfo[j].ProjectId){
- arr.push(PatientsInfo[j])
- }
- }
- }
- console.log("arr",arr)
- }
- })
- }
- },
- created(){
- var nowDate = new Date();
- var nowYear = nowDate.getFullYear();
- var nowMonth = nowDate.getMonth() + 1;
- var nowDay = nowDate.getDate();
- this.listQuery.end_time =
- nowYear +
- "-" +
- (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
- "-" +
- (nowDay < 10 ? "0" + nowDay : nowDay);
- nowDate.setMonth(nowDate.getMonth() - 3);
- nowYear = nowDate.getFullYear();
- nowMonth = nowDate.getMonth() + 1;
- nowDay = nowDate.getDate();
- this.listQuery.start_time =
- nowYear +
- "-" +
- (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
- "-" +
- (nowDay < 10 ? "0" + nowDay : nowDay);
-
- //获取该机构下的所有患者
- this.getCurrentOrgPatients()
- //获取检验检查项目
- this.getInspectionTotalCount()
- }
- };
- </script>
-
- <style lang="scss" scoped>
- .tableTitle {
- font-size: 16px;
- color: #000;
- font-weight: bold;
- margin-bottom: 10px;
- }
- </style>
- <style lang="scss">
- .page_checkPersonal {
- .cell {
- text-align: center;
- }
- }
- </style>
|