<template>
  <uni-card :border="false">
    <view class="flex justify-between">
      <view class="uni-secondary-color u-font-sm">
        <text class="u-m-r-30">{{ currentPatient?.patientName }}</text>
        <text class="u-m-r-30">{{ currentPatient?.patientAge }}</text>
        <text>{{ gender }}</text>
      </view>

      <view v-if="rightText">{{ rightText }}</view>
    </view>
  </uni-card>
</template>

<script lang="ts" setup>
import { useServiceStore } from '@/store/modules/service';
import { computed } from 'vue';
import { GET_GENDER_TEXT_BY_CODE } from '@/config/service';

defineProps({ rightText: String })

const serviceStore = useServiceStore()

const currentPatient = computed(() => serviceStore.currentPatient)

const gender = computed(() => {
  const val = currentPatient.value?.patientGender
  if (!val) return ''
  return GET_GENDER_TEXT_BY_CODE(Number(val))
})
</script>
