BloodSugar.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <script setup lang="ts">
  2. import {onMounted, Ref, ref, computed} from "vue";
  3. import {reportQueryCenterApiByGet} from "@/api/base-data/report-center";
  4. import CyAutoSize from "@/components/cy/auto-size/cy-auto-size.vue";
  5. import XcElOption from "@/components/xiao-chan/xc-el-option/XcElOption.vue";
  6. import XEUtils from "xe-utils";
  7. import {SortBy, SortState, TableV2SortOrder} from "element-plus";
  8. const props = defineProps<{
  9. patNo: string,
  10. times: number
  11. }>()
  12. const data = ref([])
  13. const patInfo: Ref<{
  14. name: string;
  15. sex: string;
  16. age: string;
  17. smallDeptName: string
  18. bedNo: string
  19. inpatientNo: string
  20. }> = ref({})
  21. const currentType = ref('GLU')
  22. const typeList = [
  23. {code: 'GLU', name: '血糖'},
  24. {code: 'UA', name: '尿酸'},
  25. {code: 'KB', name: '血酮'},
  26. {code: 'BP', name: '血压'}
  27. ]
  28. const sortState = ref<SortState>({
  29. 'time': TableV2SortOrder.DESC,
  30. })
  31. const onSort = ({key, order}: SortBy) => {
  32. sortState.value[key] = order
  33. if (order === 'asc') {
  34. data.value = data.value.sort((a, b) => new Date(a.time) - new Date(b.time))
  35. } else {
  36. data.value = data.value.sort((a, b) => new Date(b.time) - new Date(a.time))
  37. }
  38. }
  39. const columns = [
  40. {
  41. key: 'time',
  42. title: '测试时间',
  43. dataKey: 'time',
  44. width: '220px',
  45. sortable: true
  46. },
  47. {
  48. key: 'resultJson.result',
  49. title: '结果',
  50. dataKey: 'resultJson.result',
  51. width: '220px'
  52. },
  53. {
  54. key: 'resultJson.testNutritionalTime',
  55. title: '备注',
  56. dataKey: 'resultJson.testNutritionalTime',
  57. width: '220px'
  58. },
  59. {
  60. key: 'createdName',
  61. title: '签名',
  62. dataKey: 'createdName',
  63. width: '220px'
  64. }
  65. ]
  66. const columnsBP = [
  67. {
  68. key: 'time',
  69. title: '测试时间',
  70. dataKey: 'time',
  71. width: '220px',
  72. sortable: true
  73. },
  74. {
  75. key: 'resultJson.result.bloodMeasureHigh',
  76. title: '高压',
  77. dataKey: 'resultJson.result.bloodMeasureHigh',
  78. width: '220px'
  79. },
  80. {
  81. key: 'resultJson.result.bloodMeasureLow',
  82. title: '低压',
  83. dataKey: 'resultJson.result.bloodMeasureLow',
  84. width: '220px'
  85. },
  86. {
  87. key: 'resultJson.result.checkHeartRate',
  88. title: '心率',
  89. dataKey: 'resultJson.result.checkHeartRate',
  90. width: '220px'
  91. },
  92. {
  93. key: 'createdName',
  94. title: '签名',
  95. dataKey: 'createdName',
  96. width: '220px'
  97. }
  98. ]
  99. const tempColumns = computed(() => {
  100. return currentType.value === 'BP' ? columnsBP : columns
  101. })
  102. const tempData = computed(() => {
  103. return XEUtils.filter(data.value, (item) => {
  104. return item.type === currentType.value
  105. })
  106. })
  107. onMounted(() => {
  108. reportQueryCenterApiByGet("/intergration/sannuo/bloodSugar", {
  109. patNo: props.patNo,
  110. times: props.times,
  111. }).then(res => {
  112. data.value = res.data
  113. patInfo.value = res.patInfo
  114. })
  115. })
  116. </script>
  117. <template>
  118. <div style="height: 100% ; width: 100% ; display: flex;flex-flow: column;flex-wrap: wrap;">
  119. <div style="height: max-content">
  120. <div style="display: grid ; grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr ">
  121. <div>
  122. 姓名:{{ patInfo.name }}
  123. </div>
  124. <div>性别:{{ patInfo.sex }}</div>
  125. <div>年龄:{{ patInfo.age }}</div>
  126. <div>科室:{{ patInfo.smallDeptName }}</div>
  127. <div>床号:{{ patInfo.bedNo }}</div>
  128. <div>住院号:{{ patInfo.inpatientNo }}</div>
  129. </div>
  130. <div>
  131. <el-select style="width: 90px;" v-model="currentType">
  132. <xc-el-option :data="typeList"/>
  133. </el-select>
  134. </div>
  135. </div>
  136. <div style="flex: 1">
  137. <cy-auto-size>
  138. <template #default="{width,height}">
  139. <el-table-v2 :data="tempData"
  140. :height="height"
  141. v-model:sort-state="sortState"
  142. :width="width"
  143. @column-sort="onSort"
  144. :columns="tempColumns"/>
  145. </template>
  146. </cy-auto-size>
  147. </div>
  148. </div>
  149. </template>
  150. <style scoped lang="scss">
  151. </style>