EmrTest.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <div style="height: 10%;display: flex">
  3. <div>
  4. <el-date-picker v-model="dateRange"
  5. style="width: 220px"
  6. :clearable="false"
  7. type="daterange"/>
  8. <br>
  9. <hr>
  10. <el-button @click="query" type="primary">查询</el-button>
  11. <el-button @click="appendCopy" type="success">复制 / 追加</el-button>
  12. <el-button @click="copyClick" type="success">确认复制</el-button>
  13. </div>
  14. <div class="describe">
  15. <div class="pat-info">
  16. <div>
  17. <test-describe front="姓名"
  18. :text="inspectionHeader?.ptnt_NAME"/>
  19. </div>
  20. <div>
  21. <test-describe front="性别"
  22. :text="filterSex(inspectionHeader?.ptnt_SEX)"/>
  23. </div>
  24. <div>
  25. <test-describe front="年龄"
  26. :text="inspectionHeader.ptnt_AGE + filterAgeUnit(inspectionHeader.ptnt_AGE_UNIT) "/>
  27. </div>
  28. <div>
  29. <test-describe front="住院号"
  30. :text="inspectionHeader.ptnt_NO"/>
  31. </div>
  32. <div>
  33. <test-describe front="科室"
  34. :text="inspectionHeader.dept_NAME"/>
  35. </div>
  36. <div>
  37. <test-describe front="床号"
  38. :text="inspectionHeader.ptnt_BED_NO"/>
  39. </div>
  40. <div>
  41. <test-describe front="标本类型"
  42. :text="inspectionHeader.smpl_NAME "/>
  43. </div>
  44. <div>
  45. <test-describe front="申请项目"
  46. :text="inspectionHeader?.aply_CNTN"/>
  47. </div>
  48. </div>
  49. <div class="test-date">
  50. <div>
  51. <test-describe front="接收时间"
  52. :text="inspectionHeader.aply_DATE "/>
  53. </div>
  54. <div>
  55. <test-describe front="检验时间"
  56. :text="inspectionHeader.ordr_CREATE_DATE "/>
  57. </div>
  58. <div>
  59. <test-describe front="报告时间"
  60. :text="inspectionHeader.audt_TIME "/>
  61. </div>
  62. <div>
  63. <test-describe front="送检医生"
  64. :text="inspectionHeader.test_USR_NAME "/>
  65. </div>
  66. <div>
  67. <test-describe front="检验人"
  68. :text="inspectionHeader.ordr_USR_NAME "/>
  69. </div>
  70. <div>
  71. <test-describe front="审核人"
  72. :text="inspectionHeader.audt_USR_NAME "/>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. <div class="container">
  78. <el-auto-resizer>
  79. <template #default="{ height, width }">
  80. <div style="display: flex">
  81. <div class="sidebar">
  82. <xc-table-v3 :height="height"
  83. @row-click="sidebarRow"
  84. :data="sidebarList"
  85. :columns="sidebarColums"/>
  86. </div>
  87. <div class="main">
  88. <el-table :data="mainList"
  89. :height="height"
  90. row-key="itm_ORDR"
  91. ref="tableRef"
  92. @row-click="testRowClick"
  93. :expand-row-keys="expands">
  94. <el-table-column label="选择" type="selection"/>
  95. <el-table-column type="expand" width="20">
  96. <template #default="{row}">
  97. <el-table :data="row.bacteriaResults[0].antibioticResults"
  98. ref="drugSensitivityRef"
  99. @row-click="drugTable"
  100. v-if="row.bacteriaResults.length > 0">
  101. <el-table-column label="选择" type="selection"/>
  102. <el-table-column label="抗菌药物" prop="anti_NAME_CN"/>
  103. <el-table-column label="抗菌药物编码" prop="anti_ABB"/>
  104. <el-table-column label="MIC值" prop="anti_MIC"/>
  105. <el-table-column label="敏感性" prop="anti_VALUE"/>
  106. </el-table>
  107. </template>
  108. </el-table-column>
  109. <el-table-column label="检验项目" prop="itm_NAME" width="450"/>
  110. <el-table-column label="结果">
  111. <template #default="{row}">
  112. {{ result(row) }}
  113. </template>
  114. </el-table-column>
  115. <el-table-column label="单位" prop="itm_UNIT"/>
  116. <el-table-column label="说明" prop="itm_ALERT">
  117. <template #default="{row}">
  118. <span v-html="getItemAlert(row.itm_ALERT, row.itm_STR_VALUE, row.itm_VALUE)"></span>
  119. </template>
  120. </el-table-column>
  121. <el-table-column label="参考值" prop="range"/>
  122. </el-table>
  123. </div>
  124. </div>
  125. </template>
  126. </el-auto-resizer>
  127. </div>
  128. </template>
  129. <script setup name='EmrTest' lang="tsx">
  130. // 查询检验
  131. import {getServerDateApi} from "@/api/public-api";
  132. import {queryInspectionDetail, queryInspectionsIndex} from '@/api/inspections'
  133. import {patInfo} from './emr-tools-store'
  134. import {onMounted, ref} from "vue";
  135. import XcTableV3 from "@/components/xiao-chan/xc-table-v3/XcTableV3.vue";
  136. import {XcColumn} from "@/components/xiao-chan/xc-table-v3/XcColumn";
  137. import {xcMessage} from '@/utils/xiaochan-element-plus'
  138. import TestDescribe from "@/components/zhu-yuan-yi-sheng/emr/auxiliary-tools/TestDescribe.vue";
  139. import {getDateRangeFormatDate} from '@/utils/date'
  140. import {emrCopyFunc} from '@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-init'
  141. const emits = defineEmits(['close'])
  142. const sidebarList = ref()
  143. const mainList = ref()
  144. const tableRef = ref()
  145. const drugSensitivityRef = ref()
  146. const inspectionHeader = ref({
  147. aply_CNTN: ''
  148. })
  149. const dateRange = ref([])
  150. const query = async () => {
  151. let {startTime, endTime} = getDateRangeFormatDate(dateRange.value)
  152. const param = {
  153. type: 1,
  154. content: patInfo.value.inpatientNo,
  155. start: startTime,
  156. end: endTime,
  157. }
  158. queryInspectionsIndex(param).then((res) => {
  159. sidebarList.value = res
  160. console.log(res)
  161. })
  162. }
  163. const sidebarColums: XcColumn<any>[] = [
  164. {title: '名称', key: 'aply_CTNT'},
  165. {title: '时间', key: 'ordr_CREATE_DATE', width: 180}
  166. ]
  167. const expands = ref([])
  168. let currentReportForm = {}
  169. const sidebarRow = (row) => {
  170. currentReportForm = row
  171. queryInspectionDetail(row.ordr_ID).then((res) => {
  172. mainList.value = res['inspectionItems']
  173. inspectionHeader.value = res['inspectionHeader']
  174. mainList.value.forEach(item => {
  175. if (item.bacteriaResults.length > 0) {
  176. expands.value.push(item.itm_ORDR)
  177. }
  178. })
  179. })
  180. }
  181. const testRowClick = (row) => {
  182. let temp = tableRef.value.getSelectionRows()
  183. tableRef.value.toggleRowSelection(row, !temp.includes(row))
  184. }
  185. const drugTable = (row) => {
  186. let temp = drugSensitivityRef.value.getSelectionRows()
  187. drugSensitivityRef.value.toggleRowSelection(row, !temp.includes(row))
  188. }
  189. let copyStr = ''
  190. const appendCopy = () => {
  191. let temp = tableRef.value.getSelectionRows()
  192. let drugSensitivity = []
  193. try {
  194. drugSensitivity = drugSensitivityRef.value.getSelectionRows()
  195. } catch (e) {
  196. }
  197. if (temp.length === 0 && drugSensitivity.length === 0) {
  198. xcMessage.error('请先选选择数据')
  199. }
  200. let data = currentReportForm.aply_CTNT + ":"
  201. temp.forEach(item => {
  202. data += `${item.itm_NAME}${result(item)}${item.itm_UNIT}${getItemStr(item.itm_ALERT, item.itm_STR_VALUE, item.itm_VALUE)},`
  203. })
  204. drugSensitivity.forEach(item => {
  205. data += `${item.anti_NAME_CN}${item.anti_ABB}${item.anti_MIC}${item.anti_VALUE},`
  206. })
  207. copyStr += ' ' + data
  208. xcMessage.success('追加成功。')
  209. }
  210. const copyClick = () => {
  211. emrCopyFunc(copyStr)
  212. emits('close')
  213. }
  214. const result = (row) => {
  215. if (row.bacteriaResults.length > 0) {
  216. return row.bacteriaResults[0].bac_NAME_CN
  217. }
  218. return `${row.itm_VALUE} ${row.itm_STR_VALUE}`
  219. }
  220. function filterSex(val) {
  221. switch (val) {
  222. case '0':
  223. return '未填'
  224. case '1':
  225. return '男'
  226. case '2':
  227. return '女'
  228. case '3':
  229. return '未知'
  230. }
  231. return ''
  232. }
  233. function filterAgeUnit(val) {
  234. switch (val) {
  235. case '0':
  236. return '岁'
  237. case '1':
  238. return '月'
  239. case '2':
  240. return '天'
  241. case '3':
  242. return '时'
  243. }
  244. return ''
  245. }
  246. function getItemAlert(val, strValue, value) {
  247. if (strValue !== '' || value === '') return ''
  248. switch (val) {
  249. case 'L':
  250. return '<span style="color:#F56C6C;font-weight:bold">↓</span>'
  251. case 'H':
  252. return '<span style="color:#F56C6C;font-weight:bold">↑</span>'
  253. }
  254. return '<span style="color:#67C23A;font-weight:bold">正常</span>'
  255. }
  256. function getItemStr(val, strValue, value) {
  257. if (strValue !== '' || value === '') return ''
  258. switch (val) {
  259. case 'L':
  260. return '↓'
  261. case 'H':
  262. return '↑'
  263. }
  264. return '正常'
  265. }
  266. onMounted(async () => {
  267. dateRange.value.push(patInfo.value.admissDate)
  268. dateRange.value.push(await getServerDateApi())
  269. await query()
  270. // todo 检验接口没有返回危急值。
  271. // let res = await getCriticalValueByPatInfo(patInfo.value.inpatientNo, patInfo.value.admissTimes)
  272. })
  273. </script>
  274. <style scoped lang="scss">
  275. .container {
  276. width: 100%;
  277. height: 90%;
  278. }
  279. .sidebar {
  280. width: 420px;
  281. }
  282. .main {
  283. width: 100%;
  284. height: 100%;
  285. }
  286. .describe {
  287. width: 100%;
  288. margin-left: 20px;
  289. font-size: 12px;
  290. .pat-info {
  291. display: flex;
  292. div {
  293. padding: 5px;
  294. }
  295. }
  296. .test-date {
  297. display: flex;
  298. div {
  299. padding: 5px;
  300. }
  301. }
  302. }
  303. </style>