CareProgress.vue 13 KB

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