You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

168 lines
5.4 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div style="display: flex;width:100%;">
  3. <div style="width:180;">
  4. <el-table :data="RegisterCheckList" width="180"
  5. :height="window.pageHeight < 600 ? 300:window.pageHeight-300"
  6. border highlight-current-row
  7. :row-style="{ height: '40px' }" :row-class-name="tableRowClassName" @row-click="rowClick">
  8. <el-table-column prop="asbitemName" label="组合项目" width="180" />
  9. </el-table>
  10. </div>
  11. <div :style="'width:' + (window.pageWidth - 330 - 80) + 'px;'">
  12. <el-table :data="tableData" :width="(window.pageWidth - 330 - 80)"
  13. :height="window.pageHeight < 600 ? 300:window.pageHeight-300"
  14. border :row-style="{ height: '40px' }">
  15. <el-table-column prop="itemName" label="项目" width="150" />
  16. <el-table-column prop="unitName" label="单位" width="90" />
  17. <el-table-column prop="referenceRangeValue" label="参考范围" width="120" />
  18. <el-table-column v-for="(item, index) of tableCols" :label="item" :prop="item" :key="index" width="150">
  19. </el-table-column>
  20. </el-table>
  21. </div>
  22. </div>
  23. </template>
  24. <script lang="ts">
  25. import { mapState } from 'vuex';
  26. import Sortable from "sortablejs";
  27. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  28. import { arrayExistObj } from '@/utlis/proFunc';
  29. export default {
  30. components: {},
  31. data() {
  32. return {
  33. RegisterCheckList: [],
  34. tableData: [], //显示数据
  35. tableRows: [], //动态行
  36. tableCols: [], //动态列
  37. };
  38. },
  39. created() { },
  40. //挂载完成
  41. mounted() {
  42. if(this.sumDoctorCheck.sumPREdit.patientId){
  43. this.registerCheckList(this.sumDoctorCheck.sumPREdit.patientId);
  44. }
  45. },
  46. computed: {
  47. ...mapState(['window','dict', 'doctorCheck', 'sumDoctorCheck']),
  48. },
  49. methods: {
  50. //组合项目颜色标识
  51. tableRowClassName({ row, rowIndex }) {
  52. //console.log('tableRowClassName',rowIndex,row)
  53. if (row.completeFlag === '0') {
  54. return 'warning'; //未检
  55. } else if (row.completeFlag === '2') {
  56. return 'info'; //弃检
  57. }
  58. return '';
  59. },
  60. //获取检查组合项目
  61. registerCheckList(patientId) {
  62. console.log(`/api/app/sumsummaryreport/gethorizontalcomparisonasbitemlist?PatientId=${patientId}`)
  63. getapi(`/api/app/sumsummaryreport/gethorizontalcomparisonasbitemlist?PatientId=${patientId}`)
  64. .then((res) => {
  65. console.log("获取项目对比 SumItems", res.data);
  66. if (res.code != -1) {
  67. this.RegisterCheckList = res.data;
  68. if (res.data.length > 0) this.rowClick(res.data[0])
  69. }
  70. })
  71. .catch((err) => {
  72. this.$message({ type: "error", message: `操作失败,原因:${err}` });
  73. });
  74. },
  75. rowClick(row) {
  76. //console.log('row',row) //asbitemId
  77. this.SumItems(this.sumDoctorCheck.sumPREdit.patientId, row.asbitemId)
  78. },
  79. //获取结果明细 3a0c6589-9989-4d7f-ba54-61e5b0138220
  80. // "itemName": "乙肝表面抗原(HBsAg)",
  81. // "unitName": "次/分",
  82. // "referenceRangeValue": "",
  83. // "checkDate": "2023-07-14",
  84. // "resultValue": "阴性"
  85. SumItems(patientId, asbitemId) {
  86. console.log(`/api/app/sumsummaryreport/gethorizontalcomparisonlist?PatientId=${patientId}&AsbitemId=${asbitemId}`)
  87. getapi(`/api/app/sumsummaryreport/gethorizontalcomparisonlist?PatientId=${patientId}&AsbitemId=${asbitemId}`)
  88. .then((res) => {
  89. console.log("获取项目对比 SumItems", res.data);
  90. if (res.code != -1) {
  91. this.crossTable(res.data);
  92. }
  93. })
  94. .catch((err) => {
  95. this.$message({ type: "error", message: `操作失败,原因:${err}` });
  96. });
  97. },
  98. //交叉报表
  99. crossTable(tableData) {
  100. this.tableData = [] //显示数据
  101. this.tableRows = [] //动态行
  102. this.tableCols = [] //动态列
  103. console.log('tableData', tableData)
  104. tableData.forEach(e => {
  105. if (this.tableRows.indexOf(e.itemName) == - 1) this.tableRows.push(e.itemName)
  106. if (this.tableCols.indexOf(e.checkDate) == - 1) this.tableCols.push(e.checkDate)
  107. });
  108. this.tableCols.sort();
  109. this.tableRows.forEach(r => {
  110. let item = {}
  111. let resultValue = ''
  112. item['itemName'] = r
  113. this.tableCols.forEach(c => {
  114. for (let i = 0; i < tableData.length; i++) {
  115. if (tableData[i].itemName == r) {
  116. item['unitName'] = tableData[i].unitName
  117. item['referenceRangeValue'] = tableData[i].referenceRangeValue
  118. }
  119. if (tableData[i].itemName == r && tableData[i].checkDate == c) {
  120. resultValue = tableData[i].resultValue
  121. break;
  122. }
  123. }
  124. item[c] = resultValue
  125. });
  126. this.tableData.push(item)
  127. });
  128. console.log('this.tableRows', this.tableRows)
  129. console.log('this.tableCols', this.tableCols)
  130. console.log('this.tableData', this.tableData)
  131. },
  132. },
  133. //监听事件
  134. watch: {
  135. //检查项目切换
  136. "sumDoctorCheck.sumPREdit.patientId"(newVal, oldVal) {
  137. console.log("watch sumDoctorCheck.sumPREdit.patientId newVal:", newVal, " oldVal:", oldVal);
  138. if (newVal != oldVal && newVal != '') {
  139. this.registerCheckList(newVal)
  140. }
  141. },
  142. },
  143. };
  144. </script>
  145. <style scoped>
  146. ::v-deep .el-table td.el-table__cell,
  147. .el-table th.el-table__cell.is-leaf {
  148. padding: 0;
  149. }
  150. </style>