ReportAnalysisEdit.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <script setup lang="ts">
  2. import type { PatientModel, ReportIndicatorModel, ReportModel } from '@/model';
  3. import { patientMethod } from '@/request/api/patient.api';
  4. import { indicatorByPatientIdMethod, reportMethod } from '@/request/api/report.api';
  5. import PatientCardWidget from '@/widgets/PatientCardWidget.vue';
  6. import ReportIndicatorWidget from '@/widgets/ReportIndicatorWidget.vue';
  7. import { useWatcher } from 'alova/client';
  8. const props = defineProps<{
  9. patient: Partial<PatientModel>;
  10. report: Partial<ReportModel>;
  11. }>();
  12. const emits = defineEmits<{
  13. destroy: [];
  14. }>();
  15. const patientId = computed(() => props.patient?.id);
  16. const reportId = computed(() => props.report?.id);
  17. const { data: patient, loading: patientLoading } = useWatcher(
  18. () => patientMethod(patientId.value!),
  19. [ () => props.patient?.id ],
  20. {
  21. initialData: { ...props.patient }, immediate: true,
  22. middleware: (_, next) => { if ( patientId.value ) next(); },
  23. },
  24. );
  25. const { data: report, loading: reportLoading } = useWatcher(
  26. () => reportMethod(reportId.value!),
  27. [ reportId ],
  28. {
  29. initialData: { ...props.report }, immediate: true,
  30. middleware: (_, next) => { if ( reportId.value ) next(); },
  31. },
  32. );
  33. const indicator = ref<ReportIndicatorModel[]>([]);
  34. const { loading: indicatorLoading } = useWatcher(
  35. () => indicatorByPatientIdMethod(patientId.value!, false),
  36. [ () => props.patient?.id ],
  37. {
  38. initialData: [], immediate: true,
  39. middleware: (_, next) => { if ( patientId.value ) next(); },
  40. },
  41. ).onSuccess(({ data }) => {
  42. indicator.value = data.filter(item => !item.editor?.disabled).map(({ value, ...item }) => item);
  43. });
  44. </script>
  45. <template>
  46. <div id="page-container-scroller" class="page-container flex flex-col">
  47. <PatientCardWidget :dataset="patient" :loading="patientLoading" />
  48. <div ref="container" class="card card__report-analysis">
  49. <div class="card__header sticky flex justify-between items-center">
  50. <div class="card__title">
  51. <span>症状信息</span>
  52. <a-spin v-if="reportLoading" size="small" style="margin-left: 4px;" />
  53. </div>
  54. </div>
  55. <div class="card__content">
  56. <a-descriptions :column="2">
  57. <a-descriptions-item v-if="report.tongueAnalysisResult">
  58. <a-space align="start">
  59. <a-image :width="200" :height="200" :src="report.upImg" :preview="true" />
  60. <a-image :width="200" :height="200" :src="report.downImg" :preview="true" />
  61. <a-card size="small" title="舌象分析结果">
  62. {{ report.tongueAnalysisResult }}
  63. </a-card>
  64. </a-space>
  65. </a-descriptions-item>
  66. <a-descriptions-item v-if="report.faceAnalysisResult">
  67. <a-space wrap>
  68. <a-space align="start">
  69. <a-image v-if="report.faceImg" :width="200" :height="200" :src="report.faceImg" :preview="true" />
  70. <a-card size="small" title="面象分析结果">
  71. {{ report.faceAnalysisResult }}
  72. </a-card>
  73. </a-space>
  74. </a-space>
  75. </a-descriptions-item>
  76. </a-descriptions>
  77. <a-card class="card no-bordered background m-t-8px" size="small">
  78. <a-descriptions :column="1">
  79. <a-descriptions-item v-if="report.pickedSymptom || report.influenceDegree || report.duration"
  80. label="补充症状"
  81. >
  82. <span class="phrase" v-if="report.pickedSymptom">{{ report.pickedSymptom }}</span>
  83. <span class="phrase" v-if="report.influenceDegree">{{ report.influenceDegree }}</span>
  84. <span class="phrase" v-if="report.duration">{{ report.duration }}</span>
  85. </a-descriptions-item>
  86. <a-descriptions-item v-if="report.algorithmInferSymptom" label="联想症状">
  87. {{ report.algorithmInferSymptom }}
  88. </a-descriptions-item>
  89. </a-descriptions>
  90. </a-card>
  91. </div>
  92. </div>
  93. <ReportIndicatorWidget
  94. :dataset="indicator" :loading="indicatorLoading"
  95. :patientId editable
  96. @destroy="()=>$emit('destroy')"
  97. />
  98. </div>
  99. </template>
  100. <style scoped lang="scss">
  101. @import "@/themes/report-card";
  102. </style>