refactor: change props to encounter data
This commit is contained in:
No files matched your search
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, defineAsyncComponent } from 'vue'
|
import { computed } from 'vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
@@ -10,6 +10,9 @@ import SubMenu from '~/components/pub/my-ui/menus/submenu.vue'
|
|||||||
// Libraries
|
// Libraries
|
||||||
import { getPositionAs } from '~/lib/roles'
|
import { getPositionAs } from '~/lib/roles'
|
||||||
|
|
||||||
|
// Models
|
||||||
|
import { genEncounter } from '~/models/encounter'
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import type { EncounterProps } from '~/handlers/encounter-init.handler'
|
import type { EncounterProps } from '~/handlers/encounter-init.handler'
|
||||||
|
|
||||||
@@ -37,15 +40,13 @@ const activeMenu = computed({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const id = typeof route.params.id == 'string' ? parseInt(route.params.id) : 0
|
const id = typeof route.params.id == 'string' ? parseInt(route.params.id) : 0
|
||||||
const data = ref<any>(null)
|
const data = ref<any>(genEncounter())
|
||||||
const isShowPatient = computed(() => data.value && data.value?.patient?.person)
|
const isShowPatient = computed(() => data.value && data.value?.patient?.person)
|
||||||
|
|
||||||
if (activePosition.value === 'none') { // if user position is none, redirect to home page
|
if (activePosition.value === 'none') { // if user position is none, redirect to home page
|
||||||
router.push('/')
|
router.push('/')
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(JSON.stringify(user, null, 4))
|
|
||||||
|
|
||||||
// Dummy rows for ProtocolList (matches keys expected by list-cfg.protocol)
|
// Dummy rows for ProtocolList (matches keys expected by list-cfg.protocol)
|
||||||
const protocolRows = [
|
const protocolRows = [
|
||||||
{
|
{
|
||||||
@@ -83,16 +84,8 @@ function handleClick(type: string) {
|
|||||||
|
|
||||||
function initMenus() {
|
function initMenus() {
|
||||||
menus.value = getMenuItems(id, props, user, {
|
menus.value = getMenuItems(id, props, user, {
|
||||||
status: data.value,
|
encounter: data.value
|
||||||
medicalAssessment: data.value,
|
} as any, {
|
||||||
medicalAssessmentRehab: data.value,
|
|
||||||
functionAssessment: data.value,
|
|
||||||
protocolTheraphy: data.value,
|
|
||||||
protocolChemotherapy: data.value,
|
|
||||||
medicineProtocolChemotherapy: data.value,
|
|
||||||
consultation: data.value,
|
|
||||||
letterOfControl: data.value,
|
|
||||||
}, {
|
|
||||||
protocolTheraphy: paginationMeta,
|
protocolTheraphy: paginationMeta,
|
||||||
protocolChemotherapy: paginationMeta,
|
protocolChemotherapy: paginationMeta,
|
||||||
medicineProtocolChemotherapy: paginationMeta,
|
medicineProtocolChemotherapy: paginationMeta,
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ export interface EncounterProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface EncounterListData {
|
export interface EncounterListData {
|
||||||
|
encounter?: any
|
||||||
status?: any
|
status?: any
|
||||||
medicalAssessment?: any
|
medicalAssessment?: any
|
||||||
medicalAssessmentRehab: any
|
medicalAssessmentRehab: any
|
||||||
@@ -233,12 +234,12 @@ export function injectComponents(id: string | number, data: EncounterListData, m
|
|||||||
const currentKeys = { ...defaultKeys }
|
const currentKeys = { ...defaultKeys }
|
||||||
if (currentKeys?.status) {
|
if (currentKeys?.status) {
|
||||||
currentKeys.status['component'] = StatusAsync
|
currentKeys.status['component'] = StatusAsync
|
||||||
currentKeys.status['props'] = { encounter: data?.status }
|
currentKeys.status['props'] = { encounter: data?.encounter }
|
||||||
}
|
}
|
||||||
if (currentKeys?.earlyMedicalAssessment) {
|
if (currentKeys?.earlyMedicalAssessment) {
|
||||||
currentKeys.earlyMedicalAssessment['component'] = EarlyMedicalAssesmentListAsync
|
currentKeys.earlyMedicalAssessment['component'] = EarlyMedicalAssesmentListAsync
|
||||||
currentKeys.earlyMedicalAssessment['props'] = {
|
currentKeys.earlyMedicalAssessment['props'] = {
|
||||||
encounter: data?.medicalAssessment,
|
encounter: data?.encounter,
|
||||||
type: 'early-medic',
|
type: 'early-medic',
|
||||||
label: currentKeys.earlyMedicalAssessment['title'],
|
label: currentKeys.earlyMedicalAssessment['title'],
|
||||||
}
|
}
|
||||||
@@ -246,7 +247,7 @@ export function injectComponents(id: string | number, data: EncounterListData, m
|
|||||||
if (currentKeys?.rehabMedicalAssessment) {
|
if (currentKeys?.rehabMedicalAssessment) {
|
||||||
currentKeys.rehabMedicalAssessment['component'] = EarlyMedicalRehabListAsync
|
currentKeys.rehabMedicalAssessment['component'] = EarlyMedicalRehabListAsync
|
||||||
currentKeys.rehabMedicalAssessment['props'] = {
|
currentKeys.rehabMedicalAssessment['props'] = {
|
||||||
encounter: data?.medicalAssessmentRehab,
|
encounter: data?.encounter,
|
||||||
type: 'early-rehab',
|
type: 'early-rehab',
|
||||||
label: currentKeys.rehabMedicalAssessment['title'],
|
label: currentKeys.rehabMedicalAssessment['title'],
|
||||||
}
|
}
|
||||||
@@ -254,7 +255,7 @@ export function injectComponents(id: string | number, data: EncounterListData, m
|
|||||||
if (currentKeys?.functionAssessment) {
|
if (currentKeys?.functionAssessment) {
|
||||||
currentKeys.functionAssessment['component'] = AssesmentFunctionListAsync
|
currentKeys.functionAssessment['component'] = AssesmentFunctionListAsync
|
||||||
currentKeys.functionAssessment['props'] = {
|
currentKeys.functionAssessment['props'] = {
|
||||||
encounter: data?.functionAssessment,
|
encounter: data?.encounter,
|
||||||
type: 'function',
|
type: 'function',
|
||||||
label: currentKeys.functionAssessment['title'],
|
label: currentKeys.functionAssessment['title'],
|
||||||
}
|
}
|
||||||
@@ -263,13 +264,13 @@ export function injectComponents(id: string | number, data: EncounterListData, m
|
|||||||
// TODO: add component for therapyProtocol
|
// TODO: add component for therapyProtocol
|
||||||
currentKeys.therapyProtocol['component'] = null
|
currentKeys.therapyProtocol['component'] = null
|
||||||
currentKeys.therapyProtocol['props'] = {
|
currentKeys.therapyProtocol['props'] = {
|
||||||
data: data?.protocolTheraphy,
|
data: data?.encounter,
|
||||||
paginationMeta: meta?.protocolTheraphy,
|
paginationMeta: meta?.protocolTheraphy,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (currentKeys?.chemotherapyProtocol) {
|
if (currentKeys?.chemotherapyProtocol) {
|
||||||
currentKeys.chemotherapyProtocol['component'] = ChemoProtocolListAsync
|
currentKeys.chemotherapyProtocol['component'] = ChemoProtocolListAsync
|
||||||
currentKeys.chemotherapyProtocol['props'] = {
|
currentKeys.encounter['props'] = {
|
||||||
data: data?.protocolChemotherapy,
|
data: data?.protocolChemotherapy,
|
||||||
paginationMeta: meta?.protocolChemotherapy,
|
paginationMeta: meta?.protocolChemotherapy,
|
||||||
}
|
}
|
||||||
@@ -277,7 +278,7 @@ export function injectComponents(id: string | number, data: EncounterListData, m
|
|||||||
if (currentKeys?.chemotherapyMedicine) {
|
if (currentKeys?.chemotherapyMedicine) {
|
||||||
currentKeys.chemotherapyMedicine['component'] = ChemoMedicineProtocolListAsync
|
currentKeys.chemotherapyMedicine['component'] = ChemoMedicineProtocolListAsync
|
||||||
currentKeys.chemotherapyMedicine['props'] = {
|
currentKeys.chemotherapyMedicine['props'] = {
|
||||||
data: data?.medicineProtocolChemotherapy,
|
data: data?.encounter,
|
||||||
paginationMeta: meta?.medicineProtocolChemotherapy,
|
paginationMeta: meta?.medicineProtocolChemotherapy,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -332,7 +333,7 @@ export function injectComponents(id: string | number, data: EncounterListData, m
|
|||||||
}
|
}
|
||||||
if (currentKeys?.consultation) {
|
if (currentKeys?.consultation) {
|
||||||
currentKeys.consultation['component'] = ConsultationAsync
|
currentKeys.consultation['component'] = ConsultationAsync
|
||||||
currentKeys.consultation['props'] = { encounter: data?.consultation }
|
currentKeys.consultation['props'] = { encounter: data?.encounter }
|
||||||
}
|
}
|
||||||
if (currentKeys?.resume) {
|
if (currentKeys?.resume) {
|
||||||
currentKeys.resume['component'] = ResumeListAsync
|
currentKeys.resume['component'] = ResumeListAsync
|
||||||
@@ -340,7 +341,7 @@ export function injectComponents(id: string | number, data: EncounterListData, m
|
|||||||
}
|
}
|
||||||
if (currentKeys?.control) {
|
if (currentKeys?.control) {
|
||||||
currentKeys.control['component'] = ControlLetterListAsync
|
currentKeys.control['component'] = ControlLetterListAsync
|
||||||
currentKeys.control['props'] = { encounter: data?.letterOfControl }
|
currentKeys.control['props'] = { encounter: data?.encounter }
|
||||||
}
|
}
|
||||||
if (currentKeys?.screening) {
|
if (currentKeys?.screening) {
|
||||||
// TODO: add component for screening
|
// TODO: add component for screening
|
||||||
|
|||||||
Reference in New Issue
Block a user