index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618
  1. <template>
  2. <div class="app-container">
  3. <div class="left-menu">
  4. <div class="back-button" @click="goBack">
  5. <el-icon>
  6. <ArrowLeft />
  7. </el-icon>
  8. 返回患者列表
  9. </div>
  10. <el-menu :default-active="activeMenu" class="medical-menu" @select="handleSelect">
  11. <el-menu-item index="medicalRecord">
  12. <span>营养病例</span>
  13. </el-menu-item>
  14. <el-menu-item index="visitRecord">
  15. <span>就诊记录</span>
  16. </el-menu-item>
  17. <el-menu-item index="checkLabel">
  18. <span>检查指标</span>
  19. </el-menu-item>
  20. <el-menu-item index="nutritionScreeningAdd" v-show="false">
  21. <span>营养筛查新增</span>
  22. </el-menu-item>
  23. <el-menu-item index="nutritionScreening">
  24. <span>营养筛查</span>
  25. </el-menu-item>
  26. <el-menu-item index="nutritionEvaluationAdd" v-show="false">
  27. <span>营养评估新增</span>
  28. </el-menu-item>
  29. <el-menu-item index="nutritionEvaluation">
  30. <span>营养评估</span>
  31. </el-menu-item>
  32. <el-menu-item index="nutritionDiagnosis">
  33. <span>营养诊断</span>
  34. </el-menu-item>
  35. <el-sub-menu index="nutritionIntervention">
  36. <template #title>营养干预</template>
  37. <el-menu-item index="nutritionSetting">营养设定</el-menu-item>
  38. <el-menu-item index="enteralNutrition">肠内营养</el-menu-item>
  39. <el-menu-item index="enteralNutritionHistory" v-show="false">肠内营养历史处方</el-menu-item>
  40. <el-menu-item index="parenteralNutrition">肠外营养</el-menu-item>
  41. <el-menu-item index="dietTherapy">膳食治疗</el-menu-item>
  42. </el-sub-menu>
  43. <el-menu-item index="nutritionMonitor">
  44. <span>营养监测</span>
  45. </el-menu-item>
  46. <el-menu-item index="nutritionEducation">
  47. <span>营养宣教</span>
  48. </el-menu-item>
  49. </el-menu>
  50. <div class="search-bar">
  51. <el-input v-model="searchValue" placeholder="姓名/床号/门诊号" size="small" class="search-input" @keyup.enter="handleSearch" />
  52. <el-button size="small" type="primary" class="search-btn" @click="handleSearch">搜索</el-button>
  53. </div>
  54. <div class="patient-tabs">
  55. <el-tabs v-model="patientTab" size="small" stretch @tab-change="handleTabChange">
  56. <el-tab-pane :label="`待诊${waitingCount}`" name="wait" />
  57. <el-tab-pane :label="`诊中${treatingCount}`" name="doing" />
  58. <el-tab-pane :label="`已诊${treatedCount}`" name="done" />
  59. </el-tabs>
  60. </div>
  61. <div class="patient-table">
  62. <el-table :data="patientList" border size="small" height="80%" :show-header="true" class="table-patients" :row-class-name="tableRowClassName" @row-dblclick="handleRowClick">
  63. <el-table-column prop="name" label="姓名" width="60" />
  64. <el-table-column prop="gender" label="性别" width="50" />
  65. <el-table-column prop="age" label="年龄" width="80" />
  66. </el-table>
  67. </div>
  68. <div class="nav-btns">
  69. <el-button size="small" @click="handlePrev">上一位</el-button>
  70. <el-button size="small" type="primary" @click="handleNext">下一位</el-button>
  71. </div>
  72. </div>
  73. <div class="main-content">
  74. <el-row :gutter="20">
  75. <el-col :span="4">
  76. <div class="patient-left-info">
  77. <el-row class="info-row">
  78. <span class="name">{{ patientInfo.name }}</span>
  79. <span class="age">{{ patientInfo.age }}</span>
  80. <span class="gender-icon" :class="patientInfo.gender === '男' ? 'male' : 'female'">
  81. {{ patientInfo.gender === '男' ? '♂' : '♀' }}
  82. </span>
  83. </el-row>
  84. <el-row style="margin-top: 10px; margin-left: 10%">
  85. <el-button size="small" @click="handleEdit">编辑</el-button>
  86. <el-button size="small" type="primary" @click="handleDetail">详情</el-button>
  87. </el-row>
  88. </div>
  89. </el-col>
  90. <el-col :span="20">
  91. <div class="patient-right-info">
  92. <el-row>
  93. <el-col :span="24">
  94. <span>门诊号:{{ patientInfo.outpatientNo }}</span>
  95. <span style="margin-left: 30px">科室:{{ patientInfo.deptName }}</span>
  96. <!-- <span style="margin-left: 30px" v-if="patientInfo.type == '1'">床号:{{ patientInfo.bedNo|| '--' }}</span> -->
  97. <span style="margin-left: 30px">营养诊断:{{useStore.diagnosisInfo?.diagnosisLabelStr|| '--' }}</span>
  98. </el-col>
  99. </el-row>
  100. <el-row>
  101. <el-col>
  102. <el-tooltip effect="light" :content=" stripHtml(useStore.diagnosisInfo?.consultantResult) || '--'" placement="top">
  103. <span class="truncate-text">
  104. 会诊结果:{{ stripHtml(useStore.diagnosisInfo?.consultantResult) || '--' }}
  105. </span>
  106. </el-tooltip>
  107. </el-col>
  108. </el-row>
  109. </div>
  110. </el-col>
  111. </el-row>
  112. <component :is="currentComponent" v-if="currentComponent" :patient-info="patientInfo" @change="handleSelect" />
  113. </div>
  114. <!-- 患者详情弹窗 -->
  115. <DetailDialog v-model:visible="showDetailDialog" :detail-data="detailData" :physical-activity-dict="physicalActivityDict" @close="handleDetailClose" />
  116. <!-- 新增:编辑弹窗 -->
  117. <EditDialog v-model:visible="showEditDialog" :edit-data="editData" @close="handleEditClose" @save="handleEditSave" />
  118. </div>
  119. </template>
  120. <script setup name="MedicalRecord" lang="ts">
  121. import { listDiagnosis } from '@/api/patients/diagnosis';
  122. import { DiagnosisVO, } from '@/api/patients/diagnosis/types';
  123. import { ref, onMounted, getCurrentInstance, toRefs, defineAsyncComponent } from 'vue';
  124. import { useRoute, useRouter } from 'vue-router';
  125. import { ArrowLeft } from '@element-plus/icons-vue';
  126. import { listTreatmentUser, getTreatmentUser } from '@/api/workbench/treatmentUser';
  127. import DetailDialog from './detailDialog.vue';
  128. import EditDialog from './editDialog.vue';
  129. const diagnosisList = ref < DiagnosisVO[] > ([]);
  130. import { useNutritionDiagnosisStore } from '@/store/modules/diagnosis';
  131. const useStore = useNutritionDiagnosisStore();
  132. // 动态导入组件
  133. const MedicalRecord = defineAsyncComponent(() => import('./levelMenu.vue'));
  134. const NutritionScreening = defineAsyncComponent(() => import('@/views/patients/screening/index.vue'));
  135. const NutritionEvaluation = defineAsyncComponent(() => import('@/views/patients/evaluation/index.vue'));
  136. const NutriDiagnosis = defineAsyncComponent(() => import('@/views/patients/nutriDiagnosis/index.vue'));
  137. const CheckLabel = defineAsyncComponent(() => import('@/views/patients/checkLabel/index.vue'));
  138. const NutritionScreeningAdd = defineAsyncComponent(() => import('@/views/patients/screening/add.vue'));
  139. const NutritionEvaluationAdd = defineAsyncComponent(() => import('@/views/patients/evaluation/add.vue'));
  140. const NutritionEducation = defineAsyncComponent(() => import('@/views/patients/nutritionEducation/index.vue'));
  141. const NutritionSetting = defineAsyncComponent(() => import('@/views/patients/nutritionSetting/index.vue'));
  142. const DietTherapy = defineAsyncComponent(() => import('@/views/patients/dietTherapy/index.vue'));
  143. const ParenteralNutrition = defineAsyncComponent(() => import('@/views/patients/parenteralNutrition/index.vue'));
  144. const EnteralNutrition = defineAsyncComponent(() => import('@/views/patients/enteralNutrition/index.vue'));
  145. const EnteralNutritionHistory = defineAsyncComponent(() => import('@/views/patients/enteralNutrition/history.vue'));
  146. const componentMap = {
  147. medicalRecord: MedicalRecord,
  148. checkLabel: CheckLabel,
  149. nutritionDiagnosis: NutriDiagnosis,
  150. nutritionScreening: NutritionScreening,
  151. nutritionScreeningAdd: NutritionScreeningAdd,
  152. nutritionEvaluation: NutritionEvaluation,
  153. nutritionEvaluationAdd: NutritionEvaluationAdd,
  154. nutritionEducation: NutritionEducation,
  155. nutritionSetting: NutritionSetting,
  156. dietTherapy: DietTherapy,
  157. parenteralNutrition: ParenteralNutrition,
  158. enteralNutrition: EnteralNutrition,
  159. enteralNutritionHistory: EnteralNutritionHistory,
  160. };
  161. const currentComponent = ref(componentMap['medicalRecord']);
  162. const route = useRoute();
  163. const router = useRouter();
  164. const { proxy } = getCurrentInstance() as any;
  165. const activeMenu = ref('medicalRecord');
  166. const patientInfo = ref({
  167. id: '',
  168. name: '',
  169. age: '',
  170. gender: '',
  171. type: '',
  172. deptId: '',
  173. deptName: '',
  174. outpatientNo: '',
  175. height: '',
  176. weight: '',
  177. bmi: '',
  178. activity: '',
  179. bedNo: ''
  180. });
  181. // 弹窗控制
  182. const showDetailDialog = ref(false);
  183. const detailData = ref({});
  184. const physicalActivityDict = ref([]);
  185. const showEditDialog = ref(false);
  186. const editData = ref({} as any);
  187. const handleSelect = (key: string, other ? : string[]) => {
  188. if (key == 'nutritionScreeningAdd' || key == 'nutritionEvaluationAdd') {
  189. activeMenu.value = key.replace('Add', '');
  190. }
  191. if (key == 'enteralNutritionHistory') {
  192. activeMenu.value = key.replace('History', '');
  193. } else {
  194. activeMenu.value = key;
  195. }
  196. currentComponent.value = componentMap[key] || null;
  197. patientInfo.value['other'] = other;
  198. patientInfo.value.type = route.query.type;
  199. patientInfo.value.outpatientNo = route.query.outpatientNo;
  200. };
  201. const goBack = () => {
  202. router.back();
  203. };
  204. const searchValue = ref('');
  205. const patientTab = ref('wait');
  206. const patientList = ref([]);
  207. const loading = ref(false);
  208. const currentPatientIndex = ref(0);
  209. // 添加tooltip相关的状态和方法
  210. const tooltipVisible = ref(false);
  211. const tooltipContent = ref('');
  212. const tooltipStyle = ref({
  213. left: '0px',
  214. top: '0px'
  215. });
  216. function stripHtml(html) {
  217. if (typeof html === 'undefined' || html === null) {
  218. return '--';
  219. }
  220. const div = document.createElement('div');
  221. div.innerHTML = html;
  222. return div.textContent || div.innerText || '';
  223. }
  224. const tableRowClassName = ({ row, rowIndex }) => {
  225. return rowIndex === currentPatientIndex.value ? 'current-row' : '';
  226. };
  227. const handleRowClick = (row, column, event) => {
  228. activeMenu.value = 'medicalRecord';
  229. currentComponent.value = componentMap['medicalRecord'];
  230. const idx = patientList.value.findIndex((item) => item === row);
  231. patientInfo.value = row;
  232. patientInfo.value.type = route.query.type;
  233. patientInfo.value.outpatientNo = route.query.outpatientNo;
  234. if (idx !== -1) {
  235. currentPatientIndex.value = idx;
  236. }
  237. getDiagnosisList();
  238. };
  239. const handlePrev = () => {
  240. activeMenu.value = 'medicalRecord';
  241. currentComponent.value = componentMap['medicalRecord'];
  242. if (currentPatientIndex.value > 0) {
  243. patientInfo.value = patientList.value[currentPatientIndex.value - 1];
  244. patientInfo.value.type = route.query.type;
  245. patientInfo.value.outpatientNo = route.query.outpatientNo;
  246. currentPatientIndex.value--;
  247. }
  248. getDiagnosisList();
  249. };
  250. const handleNext = () => {
  251. activeMenu.value = 'medicalRecord';
  252. currentComponent.value = componentMap['medicalRecord'];
  253. patientInfo.value = patientList.value[currentPatientIndex.value + 1];
  254. patientInfo.value.type = route.query.type;
  255. patientInfo.value.outpatientNo = route.query.outpatientNo;
  256. if (currentPatientIndex.value < patientList.value.length - 1) {
  257. currentPatientIndex.value++;
  258. }
  259. getDiagnosisList();
  260. };
  261. const handleTabChange = (tab: string) => {
  262. if (tab == 'wait') {
  263. getList();
  264. } else {
  265. patientList.value = [];
  266. }
  267. };
  268. const getDiagnosisList = async () => {
  269. const params: any = {
  270. pageNum: null,
  271. pageSize: null,
  272. treatmentUserId: patientInfo.value.id
  273. };
  274. try {
  275. const res = await listDiagnosis(params);
  276. diagnosisList.value = res.rows || [];
  277. useStore.setDiagnosisList(res.rows || [])
  278. if (diagnosisList.value.length > 0) {
  279. // 默认选中第一个
  280. useStore.setDiagnosisInfo(diagnosisList.value[0])
  281. } else {
  282. useStore.setDiagnosisInfo({} as DiagnosisVO)
  283. }
  284. } catch (error) {
  285. proxy ?.$modal.msgError('获取列表失败');
  286. useStore.setDiagnosisList([])
  287. }
  288. }
  289. // 编辑按钮处理
  290. const handleEdit = async () => {
  291. if (!patientInfo.value.id) {
  292. proxy ?.$modal.msgError('请先选择患者');
  293. return;
  294. }
  295. try {
  296. const res = await getTreatmentUser(patientInfo.value.id);
  297. editData.value = res.data;
  298. showEditDialog.value = true;
  299. } catch (error) {
  300. console.error('获取患者详情失败:', error);
  301. proxy ?.$modal.msgError('获取患者详情失败');
  302. }
  303. };
  304. // 详情按钮处理
  305. const handleDetail = async () => {
  306. if (!patientInfo.value.id) {
  307. proxy ?.$modal.msgError('请先选择患者');
  308. return;
  309. }
  310. try {
  311. const res = await getTreatmentUser(patientInfo.value.id);
  312. detailData.value = res.data;
  313. showDetailDialog.value = true;
  314. } catch (error) {
  315. console.error('获取患者详情失败:', error);
  316. proxy ?.$modal.msgError('获取患者详情失败');
  317. }
  318. };
  319. // 详情弹窗关闭处理
  320. const handleDetailClose = () => {
  321. showDetailDialog.value = false;
  322. detailData.value = {};
  323. };
  324. const handleEditClose = () => {
  325. showEditDialog.value = false;
  326. editData.value = {};
  327. };
  328. const handleEditSave = (data) => {
  329. showEditDialog.value = false;
  330. proxy ?.$modal.msgSuccess('保存成功');
  331. getList();
  332. };
  333. const waitingCount = ref(0);
  334. const treatingCount = ref(0);
  335. const treatedCount = ref(0);
  336. const getList = async () => {
  337. loading.value = true;
  338. try {
  339. const params: any = {
  340. pageNum: 1,
  341. pageSize: 10
  342. };
  343. if (searchValue.value) {
  344. params.searchFlag = searchValue.value;
  345. }
  346. const res = await listTreatmentUser(params);
  347. patientList.value = (res.rows || []).map(item => ({
  348. id: item.id,
  349. name: item.treatName,
  350. type: item.type,
  351. deptId: item.doorId,
  352. deptName: item.deptName,
  353. outpatientNo: item.outpatientNo,
  354. gender: item.sex === '0' ? '男' : item.sex === '1' ? '女' : '',
  355. age: item.age,
  356. BMI: item.bmi,
  357. height: item.height,
  358. weight: item.weight,
  359. activity: item.activity,
  360. bedNo: item.bedNo
  361. }));
  362. waitingCount.value = patientList.value.length;
  363. // 如果有患者数据,根据路由参数或默认选中第一个
  364. if (patientList.value.length > 0) {
  365. const { id } = route.query;
  366. if (typeof id === 'string') {
  367. const targetIndex = patientList.value.findIndex(patient => patient.id === id);
  368. if (targetIndex !== -1) {
  369. patientInfo.value = patientList.value[targetIndex];
  370. patientInfo.value.type = typeof route.query.type === 'string' ? route.query.type : '';
  371. patientInfo.value.outpatientNo = typeof route.query.outpatientNo === 'string' ? route.query.outpatientNo : '';
  372. currentPatientIndex.value = targetIndex;
  373. } else {
  374. patientInfo.value = patientList.value[0];
  375. patientInfo.value.type = typeof route.query.type === 'string' ? route.query.type : '';
  376. patientInfo.value.outpatientNo = typeof route.query.outpatientNo === 'string' ? route.query.outpatientNo : '';
  377. currentPatientIndex.value = 0;
  378. }
  379. } else {
  380. patientInfo.value = patientList.value[0];
  381. patientInfo.value.type = typeof route.query.type === 'string' ? route.query.type : '';
  382. patientInfo.value.outpatientNo = typeof route.query.outpatientNo === 'string' ? route.query.outpatientNo : '';
  383. currentPatientIndex.value = 0;
  384. }
  385. }
  386. loading.value = false;
  387. } catch (error) {
  388. console.error('获取列表失败:', error);
  389. loading.value = false;
  390. }
  391. };
  392. const handleSearch = () => {
  393. getList();
  394. };
  395. onMounted(() => {
  396. // 获取体力活动字典
  397. const { physical_activity } = toRefs(proxy ?.useDict('physical_activity'));
  398. physicalActivityDict.value = physical_activity ?.value || [];
  399. patientInfo.value.type = typeof route.query.type === 'string' ? route.query.type : '';
  400. patientInfo.value.outpatientNo = typeof route.query.outpatientNo === 'string' ? route.query.outpatientNo : '';
  401. getList();
  402. getDiagnosisList();
  403. });
  404. </script>
  405. <style lang="scss" scoped>
  406. .app-container {
  407. display: flex;
  408. height: calc(100vh - 50px);
  409. background-color: #f5f7fa;
  410. margin: -10px;
  411. }
  412. .left-menu {
  413. width: 220px;
  414. background-color: #fff;
  415. border-right: 1px solid #e6e6e6;
  416. display: flex;
  417. flex-direction: column;
  418. padding-bottom: 60px;
  419. /* 增加底部padding,为按钮留出空间 */
  420. position: relative;
  421. overflow: hidden;
  422. /* 防止内容溢出 */
  423. }
  424. .back-button {
  425. padding: 16px;
  426. display: flex;
  427. align-items: center;
  428. gap: 8px;
  429. cursor: pointer;
  430. color: #409eff;
  431. border-bottom: 1px solid #e6e6e6;
  432. font-size: 14px;
  433. .el-icon {
  434. font-size: 16px;
  435. }
  436. &:hover {
  437. background-color: #f5f7fa;
  438. }
  439. }
  440. .medical-menu {
  441. border-right: none;
  442. :deep(.el-menu-item) {
  443. font-size: 14px;
  444. height: 40px;
  445. line-height: 40px;
  446. }
  447. }
  448. .search-bar {
  449. display: flex;
  450. align-items: center;
  451. padding: 8px 12px 0 12px;
  452. gap: 6px;
  453. }
  454. .search-input {
  455. flex: 1;
  456. }
  457. .search-btn {
  458. margin-left: 0;
  459. }
  460. .patient-tabs {
  461. padding: 0 12px;
  462. margin-top: 8px;
  463. }
  464. .patient-table {
  465. min-width: 220px;
  466. overflow-x: auto;
  467. }
  468. .table-patients {
  469. table-layout: fixed;
  470. width: 100%;
  471. min-width: 220px;
  472. white-space: nowrap;
  473. .el-table__header th {
  474. background: #f5f7fa;
  475. color: #409eff;
  476. font-weight: bold;
  477. font-size: 13px;
  478. padding: 4px 0;
  479. }
  480. .el-table__row {
  481. cursor: pointer;
  482. }
  483. .el-table__row.current-row {
  484. background: #eaf4ff !important;
  485. }
  486. }
  487. .nav-btns {
  488. display: flex;
  489. justify-content: space-between;
  490. gap: 8px;
  491. position: absolute;
  492. left: 0;
  493. right: 0;
  494. bottom: 12px;
  495. padding: 0 12px;
  496. background: #fff;
  497. z-index: 1;
  498. width: calc(100% - 24px);
  499. margin: 0 auto;
  500. }
  501. .main-content {
  502. flex: 1;
  503. padding: 20px;
  504. overflow-y: auto;
  505. }
  506. .patient-left-info {
  507. background-color: #fff;
  508. height: 100px;
  509. padding: 10px;
  510. border-radius: 4px;
  511. margin-bottom: 20px;
  512. }
  513. .patient-right-info {
  514. background-color: #fff;
  515. height: 100px;
  516. padding: 20px;
  517. border-radius: 4px;
  518. margin-bottom: 20px;
  519. }
  520. .patient-right {
  521. background: #fff;
  522. }
  523. .info-row {
  524. display: flex;
  525. align-items: center;
  526. white-space: nowrap;
  527. }
  528. .info-row .name {
  529. font-size: 22px;
  530. }
  531. .info-row .age {
  532. margin-left: 30px;
  533. }
  534. .gender-icon {
  535. margin-left: 30px;
  536. font-size: 25px;
  537. font-weight: bold;
  538. line-height: 1;
  539. display: inline-block;
  540. vertical-align: middle;
  541. }
  542. .gender-icon.female {
  543. color: #ff4949;
  544. }
  545. .gender-icon.male {
  546. color: #409eff;
  547. }
  548. .truncate-text {
  549. display: -webkit-box;
  550. -webkit-line-clamp: 2;
  551. -webkit-box-orient: vertical;
  552. overflow: hidden;
  553. text-overflow: ellipsis;
  554. line-height: 1.5;
  555. max-height: 3em;
  556. }
  557. </style>