CareProgress.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. <script setup lang="ts">
  2. import { ref, defineAsyncComponent, watch } from 'vue';
  3. import { getConditioningProcessMethod } from '@/request/api/care.api';
  4. import type { ConditioningRecordListModel, OpenConditioningSchemeModel } from '@/model/care.model';
  5. import RecordsIndicatorPreview from '@/components/RecordsIndicatorPreview.vue';
  6. import { useWatcher } from 'alova/client';
  7. import { patientMethod } from '@/request/api/patient.api';
  8. import { VxeUI } from 'vxe-pc-ui';
  9. import type { HealthReportSymptomItemVo } from '@/model/health-report.model';
  10. import type { LineSeriesOption } from 'echarts/charts';
  11. import { LineChart } from 'echarts/charts';
  12. import type { GridComponentOption, LegendComponentOption, MarkLineComponentOption, TitleComponentOption, TooltipComponentOption } from 'echarts/components';
  13. import { GridComponent, LegendComponent, MarkLineComponent, TitleComponent, TooltipComponent, VisualMapComponent } from 'echarts/components';
  14. import { use } from 'echarts/core';
  15. import { CanvasRenderer } from 'echarts/renderers';
  16. import VChart from 'vue-echarts';
  17. use([CanvasRenderer, LineChart, MarkLineComponent, GridComponent, VisualMapComponent, TitleComponent, TooltipComponent, LegendComponent]);
  18. const type = ref('careProgress');
  19. type FollowModel = Partial<ConditioningRecordListModel>;
  20. const props = defineProps<{
  21. data: FollowModel;
  22. patientId?: string;
  23. }>();
  24. // 患者基本信息
  25. const { data: patient } = useWatcher(() => patientMethod(props.data.patientId!), [() => props.data.patientId], {
  26. initialData: { ...props.data },
  27. immediate: true,
  28. middleware: (_, next) => {
  29. if (props.data.patientId) next();
  30. },
  31. });
  32. const careProcessList = ref<OpenConditioningSchemeModel>();
  33. const showCareBox = ref<boolean>(false);
  34. async function getCareProgress() {
  35. const res: any = await getConditioningProcessMethod(Number(props.data.id));
  36. careProcessList.value = res as OpenConditioningSchemeModel;
  37. if (res.provinceName || res.cityName || res.areaName || res.detailAddress || res.phone) {
  38. showCareBox.value = true;
  39. }
  40. }
  41. const isShowDelivery = ref<boolean>(false);
  42. // 监听 displayTableData 的变化
  43. watch(careProcessList, (newValue) => {
  44. if (newValue?.items) {
  45. isShowDelivery.value = newValue.items.some((item) => {
  46. return item.conditioningProgramDetail?.isDelivery === 'Y';
  47. });
  48. }
  49. });
  50. onMounted(async () => {
  51. if (props.data.id) {
  52. await getCareProgress();
  53. }
  54. });
  55. function openIndicatorRecordsPreview() {
  56. const component = defineAsyncComponent(() => import('@/components/RecordsIndicatorPreview.vue'));
  57. const id = `modal:record-indicator:preview`;
  58. const onDestroy = () => {
  59. VxeUI.modal.close(id);
  60. };
  61. onDestroy();
  62. VxeUI.modal.open({
  63. id,
  64. remember: true,
  65. showMaximize: true,
  66. mask: false,
  67. lockView: false,
  68. padding: false,
  69. resize: true,
  70. width: Math.floor(window.innerWidth * 0.5),
  71. height: Math.floor(window.innerHeight * 0.5),
  72. escClosable: true,
  73. maskClosable: true,
  74. title: `指标信息更新记录`,
  75. slots: {
  76. default() {
  77. return h(component, {
  78. patient: patient.value,
  79. onDestroy,
  80. });
  81. },
  82. },
  83. });
  84. }
  85. const panels = shallowReactive([
  86. {
  87. id: 'patient-health-records',
  88. title: '健康分析记录',
  89. component: defineAsyncComponent(() => import('@/widgets/PatientHealthRecordsWidget.vue')),
  90. },
  91. ]);
  92. const activePanel = ref(panels[0].id);
  93. const option = ref({
  94. title: { text: '评分', left: 'left', top: 0, textStyle: { fontSize: 14 } },
  95. tooltip: { trigger: 'axis' },
  96. xAxis: {
  97. type: 'category',
  98. data: [] as string[],
  99. boundaryGap: false,
  100. axisLine: { show: false },
  101. axisTick: { show: false }, // 不显示横坐标刻度
  102. axisLabel: { show: false }, // 不显示横坐标刻度名字
  103. },
  104. yAxis: {
  105. type: 'value',
  106. min: 20,
  107. max: 100,
  108. interval: 20,
  109. axisLine: { show: false }, // 不显示Y轴线
  110. axisLabel: { color: '#7ec8bb' },
  111. splitLine: {
  112. show: true,
  113. lineStyle: {
  114. type: 'dashed',
  115. color: '#e0e0e0',
  116. },
  117. },
  118. },
  119. series: [
  120. {
  121. type: 'line',
  122. data: [] as number[],
  123. smooth: true,
  124. symbol: 'circle',
  125. symbolSize: 12,
  126. itemStyle: {
  127. color: '#ffd700', // 黄色中心
  128. borderColor: '#ff8c00', // 橙色轮廓
  129. borderWidth: 2,
  130. },
  131. lineStyle: {
  132. color: '#b0c4de', // 浅蓝色线条
  133. width: 2,
  134. },
  135. label: {
  136. show: true,
  137. position: 'top',
  138. color: '#fff',
  139. backgroundColor: '#ff6b6b', // 红色标签背景
  140. borderRadius: 4,
  141. padding: [4, 8],
  142. formatter: function (params: any) {
  143. return params.name;
  144. },
  145. },
  146. markPoint: {
  147. symbol: 'circle',
  148. symbolSize: 16,
  149. label: {
  150. show: true,
  151. color: '#fff',
  152. fontWeight: 'bold',
  153. },
  154. itemStyle: {
  155. color: '#ff4d4f',
  156. },
  157. data: [] as Array<{
  158. coord: [string, number];
  159. value: number;
  160. name: string;
  161. label: { show: boolean; formatter: string };
  162. }>,
  163. },
  164. },
  165. ],
  166. grid: { left: 40, right: 20, top: 40, bottom: 30 },
  167. });
  168. // 监听数据变化更新图表
  169. watch(
  170. () => careProcessList.value?.patientConditioningScores,
  171. (newScores) => {
  172. if (newScores && newScores.length > 0) {
  173. option.value.xAxis.data = newScores.map((item) => item.time4);
  174. option.value.series[0].data = newScores.map((item) => item.score);
  175. option.value.series[0].markPoint.data = newScores.map((item) => ({
  176. coord: [item.time4, item.score],
  177. value: item.score,
  178. name: item.time4,
  179. label: { show: true, formatter: item.time4 },
  180. }));
  181. }
  182. },
  183. { immediate: true }
  184. );
  185. type SymptomItemVo = Record<
  186. `symptom-${HealthReportSymptomItemVo['id']}`,
  187. HealthReportSymptomItemVo & {
  188. trend: -1 | 0 | 1;
  189. }
  190. >;
  191. interface Model extends SymptomItemVo {
  192. id: string;
  193. duration?: string;
  194. influence?: string;
  195. healthAnalysisReportId?: number;
  196. tongueUpPictures?: string;
  197. tongueDownPictures?: string;
  198. facePictures?: string;
  199. }
  200. // 查看健康评估
  201. function open(row: Model) {
  202. const component = defineAsyncComponent(() => import('@/components/ReportPreview.vue'));
  203. const id = `drawer:report:preview`;
  204. const onDestroy = () => {
  205. VxeUI.drawer.close(id);
  206. };
  207. onDestroy();
  208. VxeUI.drawer.open({
  209. id,
  210. mask: true,
  211. lockView: false,
  212. padding: false,
  213. width: window.innerWidth - 256,
  214. escClosable: true,
  215. maskClosable: true,
  216. title: `健康分析报告`,
  217. slots: {
  218. default() {
  219. return h(component, {
  220. reportId: row.healthAnalysisReportId.toString(),
  221. onDestroy,
  222. });
  223. },
  224. },
  225. });
  226. }
  227. const progressTextMap: Record<string, string> = {
  228. '0': '待付款',
  229. '1': '已作废',
  230. '2': '用户取消',
  231. '3': '未开始',
  232. '4': '调理中',
  233. '5': '已完结',
  234. '6': '待收货',
  235. };
  236. </script>
  237. <template>
  238. <div class="care-progress-card">
  239. <div v-if="careProcessList">
  240. <div class="title-wrapper" v-if="careProcessList?.conditioningWrapName">{{ careProcessList?.conditioningWrapName }}</div>
  241. <div class="header">
  242. <span class="title" v-if="careProcessList?.progress">
  243. {{ progressTextMap[careProcessList?.progress] || '' }}
  244. </span>
  245. <span v-if="careProcessList?.patientName"
  246. >姓名:<span>{{ careProcessList?.patientName }}</span></span
  247. >
  248. <span v-if="careProcessList?.diagnosis">疾病名称:{{ careProcessList?.diagnosis }}</span>
  249. <span v-if="careProcessList?.symptom">证型:{{ careProcessList?.symptom }}</span>
  250. <span v-if="careProcessList?.createBy">开具医生:{{ careProcessList?.createBy }}</span>
  251. <span v-if="careProcessList?.estimatedStartDate && careProcessList?.estimatedEndDate"
  252. >调养周期:{{ careProcessList?.estimatedStartDate }} ~ {{ careProcessList?.estimatedEndDate }}</span
  253. >
  254. </div>
  255. </div>
  256. <div v-if="isShowDelivery && showCareBox" class="delivery-info" style="margin-left: 75px">
  257. <a-checkbox checked style="color: #52c41a; margin-right: 8px" />
  258. <span style="margin-right: 15px">配送</span>
  259. <span v-if="careProcessList?.provinceName || careProcessList?.cityName || careProcessList?.areaName || careProcessList?.detailAddress"
  260. >地址:{{ careProcessList?.provinceName }}{{ careProcessList?.cityName }}{{ careProcessList?.areaName }}{{ careProcessList?.detailAddress }}</span
  261. >
  262. <span style="margin-left: 16px" v-if="careProcessList?.phone">电话:{{ careProcessList?.phone }}</span>
  263. </div>
  264. <!-- 线上项目 -->
  265. <div v-for="item in careProcessList?.items" :key="item.id" class="project-card">
  266. <div class="project-section" v-if="item?.patientConditioningOfflines">
  267. <div class="project-title">
  268. <span style="font-size: 14px; font-weight: bold; color: black">◇ {{ item?.conditioningProgramDetail?.name }}</span>
  269. <span class="stat">数量:{{ item.totalMeasure }}{{ item?.conditioningProgramDetail?.cpFixedPricingRule?.pricingUnit || '次' }}</span>
  270. <span class="stat">还剩:{{ item?.remainCount }}{{ item?.conditioningProgramDetail?.cpFixedPricingRule?.pricingUnit || '次' }}</span>
  271. <span class="stat">已核销:{{ item?.finishCount }}{{ item?.conditioningProgramDetail?.cpFixedPricingRule?.pricingUnit || '次' }}</span>
  272. </div>
  273. <vxe-table :data="item?.patientConditioningOfflines" border>
  274. <vxe-column type="seq" title="序号" width="80" />
  275. <vxe-column field="operateTime" title="操作时间" />
  276. <vxe-column field="operateBy" title="操作人" />
  277. <vxe-column field="feedback" title="上次治疗反馈" />
  278. <vxe-column field="acuPointNames" title="穴位" />
  279. </vxe-table>
  280. <div class="mt-3">
  281. <div class="mb-1">预定频率:每{{ item.frequencyType }}天{{ item.frequencyMeasure }}{{ item?.conditioningProgramDetail?.cpFixedPricingRule?.convertUnit || '次' }}</div>
  282. <div v-if="item.remark">操作指南:{{ item.remark }}</div>
  283. </div>
  284. </div>
  285. <!-- 线上 -->
  286. <div class="yuanqi-tea" v-if="item?.patientConditioningOnlines">
  287. <div class="mb-2">
  288. <span class="mr-10" style="font-size: 14px; font-weight: bold; color: black">◇ {{ item?.conditioningProgramDetail?.name }}</span>
  289. <span>数量:{{ item.totalMeasure }} {{ item?.conditioningProgramDetail?.cpFixedPricingRule?.pricingUnit || '次' }}</span>
  290. </div>
  291. <div class="mb-1">预定频率:每{{ item.frequencyType }}天{{ item.frequencyMeasure }} {{ item?.conditioningProgramDetail?.cpFixedPricingRule?.convertUnit || '次' }}</div>
  292. <div v-if="item.remark">操作指南:{{ item.remark }}</div>
  293. </div>
  294. <!-- 健康评估 -->
  295. <div class="project-section mb-3 project-card" v-if="item?.healthAnalysisReports">
  296. <div class="project-title">
  297. <span style="font-size: 14px; font-weight: bold; color: black">◇ {{ item?.conditioningProgramDetail?.name }}</span>
  298. <span class="stat">数量:{{ item?.totalMeasure }} {{ item?.conditioningProgramDetail?.cpFixedPricingRule?.pricingUnit || '次' }}</span>
  299. <span class="stat">还剩:{{ item?.remainCount }} {{ item?.conditioningProgramDetail?.cpFixedPricingRule?.pricingUnit || '次' }}</span>
  300. <span class="stat">已核销:{{ item?.finishCount }} {{ item?.conditioningProgramDetail?.cpFixedPricingRule?.pricingUnit || '次' }}</span>
  301. </div>
  302. <vxe-table :data="item?.healthAnalysisReports" border>
  303. <vxe-column type="seq" title="序号" width="80" />
  304. <vxe-column field="analysisEndTime" title="操作时间" />
  305. <vxe-column title="评估记录">
  306. <template #default="{ row }">
  307. <a-button type="link" @click="open(row)">查看</a-button>
  308. </template>
  309. </vxe-column>
  310. </vxe-table>
  311. <div class="mt-3">
  312. <div class="mb-1">
  313. 预定频率:
  314. <span v-if="item?.frequencyType === '不限'">不限</span>
  315. <span v-else>每{{ item?.frequencyType }}天{{ item?.frequencyMeasure }}{{ item?.conditioningProgramDetail?.cpFixedPricingRule?.convertUnit || '次' }} </span>
  316. </div>
  317. <div v-if="item?.remark">操作指南:{{ item?.remark }}</div>
  318. </div>
  319. </div>
  320. </div>
  321. <!-- 调养效果 -->
  322. <div class="care-box">
  323. <h3 style="color: black">调养效果</h3>
  324. <div class="care-box-content">
  325. <!-- 评分 折线图 -->
  326. <div class="chart-wrapper" v-if="careProcessList?.patientConditioningScores && careProcessList.patientConditioningScores.length > 0">
  327. <v-chart :option="option" style="width: 350px; height: 200px" />
  328. </div>
  329. <!-- 健康记录 -->
  330. <div class="health-records-card" v-if="careProcessList?.healthAnalysisReports && careProcessList?.healthAnalysisReports.length > 0">
  331. <a-tabs class="panel-wrapper" v-model:activeKey="activePanel">
  332. <a-tab-pane v-for="panel in panels" :key="panel.id" class="panel-pane">
  333. <div class="panel-title">记录</div>
  334. <component :is="panel.component" :patient="patient" :healthAnalysisReports="careProcessList?.healthAnalysisReports" :type="type"></component>
  335. </a-tab-pane>
  336. </a-tabs>
  337. </div>
  338. <!-- 指标 -->
  339. <div class="mt-3" v-if="careProcessList?.patientQuotaGroups && careProcessList?.patientQuotaGroups.length > 0">
  340. <b>指标</b>
  341. <!-- <a-button type="link" @click="openIndicatorRecordsPreview">查看指标记录</a-button>
  342. -->
  343. <RecordsIndicatorPreview :records="careProcessList?.patientQuotaGroups" />
  344. </div>
  345. </div>
  346. </div>
  347. </div>
  348. </template>
  349. <style scoped>
  350. .care-box {
  351. margin: 20px 0 10px 0;
  352. }
  353. .care-box-content {
  354. border: 1px solid lightgray !important;
  355. padding: 10px;
  356. }
  357. .panel-pane {
  358. height: 600px !important;
  359. margin-bottom: 28px;
  360. }
  361. .panel-wrapper {
  362. :deep(.ant-tabs-content-holder) {
  363. padding-top: 12px;
  364. height: 600px;
  365. :deep(.ant-tabs-content) {
  366. height: 100%;
  367. }
  368. }
  369. }
  370. .care-progress-card {
  371. background: #fff;
  372. border-radius: 8px;
  373. padding: 18px 24px;
  374. box-shadow: 0 2px 8px #f0f1f2;
  375. margin: 0 0 24px 0;
  376. }
  377. .header {
  378. display: flex;
  379. flex-wrap: wrap;
  380. gap: 18px;
  381. align-items: center;
  382. font-size: 15px;
  383. margin-bottom: 8px;
  384. }
  385. .title {
  386. background: #ffb300;
  387. color: #fff;
  388. border-radius: 4px;
  389. padding: 4px 10px;
  390. font-weight: bold;
  391. }
  392. .delivery-info {
  393. display: flex;
  394. align-items: center;
  395. border-radius: 4px;
  396. padding: 6px 12px;
  397. margin-bottom: 12px;
  398. font-size: 14px;
  399. }
  400. .project-section {
  401. margin-top: 18px;
  402. border: 1px solid lightgray;
  403. /* border-radius: 6px; */
  404. padding: 6px 30px 6px 6px;
  405. }
  406. .project-title {
  407. display: flex;
  408. align-items: center;
  409. gap: 12px;
  410. margin-bottom: 8px;
  411. }
  412. .stat {
  413. display: inline-block;
  414. color: #333;
  415. border-radius: 8px;
  416. padding: 2px 10px;
  417. margin-left: 8px;
  418. font-size: 14px;
  419. }
  420. .custom-table .table-header {
  421. background: #e3eafc !important;
  422. color: #333 !important;
  423. font-weight: bold;
  424. font-size: 15px;
  425. }
  426. .project-footer {
  427. margin-top: 8px;
  428. font-size: 14px;
  429. color: #333;
  430. }
  431. .yuanqi-tea {
  432. margin-top: 18px;
  433. border: 1px solid lightgray;
  434. /* border-radius: 6px; */
  435. padding: 6px 30px 6px 6px;
  436. }
  437. .project-card :deep(.vxe-table--header th) {
  438. background: #9abde4 !important;
  439. color: black !important;
  440. }
  441. .health-records-card :deep(.vxe-table--header th) {
  442. background: #f8f8f9 !important;
  443. color: unset !important;
  444. }
  445. .project-card :deep(.vxe-table--border .vxe-body--row > td),
  446. .project-card :deep(.vxe-table--border .vxe-header--row > th) {
  447. border-color: #bfcbd9 !important;
  448. border-width: 2px !important;
  449. }
  450. .project-card :deep(.vxe-table--border) {
  451. border-color: #bfcbd9 !important;
  452. }
  453. :deep(.ant-tabs-nav) {
  454. position: unset;
  455. display: none;
  456. }
  457. .panel-title {
  458. margin-bottom: 10px;
  459. font-size: 16px;
  460. font-weight: bold;
  461. color: black;
  462. }
  463. .title-wrapper {
  464. text-align: center;
  465. margin-bottom: 20px;
  466. font-weight: bold;
  467. font-size: 17px;
  468. color: black;
  469. }
  470. .chart-wrapper {
  471. width: 100%;
  472. }
  473. </style>