HuanZheLieBiao.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <el-container>
  3. <el-aside style="width: 190px;">
  4. <el-select v-model="currentWard" filterable style="width: 120px" @change="huoQuHuanZheLieBiaoClick">
  5. <el-option v-for="item in userWards" :key="item.code" :label="item.name" :value="item.code"></el-option>
  6. </el-select>
  7. <el-select v-model="inpatientNo" :filter-method="filterMethod" clearable filterable style="width: 120px;">
  8. <el-option v-for="item in cptHuanZheLieBiaoData" :key="item.inpatientNo" :label="item.name"
  9. :value="item.inpatientNo"></el-option>
  10. </el-select>
  11. <el-checkbox v-model="woDeBingRen" style="margin-left: 10px" @change="woDeBingRenClick">我的病人</el-checkbox>
  12. <el-table
  13. :data="cptHuanZheLieBiaoData.slice((huanZheLieBiaoCurrentPage - 1) * 20,huanZheLieBiaoCurrentPage * 20 )"
  14. :height="tableHeight / 1.15" :row-style="tableBackColor" @row-click="tableClick">
  15. <el-table-column label="床位" prop="bedNo" width="40"></el-table-column>
  16. <el-table-column label="姓名" prop="name">
  17. <template #default="scope">
  18. <div :title="scope.row.zkWardName">
  19. <img :src="scope.row.sex === 1 ? maleIcon : femaleIcon"
  20. class="sex-icon"/>
  21. {{ scope.row.name }}
  22. </div>
  23. </template>
  24. </el-table-column>
  25. <el-table-column label="住院号" prop="inpatientNo"></el-table-column>
  26. <el-table-column label="小科室" prop="zkWardName"></el-table-column>
  27. </el-table>
  28. <el-pagination
  29. :page-size="20"
  30. :total="huanZheLieBiaoData.length"
  31. layout="prev,pager,next,total"
  32. small
  33. @current-change="huanZheLeiBiaoCurrentChange"
  34. >
  35. </el-pagination>
  36. </el-aside>
  37. </el-container>
  38. </template>
  39. <script>
  40. import {computed, onMounted, ref, watch} from "vue";
  41. import store from "@/store";
  42. import {huoQuGeRenPinLv, huoQuHuanZheLieBiao, huoQuHuanZheXinXi} from "@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru";
  43. import {
  44. huanZhePinLvData,
  45. huanZheXinXi,
  46. selectWardCode
  47. } from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng"
  48. import maleIcon from '@/assets/male-icon.png'
  49. import femaleIcon from '@/assets/female-icon.png'
  50. import {getUserWards} from "@/api/case-front-sheet";
  51. import {listNotBlank, stringIsBlank, stringNotBlank} from "@/utils/blank-utils";
  52. import {clone} from "@/utils/clone";
  53. export default {
  54. name: "HuanZheLieBiao",
  55. props: ['inpatientNo'],
  56. setup(props, cxt) {
  57. const tableHeight = computed(() => {
  58. return store.state.app.windowSize.h
  59. })
  60. // 选择的病房
  61. const currentWard = ref('')
  62. // 用户可以选择的 病房信息
  63. const userWards = ref([])
  64. // 住院号
  65. const inpatientNo = ref('')
  66. const cptHuanZheLieBiaoData = ref([])
  67. const huanZheLieBiaoData = ref([])
  68. const huanZheLieBiaoCurrentPage = ref(1)
  69. const woDeBingRen = ref(false)
  70. const huoQuHuanZheLieBiaoClick = () => {
  71. huoQuHuanZheLieBiao(currentWard.value).then((res) => {
  72. huanZheLieBiaoData.value = res
  73. cptHuanZheLieBiaoData.value = clone(res)
  74. selectWardCode.value = currentWard.value
  75. }).catch((e) => {
  76. huanZheLieBiaoData.value = []
  77. cptHuanZheLieBiaoData.value = []
  78. })
  79. }
  80. const huanZheLeiBiaoCurrentChange = (val) => {
  81. huanZheLieBiaoCurrentPage.value = val
  82. }
  83. const tableClick = (val) => {
  84. inpatientNo.value = val.inpatientNo
  85. }
  86. watch(() => inpatientNo.value, () => {
  87. if (stringIsBlank(inpatientNo.value)) {
  88. cptHuanZheLieBiaoData.value = huanZheLieBiaoData.value
  89. } else {
  90. huoQuHuanZheXinXi(inpatientNo.value).then((res) => {
  91. huanZheXinXi.value = res
  92. // 加载患者的频率
  93. huoQuGeRenPinLv(res.inpatientNo, res.admissTimes).then((res) => {
  94. huanZhePinLvData.value = res
  95. })
  96. })
  97. }
  98. })
  99. const woDeBingRenClick = () => {
  100. woDeBingRen.value ? filterMethod(store.state.user.info.code) : cptHuanZheLieBiaoData.value = huanZheLieBiaoData.value
  101. }
  102. const filterMethod = (val) => {
  103. cptHuanZheLieBiaoData.value = huanZheLieBiaoData.value.filter(item => {
  104. return item.inpatientNo.indexOf(val) > -1 || item.name.indexOf(val) > -1
  105. || item.consultPhysician.indexOf(val) > -1 || (stringNotBlank(item.referPhysician) && item.referPhysician.indexOf(val) > -1)
  106. })
  107. }
  108. const tableBackColor = ({row, column, rowIndex, columnIndex}) => {
  109. if (row.inpatientNo === inpatientNo.value) {
  110. return {
  111. backgroundColor: '#a7d3ff!important'
  112. }
  113. }
  114. }
  115. onMounted(() => {
  116. getUserWards().then((res) => {
  117. userWards.value = res
  118. if (listNotBlank(userWards.value)) {
  119. currentWard.value = userWards.value[0].code
  120. selectWardCode.value = currentWard.value
  121. huoQuHuanZheLieBiaoClick()
  122. }
  123. })
  124. })
  125. return {
  126. tableHeight,
  127. currentWard,
  128. userWards,
  129. huanZheLieBiaoData,
  130. huoQuHuanZheLieBiaoClick,
  131. huanZheLieBiaoCurrentPage,
  132. huanZheLeiBiaoCurrentChange,
  133. maleIcon,
  134. femaleIcon,
  135. woDeBingRen,
  136. cptHuanZheLieBiaoData,
  137. tableClick,
  138. inpatientNo,
  139. filterMethod,
  140. tableBackColor,
  141. woDeBingRenClick
  142. }
  143. }
  144. }
  145. </script>
  146. <style scoped>
  147. </style>