4 changed files with 117 additions and 5 deletions
-
4src/components/doctorCheck/PatientRegisterBase.vue
-
110src/components/sumDoctorCheck/SumItems.vue
-
1src/store/index.js
-
7src/views/doctorCheck/sumDoctorCheck.vue
@ -0,0 +1,110 @@ |
|||
<template> |
|||
<div style="display: flex;width:100%;"> |
|||
<el-table :data="tableData" width="1000px" height="680" border :row-style="{ height: '40px' }" > |
|||
<el-table-column prop="itemTypeName" label="项目" width="150"/> |
|||
<el-table-column v-for="(item,index) of tableCols" :label="item" :prop="item" :key="index" width="200"> |
|||
</el-table-column> |
|||
</el-table> |
|||
</div> |
|||
</template> |
|||
<script lang="ts"> |
|||
import { mapState } from 'vuex'; |
|||
import Sortable from "sortablejs"; |
|||
import { getapi, postapi, putapi, deletapi } from "@/api/api"; |
|||
import { arrayExistObj } from '@/utlis/proFunc'; |
|||
export default { |
|||
components: {}, |
|||
data() { |
|||
return { |
|||
orgData:[], //原始的数据, |
|||
tableData:[], //显示数据 |
|||
tableRows:[], //动态行 |
|||
tableCols:[], //动态列 |
|||
}; |
|||
}, |
|||
|
|||
created() { }, |
|||
|
|||
//挂载完成 |
|||
mounted() { |
|||
|
|||
}, |
|||
|
|||
computed: { |
|||
...mapState(['dict', 'doctorCheck', 'sumDoctorCheck']), |
|||
}, |
|||
|
|||
methods: { |
|||
//获取结果明细 3a0c6589-9989-4d7f-ba54-61e5b0138220 |
|||
SumItems(patientId) { |
|||
console.log(`/api/app/sum-summary-report/item-type-contrast-list/${patientId}`) |
|||
getapi(`/api/app/sum-summary-report/item-type-contrast-list/${patientId}`) |
|||
.then((res) => { |
|||
console.log("获取项目对比 SumItems", res.data); |
|||
if (res.code != -1) { |
|||
this.orgData = res.data; |
|||
this.crossTable(this.orgData); |
|||
} |
|||
}) |
|||
.catch((err) => { |
|||
this.$message({ type: "error", message: `操作失败,原因:${err}` }); |
|||
}); |
|||
}, |
|||
|
|||
//交叉报表 |
|||
// "itemTypeName": "一般检查", |
|||
// "registerDate": "2023-07-14", |
|||
// "summarys": "身高体重:重度肥胖" |
|||
crossTable(tableData){ |
|||
this.tableData=[] //显示数据 |
|||
this.tableRows=[] //动态行 |
|||
this.tableCols=[] //动态列 |
|||
|
|||
console.log('tableData',tableData) |
|||
tableData.forEach(e => { |
|||
if(this.tableRows.indexOf(e.itemTypeName) == - 1) this.tableRows.push(e.itemTypeName) |
|||
if(this.tableCols.indexOf(e.registerDate) == - 1) this.tableCols.push(e.registerDate) |
|||
}); |
|||
this.tableCols.sort(); |
|||
|
|||
this.tableRows.forEach(r => { |
|||
let item = {} |
|||
let summarys = '' |
|||
item['itemTypeName'] = r |
|||
this.tableCols.forEach(c => { |
|||
for(let i=0;i<tableData.length;i++){ |
|||
if(tableData[i].itemTypeName == r && tableData[i].registerDate == c){ |
|||
summarys = tableData[i].summarys |
|||
break; |
|||
} |
|||
} |
|||
item[c] = summarys |
|||
}); |
|||
this.tableData.push(item) |
|||
}); |
|||
console.log('this.tableRows',this.tableRows) |
|||
console.log('this.tableCols',this.tableCols) |
|||
console.log('this.tableData',this.tableData) |
|||
} |
|||
|
|||
}, |
|||
|
|||
//监听事件 |
|||
watch: { |
|||
//检查项目切换 |
|||
"sumDoctorCheck.sumPREdit.patientId"(newVal, oldVal) { |
|||
console.log("watch sumDoctorCheck.sumPREdit.patientId newVal:", newVal, " oldVal:", oldVal); |
|||
if (newVal != oldVal && newVal != '') { |
|||
this.SumItems(newVal) |
|||
} |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
<style scoped> |
|||
::v-deep .el-table td.el-table__cell, |
|||
.el-table th.el-table__cell.is-leaf { |
|||
padding: 0; |
|||
} |
|||
</style> |
|||
|
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue